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 @global_system_unordered_load(
17 ; GFX6-LABEL: global_system_unordered_load:
18 ; GFX6: ; %bb.0: ; %entry
19 ; GFX6-NEXT: s_load_dwordx2 s[8:9], s[6:7], 0x0
20 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x2
21 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
22 ; GFX6-NEXT: s_mov_b32 s6, s9
23 ; GFX6-NEXT: ; kill: def $sgpr8 killed $sgpr8 killed $sgpr8_sgpr9
24 ; GFX6-NEXT: s_mov_b32 s12, 0x100f000
25 ; GFX6-NEXT: s_mov_b32 s13, -1
26 ; GFX6-NEXT: ; kill: def $sgpr8 killed $sgpr8 def $sgpr8_sgpr9_sgpr10_sgpr11
27 ; GFX6-NEXT: s_mov_b32 s9, s6
28 ; GFX6-NEXT: s_mov_b32 s10, s13
29 ; GFX6-NEXT: s_mov_b32 s11, s12
30 ; GFX6-NEXT: s_mov_b32 s14, s5
31 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
32 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
33 ; GFX6-NEXT: s_mov_b32 s5, s14
34 ; GFX6-NEXT: s_mov_b32 s6, s13
35 ; GFX6-NEXT: s_mov_b32 s7, s12
36 ; GFX6-NEXT: buffer_load_dword v0, off, s[8:11], 0
37 ; GFX6-NEXT: s_waitcnt vmcnt(0)
38 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
41 ; GFX7-LABEL: global_system_unordered_load:
42 ; GFX7: ; %bb.0: ; %entry
43 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
44 ; GFX7-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
45 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x2
46 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
47 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
48 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
49 ; GFX7-NEXT: flat_load_dword v2, v[0:1]
50 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
51 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
52 ; GFX7-NEXT: s_waitcnt vmcnt(0)
53 ; GFX7-NEXT: flat_store_dword v[0:1], v2
56 ; GFX10-WGP-LABEL: global_system_unordered_load:
57 ; GFX10-WGP: ; %bb.0: ; %entry
58 ; GFX10-WGP-NEXT: s_mov_b64 s[4:5], s[6:7]
59 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
60 ; GFX10-WGP-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
61 ; GFX10-WGP-NEXT: s_nop 0
62 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
63 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
64 ; GFX10-WGP-NEXT: global_load_dword v1, v0, s[6:7]
65 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
66 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
67 ; GFX10-WGP-NEXT: s_endpgm
69 ; GFX10-CU-LABEL: global_system_unordered_load:
70 ; GFX10-CU: ; %bb.0: ; %entry
71 ; GFX10-CU-NEXT: s_mov_b64 s[4:5], s[6:7]
72 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
73 ; GFX10-CU-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
74 ; GFX10-CU-NEXT: s_nop 0
75 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
76 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
77 ; GFX10-CU-NEXT: global_load_dword v1, v0, s[6:7]
78 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
79 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
80 ; GFX10-CU-NEXT: s_endpgm
82 ; SKIP-CACHE-INV-LABEL: global_system_unordered_load:
83 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
84 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[4:5], s[2:3], 0x0
85 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x2
86 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
87 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s5
88 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
89 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, 0xf000
90 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s9, -1
91 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
92 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s2
93 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, s9
94 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s8
95 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s10, s1
96 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
97 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
98 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s10
99 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s9
100 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s8
101 ; SKIP-CACHE-INV-NEXT: buffer_load_dword v0, off, s[4:7], 0
102 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
103 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
104 ; SKIP-CACHE-INV-NEXT: s_endpgm
106 ; GFX90A-NOTTGSPLIT-LABEL: global_system_unordered_load:
107 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
108 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
109 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
110 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
111 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
112 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
113 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
114 ; GFX90A-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[6:7]
115 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
116 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
117 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
119 ; GFX90A-TGSPLIT-LABEL: global_system_unordered_load:
120 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
121 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
122 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
123 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
124 ; GFX90A-TGSPLIT-NEXT: s_nop 0
125 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
126 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
127 ; GFX90A-TGSPLIT-NEXT: global_load_dword v1, v0, s[6:7]
128 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
129 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
130 ; GFX90A-TGSPLIT-NEXT: s_endpgm
132 ; GFX940-NOTTGSPLIT-LABEL: global_system_unordered_load:
133 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
134 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
135 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
136 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
137 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
138 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
139 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
140 ; GFX940-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[2:3]
141 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
142 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
143 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
145 ; GFX940-TGSPLIT-LABEL: global_system_unordered_load:
146 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
147 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
148 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
149 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
150 ; GFX940-TGSPLIT-NEXT: s_nop 0
151 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
152 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
153 ; GFX940-TGSPLIT-NEXT: global_load_dword v1, v0, s[2:3]
154 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
155 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
156 ; GFX940-TGSPLIT-NEXT: s_endpgm
158 ; GFX11-WGP-LABEL: global_system_unordered_load:
159 ; GFX11-WGP: ; %bb.0: ; %entry
160 ; GFX11-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
161 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
162 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
163 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
164 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
165 ; GFX11-WGP-NEXT: global_load_b32 v1, v0, s[2:3]
166 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
167 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
168 ; GFX11-WGP-NEXT: s_endpgm
170 ; GFX11-CU-LABEL: global_system_unordered_load:
171 ; GFX11-CU: ; %bb.0: ; %entry
172 ; GFX11-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
173 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
174 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
175 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
176 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
177 ; GFX11-CU-NEXT: global_load_b32 v1, v0, s[2:3]
178 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
179 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
180 ; GFX11-CU-NEXT: s_endpgm
182 ; GFX12-WGP-LABEL: global_system_unordered_load:
183 ; GFX12-WGP: ; %bb.0: ; %entry
184 ; GFX12-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
185 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
186 ; GFX12-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
187 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
188 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
189 ; GFX12-WGP-NEXT: global_load_b32 v1, v0, s[2:3]
190 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
191 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
192 ; GFX12-WGP-NEXT: s_endpgm
194 ; GFX12-CU-LABEL: global_system_unordered_load:
195 ; GFX12-CU: ; %bb.0: ; %entry
196 ; GFX12-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
197 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
198 ; GFX12-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
199 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
200 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
201 ; GFX12-CU-NEXT: global_load_b32 v1, v0, s[2:3]
202 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
203 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
204 ; GFX12-CU-NEXT: s_endpgm
205 ptr addrspace(1) %in, ptr addrspace(1) %out) {
207 %val = load atomic i32, ptr addrspace(1) %in unordered, align 4
208 store i32 %val, ptr addrspace(1) %out
212 define amdgpu_kernel void @global_system_monotonic_load(
213 ; GFX6-LABEL: global_system_monotonic_load:
214 ; GFX6: ; %bb.0: ; %entry
215 ; GFX6-NEXT: s_load_dwordx2 s[8:9], s[6:7], 0x0
216 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x2
217 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
218 ; GFX6-NEXT: s_mov_b32 s6, s9
219 ; GFX6-NEXT: ; kill: def $sgpr8 killed $sgpr8 killed $sgpr8_sgpr9
220 ; GFX6-NEXT: s_mov_b32 s12, 0x100f000
221 ; GFX6-NEXT: s_mov_b32 s13, -1
222 ; GFX6-NEXT: ; kill: def $sgpr8 killed $sgpr8 def $sgpr8_sgpr9_sgpr10_sgpr11
223 ; GFX6-NEXT: s_mov_b32 s9, s6
224 ; GFX6-NEXT: s_mov_b32 s10, s13
225 ; GFX6-NEXT: s_mov_b32 s11, s12
226 ; GFX6-NEXT: s_mov_b32 s14, s5
227 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
228 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
229 ; GFX6-NEXT: s_mov_b32 s5, s14
230 ; GFX6-NEXT: s_mov_b32 s6, s13
231 ; GFX6-NEXT: s_mov_b32 s7, s12
232 ; GFX6-NEXT: buffer_load_dword v0, off, s[8:11], 0 glc
233 ; GFX6-NEXT: s_waitcnt vmcnt(0)
234 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
235 ; GFX6-NEXT: s_endpgm
237 ; GFX7-LABEL: global_system_monotonic_load:
238 ; GFX7: ; %bb.0: ; %entry
239 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
240 ; GFX7-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
241 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x2
242 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
243 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
244 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
245 ; GFX7-NEXT: flat_load_dword v2, v[0:1] glc
246 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
247 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
248 ; GFX7-NEXT: s_waitcnt vmcnt(0)
249 ; GFX7-NEXT: flat_store_dword v[0:1], v2
250 ; GFX7-NEXT: s_endpgm
252 ; GFX10-WGP-LABEL: global_system_monotonic_load:
253 ; GFX10-WGP: ; %bb.0: ; %entry
254 ; GFX10-WGP-NEXT: s_mov_b64 s[4:5], s[6:7]
255 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
256 ; GFX10-WGP-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
257 ; GFX10-WGP-NEXT: s_nop 0
258 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
259 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
260 ; GFX10-WGP-NEXT: global_load_dword v1, v0, s[6:7] glc dlc
261 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
262 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
263 ; GFX10-WGP-NEXT: s_endpgm
265 ; GFX10-CU-LABEL: global_system_monotonic_load:
266 ; GFX10-CU: ; %bb.0: ; %entry
267 ; GFX10-CU-NEXT: s_mov_b64 s[4:5], s[6:7]
268 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
269 ; GFX10-CU-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
270 ; GFX10-CU-NEXT: s_nop 0
271 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
272 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
273 ; GFX10-CU-NEXT: global_load_dword v1, v0, s[6:7] glc dlc
274 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
275 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
276 ; GFX10-CU-NEXT: s_endpgm
278 ; SKIP-CACHE-INV-LABEL: global_system_monotonic_load:
279 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
280 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[4:5], s[2:3], 0x0
281 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x2
282 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
283 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s5
284 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
285 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, 0xf000
286 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s9, -1
287 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
288 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s2
289 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, s9
290 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s8
291 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s10, s1
292 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
293 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
294 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s10
295 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s9
296 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s8
297 ; SKIP-CACHE-INV-NEXT: buffer_load_dword v0, off, s[4:7], 0 glc
298 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
299 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
300 ; SKIP-CACHE-INV-NEXT: s_endpgm
302 ; GFX90A-NOTTGSPLIT-LABEL: global_system_monotonic_load:
303 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
304 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
305 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
306 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
307 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
308 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
309 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
310 ; GFX90A-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[6:7] glc
311 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
312 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
313 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
315 ; GFX90A-TGSPLIT-LABEL: global_system_monotonic_load:
316 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
317 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
318 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
319 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
320 ; GFX90A-TGSPLIT-NEXT: s_nop 0
321 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
322 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
323 ; GFX90A-TGSPLIT-NEXT: global_load_dword v1, v0, s[6:7] glc
324 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
325 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
326 ; GFX90A-TGSPLIT-NEXT: s_endpgm
328 ; GFX940-NOTTGSPLIT-LABEL: global_system_monotonic_load:
329 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
330 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
331 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
332 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
333 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
334 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
335 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
336 ; GFX940-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[2:3] sc0 sc1
337 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
338 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
339 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
341 ; GFX940-TGSPLIT-LABEL: global_system_monotonic_load:
342 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
343 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
344 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
345 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
346 ; GFX940-TGSPLIT-NEXT: s_nop 0
347 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
348 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
349 ; GFX940-TGSPLIT-NEXT: global_load_dword v1, v0, s[2:3] sc0 sc1
350 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
351 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
352 ; GFX940-TGSPLIT-NEXT: s_endpgm
354 ; GFX11-WGP-LABEL: global_system_monotonic_load:
355 ; GFX11-WGP: ; %bb.0: ; %entry
356 ; GFX11-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
357 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
358 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
359 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
360 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
361 ; GFX11-WGP-NEXT: global_load_b32 v1, v0, s[2:3] glc
362 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
363 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
364 ; GFX11-WGP-NEXT: s_endpgm
366 ; GFX11-CU-LABEL: global_system_monotonic_load:
367 ; GFX11-CU: ; %bb.0: ; %entry
368 ; GFX11-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
369 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
370 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
371 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
372 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
373 ; GFX11-CU-NEXT: global_load_b32 v1, v0, s[2:3] glc
374 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
375 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
376 ; GFX11-CU-NEXT: s_endpgm
378 ; GFX12-WGP-LABEL: global_system_monotonic_load:
379 ; GFX12-WGP: ; %bb.0: ; %entry
380 ; GFX12-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
381 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
382 ; GFX12-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
383 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
384 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
385 ; GFX12-WGP-NEXT: global_load_b32 v1, v0, s[2:3] scope:SCOPE_SYS
386 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
387 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
388 ; GFX12-WGP-NEXT: s_endpgm
390 ; GFX12-CU-LABEL: global_system_monotonic_load:
391 ; GFX12-CU: ; %bb.0: ; %entry
392 ; GFX12-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
393 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
394 ; GFX12-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
395 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
396 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
397 ; GFX12-CU-NEXT: global_load_b32 v1, v0, s[2:3] scope:SCOPE_SYS
398 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
399 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
400 ; GFX12-CU-NEXT: s_endpgm
401 ptr addrspace(1) %in, ptr addrspace(1) %out) {
403 %val = load atomic i32, ptr addrspace(1) %in monotonic, align 4
404 store i32 %val, ptr addrspace(1) %out
408 define amdgpu_kernel void @global_system_acquire_load(
409 ; GFX6-LABEL: global_system_acquire_load:
410 ; GFX6: ; %bb.0: ; %entry
411 ; GFX6-NEXT: s_load_dwordx2 s[8:9], s[6:7], 0x0
412 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x2
413 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
414 ; GFX6-NEXT: s_mov_b32 s6, s9
415 ; GFX6-NEXT: ; kill: def $sgpr8 killed $sgpr8 killed $sgpr8_sgpr9
416 ; GFX6-NEXT: s_mov_b32 s12, 0x100f000
417 ; GFX6-NEXT: s_mov_b32 s13, -1
418 ; GFX6-NEXT: ; kill: def $sgpr8 killed $sgpr8 def $sgpr8_sgpr9_sgpr10_sgpr11
419 ; GFX6-NEXT: s_mov_b32 s9, s6
420 ; GFX6-NEXT: s_mov_b32 s10, s13
421 ; GFX6-NEXT: s_mov_b32 s11, s12
422 ; GFX6-NEXT: s_mov_b32 s14, s5
423 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
424 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
425 ; GFX6-NEXT: s_mov_b32 s5, s14
426 ; GFX6-NEXT: s_mov_b32 s6, s13
427 ; GFX6-NEXT: s_mov_b32 s7, s12
428 ; GFX6-NEXT: buffer_load_dword v0, off, s[8:11], 0 glc
429 ; GFX6-NEXT: s_waitcnt vmcnt(0)
430 ; GFX6-NEXT: buffer_wbinvl1
431 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
432 ; GFX6-NEXT: s_endpgm
434 ; GFX7-LABEL: global_system_acquire_load:
435 ; GFX7: ; %bb.0: ; %entry
436 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
437 ; GFX7-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
438 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x2
439 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
440 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
441 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
442 ; GFX7-NEXT: flat_load_dword v2, v[0:1] glc
443 ; GFX7-NEXT: s_waitcnt vmcnt(0)
444 ; GFX7-NEXT: buffer_wbinvl1_vol
445 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
446 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
447 ; GFX7-NEXT: flat_store_dword v[0:1], v2
448 ; GFX7-NEXT: s_endpgm
450 ; GFX10-WGP-LABEL: global_system_acquire_load:
451 ; GFX10-WGP: ; %bb.0: ; %entry
452 ; GFX10-WGP-NEXT: s_mov_b64 s[4:5], s[6:7]
453 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
454 ; GFX10-WGP-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
455 ; GFX10-WGP-NEXT: s_nop 0
456 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
457 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
458 ; GFX10-WGP-NEXT: global_load_dword v1, v0, s[6:7] glc dlc
459 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
460 ; GFX10-WGP-NEXT: buffer_gl1_inv
461 ; GFX10-WGP-NEXT: buffer_gl0_inv
462 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
463 ; GFX10-WGP-NEXT: s_endpgm
465 ; GFX10-CU-LABEL: global_system_acquire_load:
466 ; GFX10-CU: ; %bb.0: ; %entry
467 ; GFX10-CU-NEXT: s_mov_b64 s[4:5], s[6:7]
468 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
469 ; GFX10-CU-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
470 ; GFX10-CU-NEXT: s_nop 0
471 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
472 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
473 ; GFX10-CU-NEXT: global_load_dword v1, v0, s[6:7] glc dlc
474 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
475 ; GFX10-CU-NEXT: buffer_gl1_inv
476 ; GFX10-CU-NEXT: buffer_gl0_inv
477 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
478 ; GFX10-CU-NEXT: s_endpgm
480 ; SKIP-CACHE-INV-LABEL: global_system_acquire_load:
481 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
482 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[4:5], s[2:3], 0x0
483 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x2
484 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
485 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s5
486 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
487 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, 0xf000
488 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s9, -1
489 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
490 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s2
491 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, s9
492 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s8
493 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s10, s1
494 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
495 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
496 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s10
497 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s9
498 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s8
499 ; SKIP-CACHE-INV-NEXT: buffer_load_dword v0, off, s[4:7], 0 glc
500 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
501 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
502 ; SKIP-CACHE-INV-NEXT: s_endpgm
504 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acquire_load:
505 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
506 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
507 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
508 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
509 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
510 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
511 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
512 ; GFX90A-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[6:7] glc
513 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
514 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
515 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
516 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
517 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
519 ; GFX90A-TGSPLIT-LABEL: global_system_acquire_load:
520 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
521 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
522 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
523 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
524 ; GFX90A-TGSPLIT-NEXT: s_nop 0
525 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
526 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
527 ; GFX90A-TGSPLIT-NEXT: global_load_dword v1, v0, s[6:7] glc
528 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
529 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
530 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
531 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
532 ; GFX90A-TGSPLIT-NEXT: s_endpgm
534 ; GFX940-NOTTGSPLIT-LABEL: global_system_acquire_load:
535 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
536 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
537 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
538 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
539 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
540 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
541 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
542 ; GFX940-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[2:3] sc0 sc1
543 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
544 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
545 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
546 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
548 ; GFX940-TGSPLIT-LABEL: global_system_acquire_load:
549 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
550 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
551 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
552 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
553 ; GFX940-TGSPLIT-NEXT: s_nop 0
554 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
555 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
556 ; GFX940-TGSPLIT-NEXT: global_load_dword v1, v0, s[2:3] sc0 sc1
557 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
558 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
559 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
560 ; GFX940-TGSPLIT-NEXT: s_endpgm
562 ; GFX11-WGP-LABEL: global_system_acquire_load:
563 ; GFX11-WGP: ; %bb.0: ; %entry
564 ; GFX11-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
565 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
566 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
567 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
568 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
569 ; GFX11-WGP-NEXT: global_load_b32 v1, v0, s[2:3] glc
570 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
571 ; GFX11-WGP-NEXT: buffer_gl1_inv
572 ; GFX11-WGP-NEXT: buffer_gl0_inv
573 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
574 ; GFX11-WGP-NEXT: s_endpgm
576 ; GFX11-CU-LABEL: global_system_acquire_load:
577 ; GFX11-CU: ; %bb.0: ; %entry
578 ; GFX11-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
579 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
580 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
581 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
582 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
583 ; GFX11-CU-NEXT: global_load_b32 v1, v0, s[2:3] glc
584 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
585 ; GFX11-CU-NEXT: buffer_gl1_inv
586 ; GFX11-CU-NEXT: buffer_gl0_inv
587 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
588 ; GFX11-CU-NEXT: s_endpgm
590 ; GFX12-WGP-LABEL: global_system_acquire_load:
591 ; GFX12-WGP: ; %bb.0: ; %entry
592 ; GFX12-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
593 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
594 ; GFX12-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
595 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
596 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
597 ; GFX12-WGP-NEXT: global_load_b32 v1, v0, s[2:3] scope:SCOPE_SYS
598 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
599 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
600 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
601 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
602 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
603 ; GFX12-WGP-NEXT: s_endpgm
605 ; GFX12-CU-LABEL: global_system_acquire_load:
606 ; GFX12-CU: ; %bb.0: ; %entry
607 ; GFX12-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
608 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
609 ; GFX12-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
610 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
611 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
612 ; GFX12-CU-NEXT: global_load_b32 v1, v0, s[2:3] scope:SCOPE_SYS
613 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
614 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
615 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
616 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
617 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
618 ; GFX12-CU-NEXT: s_endpgm
619 ptr addrspace(1) %in, ptr addrspace(1) %out) {
621 %val = load atomic i32, ptr addrspace(1) %in acquire, align 4
622 store i32 %val, ptr addrspace(1) %out
626 define amdgpu_kernel void @global_system_seq_cst_load(
627 ; GFX6-LABEL: global_system_seq_cst_load:
628 ; GFX6: ; %bb.0: ; %entry
629 ; GFX6-NEXT: s_load_dwordx2 s[8:9], s[6:7], 0x0
630 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x2
631 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
632 ; GFX6-NEXT: s_mov_b32 s6, s9
633 ; GFX6-NEXT: ; kill: def $sgpr8 killed $sgpr8 killed $sgpr8_sgpr9
634 ; GFX6-NEXT: s_mov_b32 s12, 0x100f000
635 ; GFX6-NEXT: s_mov_b32 s13, -1
636 ; GFX6-NEXT: ; kill: def $sgpr8 killed $sgpr8 def $sgpr8_sgpr9_sgpr10_sgpr11
637 ; GFX6-NEXT: s_mov_b32 s9, s6
638 ; GFX6-NEXT: s_mov_b32 s10, s13
639 ; GFX6-NEXT: s_mov_b32 s11, s12
640 ; GFX6-NEXT: s_mov_b32 s14, s5
641 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
642 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
643 ; GFX6-NEXT: s_mov_b32 s5, s14
644 ; GFX6-NEXT: s_mov_b32 s6, s13
645 ; GFX6-NEXT: s_mov_b32 s7, s12
646 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
647 ; GFX6-NEXT: buffer_load_dword v0, off, s[8:11], 0 glc
648 ; GFX6-NEXT: s_waitcnt vmcnt(0)
649 ; GFX6-NEXT: buffer_wbinvl1
650 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
651 ; GFX6-NEXT: s_endpgm
653 ; GFX7-LABEL: global_system_seq_cst_load:
654 ; GFX7: ; %bb.0: ; %entry
655 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
656 ; GFX7-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
657 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x2
658 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
659 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
660 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
661 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
662 ; GFX7-NEXT: flat_load_dword v2, v[0:1] glc
663 ; GFX7-NEXT: s_waitcnt vmcnt(0)
664 ; GFX7-NEXT: buffer_wbinvl1_vol
665 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
666 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
667 ; GFX7-NEXT: flat_store_dword v[0:1], v2
668 ; GFX7-NEXT: s_endpgm
670 ; GFX10-WGP-LABEL: global_system_seq_cst_load:
671 ; GFX10-WGP: ; %bb.0: ; %entry
672 ; GFX10-WGP-NEXT: s_mov_b64 s[4:5], s[6:7]
673 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
674 ; GFX10-WGP-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
675 ; GFX10-WGP-NEXT: s_nop 0
676 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
677 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
678 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
679 ; GFX10-WGP-NEXT: global_load_dword v1, v0, s[6:7] glc dlc
680 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
681 ; GFX10-WGP-NEXT: buffer_gl1_inv
682 ; GFX10-WGP-NEXT: buffer_gl0_inv
683 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
684 ; GFX10-WGP-NEXT: s_endpgm
686 ; GFX10-CU-LABEL: global_system_seq_cst_load:
687 ; GFX10-CU: ; %bb.0: ; %entry
688 ; GFX10-CU-NEXT: s_mov_b64 s[4:5], s[6:7]
689 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
690 ; GFX10-CU-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
691 ; GFX10-CU-NEXT: s_nop 0
692 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
693 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
694 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
695 ; GFX10-CU-NEXT: global_load_dword v1, v0, s[6:7] glc dlc
696 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
697 ; GFX10-CU-NEXT: buffer_gl1_inv
698 ; GFX10-CU-NEXT: buffer_gl0_inv
699 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
700 ; GFX10-CU-NEXT: s_endpgm
702 ; SKIP-CACHE-INV-LABEL: global_system_seq_cst_load:
703 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
704 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[4:5], s[2:3], 0x0
705 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x2
706 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
707 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s5
708 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
709 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, 0xf000
710 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s9, -1
711 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
712 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s2
713 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, s9
714 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s8
715 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s10, s1
716 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
717 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
718 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s10
719 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s9
720 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s8
721 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
722 ; SKIP-CACHE-INV-NEXT: buffer_load_dword v0, off, s[4:7], 0 glc
723 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
724 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
725 ; SKIP-CACHE-INV-NEXT: s_endpgm
727 ; GFX90A-NOTTGSPLIT-LABEL: global_system_seq_cst_load:
728 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
729 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
730 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
731 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
732 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
733 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
734 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
735 ; GFX90A-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[6:7] glc
736 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
737 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
738 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
739 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
740 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
742 ; GFX90A-TGSPLIT-LABEL: global_system_seq_cst_load:
743 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
744 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
745 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
746 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
747 ; GFX90A-TGSPLIT-NEXT: s_nop 0
748 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
749 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
750 ; GFX90A-TGSPLIT-NEXT: global_load_dword v1, v0, s[6:7] glc
751 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
752 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
753 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
754 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
755 ; GFX90A-TGSPLIT-NEXT: s_endpgm
757 ; GFX940-NOTTGSPLIT-LABEL: global_system_seq_cst_load:
758 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
759 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
760 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
761 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
762 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
763 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
764 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
765 ; GFX940-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[2:3] sc0 sc1
766 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
767 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
768 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
769 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
771 ; GFX940-TGSPLIT-LABEL: global_system_seq_cst_load:
772 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
773 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
774 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
775 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
776 ; GFX940-TGSPLIT-NEXT: s_nop 0
777 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
778 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
779 ; GFX940-TGSPLIT-NEXT: global_load_dword v1, v0, s[2:3] sc0 sc1
780 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
781 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
782 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
783 ; GFX940-TGSPLIT-NEXT: s_endpgm
785 ; GFX11-WGP-LABEL: global_system_seq_cst_load:
786 ; GFX11-WGP: ; %bb.0: ; %entry
787 ; GFX11-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
788 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
789 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
790 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
791 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
792 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
793 ; GFX11-WGP-NEXT: global_load_b32 v1, v0, s[2:3] glc
794 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
795 ; GFX11-WGP-NEXT: buffer_gl1_inv
796 ; GFX11-WGP-NEXT: buffer_gl0_inv
797 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
798 ; GFX11-WGP-NEXT: s_endpgm
800 ; GFX11-CU-LABEL: global_system_seq_cst_load:
801 ; GFX11-CU: ; %bb.0: ; %entry
802 ; GFX11-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
803 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
804 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
805 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
806 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
807 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
808 ; GFX11-CU-NEXT: global_load_b32 v1, v0, s[2:3] glc
809 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
810 ; GFX11-CU-NEXT: buffer_gl1_inv
811 ; GFX11-CU-NEXT: buffer_gl0_inv
812 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
813 ; GFX11-CU-NEXT: s_endpgm
815 ; GFX12-WGP-LABEL: global_system_seq_cst_load:
816 ; GFX12-WGP: ; %bb.0: ; %entry
817 ; GFX12-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
818 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
819 ; GFX12-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
820 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
821 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
822 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
823 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
824 ; GFX12-WGP-NEXT: s_wait_loadcnt_dscnt 0x0
825 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
826 ; GFX12-WGP-NEXT: global_load_b32 v1, v0, s[2:3] scope:SCOPE_SYS
827 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
828 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
829 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
830 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
831 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
832 ; GFX12-WGP-NEXT: s_endpgm
834 ; GFX12-CU-LABEL: global_system_seq_cst_load:
835 ; GFX12-CU: ; %bb.0: ; %entry
836 ; GFX12-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
837 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
838 ; GFX12-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
839 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
840 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
841 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
842 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
843 ; GFX12-CU-NEXT: s_wait_loadcnt_dscnt 0x0
844 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
845 ; GFX12-CU-NEXT: global_load_b32 v1, v0, s[2:3] scope:SCOPE_SYS
846 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
847 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
848 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
849 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
850 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
851 ; GFX12-CU-NEXT: s_endpgm
852 ptr addrspace(1) %in, ptr addrspace(1) %out) {
854 %val = load atomic i32, ptr addrspace(1) %in seq_cst, align 4
855 store i32 %val, ptr addrspace(1) %out
859 define amdgpu_kernel void @global_system_unordered_store(
860 ; GFX6-LABEL: global_system_unordered_store:
861 ; GFX6: ; %bb.0: ; %entry
862 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x0
863 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x2
864 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
865 ; GFX6-NEXT: s_mov_b32 s11, s5
866 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
867 ; GFX6-NEXT: s_mov_b32 s9, 0x100f000
868 ; GFX6-NEXT: s_mov_b32 s10, -1
869 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
870 ; GFX6-NEXT: s_mov_b32 s5, s11
871 ; GFX6-NEXT: s_mov_b32 s6, s10
872 ; GFX6-NEXT: s_mov_b32 s7, s9
873 ; GFX6-NEXT: v_mov_b32_e32 v0, s8
874 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
875 ; GFX6-NEXT: s_endpgm
877 ; GFX7-LABEL: global_system_unordered_store:
878 ; GFX7: ; %bb.0: ; %entry
879 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
880 ; GFX7-NEXT: s_load_dwordx2 s[6:7], s[6:7], 0x2
881 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
882 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
883 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
884 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
885 ; GFX7-NEXT: flat_store_dword v[0:1], v2
886 ; GFX7-NEXT: s_endpgm
888 ; GFX10-WGP-LABEL: global_system_unordered_store:
889 ; GFX10-WGP: ; %bb.0: ; %entry
890 ; GFX10-WGP-NEXT: s_mov_b64 s[4:5], s[6:7]
891 ; GFX10-WGP-NEXT: s_load_dword s6, s[4:5], 0x0
892 ; GFX10-WGP-NEXT: s_nop 0
893 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
894 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
895 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
896 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
897 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
898 ; GFX10-WGP-NEXT: s_endpgm
900 ; GFX10-CU-LABEL: global_system_unordered_store:
901 ; GFX10-CU: ; %bb.0: ; %entry
902 ; GFX10-CU-NEXT: s_mov_b64 s[4:5], s[6:7]
903 ; GFX10-CU-NEXT: s_load_dword s6, s[4:5], 0x0
904 ; GFX10-CU-NEXT: s_nop 0
905 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
906 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
907 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
908 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
909 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
910 ; GFX10-CU-NEXT: s_endpgm
912 ; SKIP-CACHE-INV-LABEL: global_system_unordered_store:
913 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
914 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x0
915 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x2
916 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
917 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s1
918 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
919 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, 0xf000
920 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
921 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
922 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s7
923 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s6
924 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s5
925 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
926 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
927 ; SKIP-CACHE-INV-NEXT: s_endpgm
929 ; GFX90A-NOTTGSPLIT-LABEL: global_system_unordered_store:
930 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
931 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
932 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[4:5], 0x0
933 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
934 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
935 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
936 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
937 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
938 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
939 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
941 ; GFX90A-TGSPLIT-LABEL: global_system_unordered_store:
942 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
943 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
944 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[4:5], 0x0
945 ; GFX90A-TGSPLIT-NEXT: s_nop 0
946 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
947 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
948 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
949 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
950 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
951 ; GFX90A-TGSPLIT-NEXT: s_endpgm
953 ; GFX940-NOTTGSPLIT-LABEL: global_system_unordered_store:
954 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
955 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
956 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[0:1], 0x0
957 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
958 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
959 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
960 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
961 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
962 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
963 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
965 ; GFX940-TGSPLIT-LABEL: global_system_unordered_store:
966 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
967 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
968 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[0:1], 0x0
969 ; GFX940-TGSPLIT-NEXT: s_nop 0
970 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
971 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
972 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
973 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
974 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
975 ; GFX940-TGSPLIT-NEXT: s_endpgm
977 ; GFX11-WGP-LABEL: global_system_unordered_store:
978 ; GFX11-WGP: ; %bb.0: ; %entry
979 ; GFX11-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
980 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
981 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
982 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
983 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
984 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
985 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
986 ; GFX11-WGP-NEXT: s_endpgm
988 ; GFX11-CU-LABEL: global_system_unordered_store:
989 ; GFX11-CU: ; %bb.0: ; %entry
990 ; GFX11-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
991 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
992 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
993 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
994 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
995 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
996 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
997 ; GFX11-CU-NEXT: s_endpgm
999 ; GFX12-WGP-LABEL: global_system_unordered_store:
1000 ; GFX12-WGP: ; %bb.0: ; %entry
1001 ; GFX12-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
1002 ; GFX12-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
1003 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
1004 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
1005 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
1006 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
1007 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
1008 ; GFX12-WGP-NEXT: s_endpgm
1010 ; GFX12-CU-LABEL: global_system_unordered_store:
1011 ; GFX12-CU: ; %bb.0: ; %entry
1012 ; GFX12-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
1013 ; GFX12-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
1014 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
1015 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
1016 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
1017 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
1018 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
1019 ; GFX12-CU-NEXT: s_endpgm
1020 i32 %in, ptr addrspace(1) %out) {
1022 store atomic i32 %in, ptr addrspace(1) %out unordered, align 4
1026 define amdgpu_kernel void @global_system_monotonic_store(
1027 ; GFX6-LABEL: global_system_monotonic_store:
1028 ; GFX6: ; %bb.0: ; %entry
1029 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x0
1030 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x2
1031 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1032 ; GFX6-NEXT: s_mov_b32 s11, s5
1033 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
1034 ; GFX6-NEXT: s_mov_b32 s9, 0x100f000
1035 ; GFX6-NEXT: s_mov_b32 s10, -1
1036 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
1037 ; GFX6-NEXT: s_mov_b32 s5, s11
1038 ; GFX6-NEXT: s_mov_b32 s6, s10
1039 ; GFX6-NEXT: s_mov_b32 s7, s9
1040 ; GFX6-NEXT: v_mov_b32_e32 v0, s8
1041 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
1042 ; GFX6-NEXT: s_endpgm
1044 ; GFX7-LABEL: global_system_monotonic_store:
1045 ; GFX7: ; %bb.0: ; %entry
1046 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
1047 ; GFX7-NEXT: s_load_dwordx2 s[6:7], s[6:7], 0x2
1048 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1049 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
1050 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
1051 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
1052 ; GFX7-NEXT: flat_store_dword v[0:1], v2
1053 ; GFX7-NEXT: s_endpgm
1055 ; GFX10-WGP-LABEL: global_system_monotonic_store:
1056 ; GFX10-WGP: ; %bb.0: ; %entry
1057 ; GFX10-WGP-NEXT: s_mov_b64 s[4:5], s[6:7]
1058 ; GFX10-WGP-NEXT: s_load_dword s6, s[4:5], 0x0
1059 ; GFX10-WGP-NEXT: s_nop 0
1060 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
1061 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
1062 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1063 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
1064 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
1065 ; GFX10-WGP-NEXT: s_endpgm
1067 ; GFX10-CU-LABEL: global_system_monotonic_store:
1068 ; GFX10-CU: ; %bb.0: ; %entry
1069 ; GFX10-CU-NEXT: s_mov_b64 s[4:5], s[6:7]
1070 ; GFX10-CU-NEXT: s_load_dword s6, s[4:5], 0x0
1071 ; GFX10-CU-NEXT: s_nop 0
1072 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
1073 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
1074 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1075 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
1076 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
1077 ; GFX10-CU-NEXT: s_endpgm
1079 ; SKIP-CACHE-INV-LABEL: global_system_monotonic_store:
1080 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1081 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x0
1082 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x2
1083 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1084 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s1
1085 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
1086 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, 0xf000
1087 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
1088 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
1089 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s7
1090 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s6
1091 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s5
1092 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
1093 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
1094 ; SKIP-CACHE-INV-NEXT: s_endpgm
1096 ; GFX90A-NOTTGSPLIT-LABEL: global_system_monotonic_store:
1097 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1098 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
1099 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[4:5], 0x0
1100 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
1101 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
1102 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1103 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1104 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
1105 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
1106 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1108 ; GFX90A-TGSPLIT-LABEL: global_system_monotonic_store:
1109 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1110 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
1111 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[4:5], 0x0
1112 ; GFX90A-TGSPLIT-NEXT: s_nop 0
1113 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
1114 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1115 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1116 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
1117 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
1118 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1120 ; GFX940-NOTTGSPLIT-LABEL: global_system_monotonic_store:
1121 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1122 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
1123 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[0:1], 0x0
1124 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
1125 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
1126 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1127 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1128 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1129 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
1130 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1132 ; GFX940-TGSPLIT-LABEL: global_system_monotonic_store:
1133 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1134 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
1135 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[0:1], 0x0
1136 ; GFX940-TGSPLIT-NEXT: s_nop 0
1137 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
1138 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1139 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1140 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1141 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
1142 ; GFX940-TGSPLIT-NEXT: s_endpgm
1144 ; GFX11-WGP-LABEL: global_system_monotonic_store:
1145 ; GFX11-WGP: ; %bb.0: ; %entry
1146 ; GFX11-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
1147 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
1148 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
1149 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
1150 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1151 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
1152 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
1153 ; GFX11-WGP-NEXT: s_endpgm
1155 ; GFX11-CU-LABEL: global_system_monotonic_store:
1156 ; GFX11-CU: ; %bb.0: ; %entry
1157 ; GFX11-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
1158 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
1159 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
1160 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
1161 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1162 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
1163 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
1164 ; GFX11-CU-NEXT: s_endpgm
1166 ; GFX12-WGP-LABEL: global_system_monotonic_store:
1167 ; GFX12-WGP: ; %bb.0: ; %entry
1168 ; GFX12-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
1169 ; GFX12-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
1170 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
1171 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
1172 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
1173 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
1174 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1] scope:SCOPE_SYS
1175 ; GFX12-WGP-NEXT: s_endpgm
1177 ; GFX12-CU-LABEL: global_system_monotonic_store:
1178 ; GFX12-CU: ; %bb.0: ; %entry
1179 ; GFX12-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
1180 ; GFX12-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
1181 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
1182 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
1183 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
1184 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
1185 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1] scope:SCOPE_SYS
1186 ; GFX12-CU-NEXT: s_endpgm
1187 i32 %in, ptr addrspace(1) %out) {
1189 store atomic i32 %in, ptr addrspace(1) %out monotonic, align 4
1193 define amdgpu_kernel void @global_system_release_store(
1194 ; GFX6-LABEL: global_system_release_store:
1195 ; GFX6: ; %bb.0: ; %entry
1196 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x0
1197 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x2
1198 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1199 ; GFX6-NEXT: s_mov_b32 s11, s5
1200 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
1201 ; GFX6-NEXT: s_mov_b32 s9, 0x100f000
1202 ; GFX6-NEXT: s_mov_b32 s10, -1
1203 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
1204 ; GFX6-NEXT: s_mov_b32 s5, s11
1205 ; GFX6-NEXT: s_mov_b32 s6, s10
1206 ; GFX6-NEXT: s_mov_b32 s7, s9
1207 ; GFX6-NEXT: v_mov_b32_e32 v0, s8
1208 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1209 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
1210 ; GFX6-NEXT: s_endpgm
1212 ; GFX7-LABEL: global_system_release_store:
1213 ; GFX7: ; %bb.0: ; %entry
1214 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
1215 ; GFX7-NEXT: s_load_dwordx2 s[6:7], s[6:7], 0x2
1216 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1217 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
1218 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
1219 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
1220 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1221 ; GFX7-NEXT: flat_store_dword v[0:1], v2
1222 ; GFX7-NEXT: s_endpgm
1224 ; GFX10-WGP-LABEL: global_system_release_store:
1225 ; GFX10-WGP: ; %bb.0: ; %entry
1226 ; GFX10-WGP-NEXT: s_mov_b64 s[4:5], s[6:7]
1227 ; GFX10-WGP-NEXT: s_load_dword s6, s[4:5], 0x0
1228 ; GFX10-WGP-NEXT: s_nop 0
1229 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
1230 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
1231 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1232 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
1233 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1234 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1235 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
1236 ; GFX10-WGP-NEXT: s_endpgm
1238 ; GFX10-CU-LABEL: global_system_release_store:
1239 ; GFX10-CU: ; %bb.0: ; %entry
1240 ; GFX10-CU-NEXT: s_mov_b64 s[4:5], s[6:7]
1241 ; GFX10-CU-NEXT: s_load_dword s6, s[4:5], 0x0
1242 ; GFX10-CU-NEXT: s_nop 0
1243 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
1244 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
1245 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1246 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
1247 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1248 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
1249 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
1250 ; GFX10-CU-NEXT: s_endpgm
1252 ; SKIP-CACHE-INV-LABEL: global_system_release_store:
1253 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1254 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x0
1255 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x2
1256 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1257 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s1
1258 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
1259 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, 0xf000
1260 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
1261 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
1262 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s7
1263 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s6
1264 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s5
1265 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
1266 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1267 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
1268 ; SKIP-CACHE-INV-NEXT: s_endpgm
1270 ; GFX90A-NOTTGSPLIT-LABEL: global_system_release_store:
1271 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1272 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
1273 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[4:5], 0x0
1274 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
1275 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
1276 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1277 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1278 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
1279 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
1280 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1281 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
1282 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1284 ; GFX90A-TGSPLIT-LABEL: global_system_release_store:
1285 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1286 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
1287 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[4:5], 0x0
1288 ; GFX90A-TGSPLIT-NEXT: s_nop 0
1289 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
1290 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1291 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1292 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
1293 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
1294 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1295 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
1296 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1298 ; GFX940-NOTTGSPLIT-LABEL: global_system_release_store:
1299 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1300 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
1301 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[0:1], 0x0
1302 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
1303 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
1304 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1305 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1306 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1307 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
1308 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1309 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
1310 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1312 ; GFX940-TGSPLIT-LABEL: global_system_release_store:
1313 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1314 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
1315 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[0:1], 0x0
1316 ; GFX940-TGSPLIT-NEXT: s_nop 0
1317 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
1318 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1319 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1320 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1321 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
1322 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1323 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
1324 ; GFX940-TGSPLIT-NEXT: s_endpgm
1326 ; GFX11-WGP-LABEL: global_system_release_store:
1327 ; GFX11-WGP: ; %bb.0: ; %entry
1328 ; GFX11-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
1329 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
1330 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
1331 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
1332 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1333 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
1334 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1335 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1336 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
1337 ; GFX11-WGP-NEXT: s_endpgm
1339 ; GFX11-CU-LABEL: global_system_release_store:
1340 ; GFX11-CU: ; %bb.0: ; %entry
1341 ; GFX11-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
1342 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
1343 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
1344 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
1345 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1346 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
1347 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1348 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
1349 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
1350 ; GFX11-CU-NEXT: s_endpgm
1352 ; GFX12-WGP-LABEL: global_system_release_store:
1353 ; GFX12-WGP: ; %bb.0: ; %entry
1354 ; GFX12-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
1355 ; GFX12-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
1356 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
1357 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
1358 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
1359 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
1360 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
1361 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
1362 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
1363 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
1364 ; GFX12-WGP-NEXT: s_wait_loadcnt_dscnt 0x0
1365 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1] scope:SCOPE_SYS
1366 ; GFX12-WGP-NEXT: s_endpgm
1368 ; GFX12-CU-LABEL: global_system_release_store:
1369 ; GFX12-CU: ; %bb.0: ; %entry
1370 ; GFX12-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
1371 ; GFX12-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
1372 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
1373 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
1374 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
1375 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
1376 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
1377 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
1378 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
1379 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
1380 ; GFX12-CU-NEXT: s_wait_loadcnt_dscnt 0x0
1381 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1] scope:SCOPE_SYS
1382 ; GFX12-CU-NEXT: s_endpgm
1383 i32 %in, ptr addrspace(1) %out) {
1385 store atomic i32 %in, ptr addrspace(1) %out release, align 4
1389 define amdgpu_kernel void @global_system_seq_cst_store(
1390 ; GFX6-LABEL: global_system_seq_cst_store:
1391 ; GFX6: ; %bb.0: ; %entry
1392 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x0
1393 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x2
1394 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1395 ; GFX6-NEXT: s_mov_b32 s11, s5
1396 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
1397 ; GFX6-NEXT: s_mov_b32 s9, 0x100f000
1398 ; GFX6-NEXT: s_mov_b32 s10, -1
1399 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
1400 ; GFX6-NEXT: s_mov_b32 s5, s11
1401 ; GFX6-NEXT: s_mov_b32 s6, s10
1402 ; GFX6-NEXT: s_mov_b32 s7, s9
1403 ; GFX6-NEXT: v_mov_b32_e32 v0, s8
1404 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1405 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
1406 ; GFX6-NEXT: s_endpgm
1408 ; GFX7-LABEL: global_system_seq_cst_store:
1409 ; GFX7: ; %bb.0: ; %entry
1410 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
1411 ; GFX7-NEXT: s_load_dwordx2 s[6:7], s[6:7], 0x2
1412 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1413 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
1414 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
1415 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
1416 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1417 ; GFX7-NEXT: flat_store_dword v[0:1], v2
1418 ; GFX7-NEXT: s_endpgm
1420 ; GFX10-WGP-LABEL: global_system_seq_cst_store:
1421 ; GFX10-WGP: ; %bb.0: ; %entry
1422 ; GFX10-WGP-NEXT: s_mov_b64 s[4:5], s[6:7]
1423 ; GFX10-WGP-NEXT: s_load_dword s6, s[4:5], 0x0
1424 ; GFX10-WGP-NEXT: s_nop 0
1425 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
1426 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
1427 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1428 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
1429 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1430 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1431 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
1432 ; GFX10-WGP-NEXT: s_endpgm
1434 ; GFX10-CU-LABEL: global_system_seq_cst_store:
1435 ; GFX10-CU: ; %bb.0: ; %entry
1436 ; GFX10-CU-NEXT: s_mov_b64 s[4:5], s[6:7]
1437 ; GFX10-CU-NEXT: s_load_dword s6, s[4:5], 0x0
1438 ; GFX10-CU-NEXT: s_nop 0
1439 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
1440 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
1441 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1442 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
1443 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1444 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
1445 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
1446 ; GFX10-CU-NEXT: s_endpgm
1448 ; SKIP-CACHE-INV-LABEL: global_system_seq_cst_store:
1449 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1450 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x0
1451 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x2
1452 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1453 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s1
1454 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
1455 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, 0xf000
1456 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
1457 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
1458 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s7
1459 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s6
1460 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s5
1461 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
1462 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1463 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
1464 ; SKIP-CACHE-INV-NEXT: s_endpgm
1466 ; GFX90A-NOTTGSPLIT-LABEL: global_system_seq_cst_store:
1467 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1468 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
1469 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[4:5], 0x0
1470 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
1471 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
1472 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1473 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1474 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
1475 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
1476 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1477 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
1478 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1480 ; GFX90A-TGSPLIT-LABEL: global_system_seq_cst_store:
1481 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1482 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
1483 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[4:5], 0x0
1484 ; GFX90A-TGSPLIT-NEXT: s_nop 0
1485 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
1486 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1487 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1488 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
1489 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
1490 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1491 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
1492 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1494 ; GFX940-NOTTGSPLIT-LABEL: global_system_seq_cst_store:
1495 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1496 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
1497 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[0:1], 0x0
1498 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
1499 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
1500 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1501 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1502 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1503 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
1504 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1505 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
1506 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1508 ; GFX940-TGSPLIT-LABEL: global_system_seq_cst_store:
1509 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1510 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
1511 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[0:1], 0x0
1512 ; GFX940-TGSPLIT-NEXT: s_nop 0
1513 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
1514 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1515 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1516 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1517 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
1518 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1519 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
1520 ; GFX940-TGSPLIT-NEXT: s_endpgm
1522 ; GFX11-WGP-LABEL: global_system_seq_cst_store:
1523 ; GFX11-WGP: ; %bb.0: ; %entry
1524 ; GFX11-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
1525 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
1526 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
1527 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
1528 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1529 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
1530 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1531 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1532 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
1533 ; GFX11-WGP-NEXT: s_endpgm
1535 ; GFX11-CU-LABEL: global_system_seq_cst_store:
1536 ; GFX11-CU: ; %bb.0: ; %entry
1537 ; GFX11-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
1538 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
1539 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
1540 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
1541 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1542 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
1543 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1544 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
1545 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
1546 ; GFX11-CU-NEXT: s_endpgm
1548 ; GFX12-WGP-LABEL: global_system_seq_cst_store:
1549 ; GFX12-WGP: ; %bb.0: ; %entry
1550 ; GFX12-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
1551 ; GFX12-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
1552 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
1553 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
1554 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
1555 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
1556 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
1557 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
1558 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
1559 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
1560 ; GFX12-WGP-NEXT: s_wait_loadcnt_dscnt 0x0
1561 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1] scope:SCOPE_SYS
1562 ; GFX12-WGP-NEXT: s_endpgm
1564 ; GFX12-CU-LABEL: global_system_seq_cst_store:
1565 ; GFX12-CU: ; %bb.0: ; %entry
1566 ; GFX12-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
1567 ; GFX12-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
1568 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
1569 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
1570 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
1571 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
1572 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
1573 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
1574 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
1575 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
1576 ; GFX12-CU-NEXT: s_wait_loadcnt_dscnt 0x0
1577 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1] scope:SCOPE_SYS
1578 ; GFX12-CU-NEXT: s_endpgm
1579 i32 %in, ptr addrspace(1) %out) {
1581 store atomic i32 %in, ptr addrspace(1) %out seq_cst, align 4
1585 define amdgpu_kernel void @global_system_monotonic_atomicrmw(
1586 ; GFX6-LABEL: global_system_monotonic_atomicrmw:
1587 ; GFX6: ; %bb.0: ; %entry
1588 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
1589 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x2
1590 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1591 ; GFX6-NEXT: s_mov_b32 s11, s5
1592 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
1593 ; GFX6-NEXT: s_mov_b32 s9, 0x100f000
1594 ; GFX6-NEXT: s_mov_b32 s10, -1
1595 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
1596 ; GFX6-NEXT: s_mov_b32 s5, s11
1597 ; GFX6-NEXT: s_mov_b32 s6, s10
1598 ; GFX6-NEXT: s_mov_b32 s7, s9
1599 ; GFX6-NEXT: v_mov_b32_e32 v0, s8
1600 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[4:7], 0
1601 ; GFX6-NEXT: s_endpgm
1603 ; GFX7-LABEL: global_system_monotonic_atomicrmw:
1604 ; GFX7: ; %bb.0: ; %entry
1605 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
1606 ; GFX7-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
1607 ; GFX7-NEXT: s_load_dword s4, s[4:5], 0x2
1608 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1609 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
1610 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
1611 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
1612 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
1613 ; GFX7-NEXT: s_endpgm
1615 ; GFX10-WGP-LABEL: global_system_monotonic_atomicrmw:
1616 ; GFX10-WGP: ; %bb.0: ; %entry
1617 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
1618 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
1619 ; GFX10-WGP-NEXT: s_nop 0
1620 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
1621 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1622 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
1623 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[4:5]
1624 ; GFX10-WGP-NEXT: s_endpgm
1626 ; GFX10-CU-LABEL: global_system_monotonic_atomicrmw:
1627 ; GFX10-CU: ; %bb.0: ; %entry
1628 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
1629 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
1630 ; GFX10-CU-NEXT: s_nop 0
1631 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
1632 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1633 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
1634 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[4:5]
1635 ; GFX10-CU-NEXT: s_endpgm
1637 ; SKIP-CACHE-INV-LABEL: global_system_monotonic_atomicrmw:
1638 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1639 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
1640 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x2
1641 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1642 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s1
1643 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
1644 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, 0xf000
1645 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
1646 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
1647 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s7
1648 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s6
1649 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s5
1650 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
1651 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
1652 ; SKIP-CACHE-INV-NEXT: s_endpgm
1654 ; GFX90A-NOTTGSPLIT-LABEL: global_system_monotonic_atomicrmw:
1655 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1656 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1657 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
1658 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
1659 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
1660 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1661 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
1662 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[4:5]
1663 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1665 ; GFX90A-TGSPLIT-LABEL: global_system_monotonic_atomicrmw:
1666 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1667 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1668 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
1669 ; GFX90A-TGSPLIT-NEXT: s_nop 0
1670 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
1671 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1672 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
1673 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[4:5]
1674 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1676 ; GFX940-NOTTGSPLIT-LABEL: global_system_monotonic_atomicrmw:
1677 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1678 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1679 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
1680 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
1681 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
1682 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1683 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1684 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1] sc1
1685 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1687 ; GFX940-TGSPLIT-LABEL: global_system_monotonic_atomicrmw:
1688 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1689 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1690 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
1691 ; GFX940-TGSPLIT-NEXT: s_nop 0
1692 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
1693 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1694 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1695 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1] sc1
1696 ; GFX940-TGSPLIT-NEXT: s_endpgm
1698 ; GFX11-WGP-LABEL: global_system_monotonic_atomicrmw:
1699 ; GFX11-WGP: ; %bb.0: ; %entry
1700 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
1701 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
1702 ; GFX11-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
1703 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1704 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
1705 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
1706 ; GFX11-WGP-NEXT: s_endpgm
1708 ; GFX11-CU-LABEL: global_system_monotonic_atomicrmw:
1709 ; GFX11-CU: ; %bb.0: ; %entry
1710 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
1711 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
1712 ; GFX11-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
1713 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1714 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
1715 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
1716 ; GFX11-CU-NEXT: s_endpgm
1718 ; GFX12-WGP-LABEL: global_system_monotonic_atomicrmw:
1719 ; GFX12-WGP: ; %bb.0: ; %entry
1720 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
1721 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
1722 ; GFX12-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
1723 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
1724 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
1725 ; GFX12-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1] scope:SCOPE_SYS
1726 ; GFX12-WGP-NEXT: s_endpgm
1728 ; GFX12-CU-LABEL: global_system_monotonic_atomicrmw:
1729 ; GFX12-CU: ; %bb.0: ; %entry
1730 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
1731 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
1732 ; GFX12-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
1733 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
1734 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
1735 ; GFX12-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1] scope:SCOPE_SYS
1736 ; GFX12-CU-NEXT: s_endpgm
1737 ptr addrspace(1) %out, i32 %in) {
1739 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in monotonic
1743 define amdgpu_kernel void @global_system_acquire_atomicrmw(
1744 ; GFX6-LABEL: global_system_acquire_atomicrmw:
1745 ; GFX6: ; %bb.0: ; %entry
1746 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
1747 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x2
1748 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1749 ; GFX6-NEXT: s_mov_b32 s11, s5
1750 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
1751 ; GFX6-NEXT: s_mov_b32 s9, 0x100f000
1752 ; GFX6-NEXT: s_mov_b32 s10, -1
1753 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
1754 ; GFX6-NEXT: s_mov_b32 s5, s11
1755 ; GFX6-NEXT: s_mov_b32 s6, s10
1756 ; GFX6-NEXT: s_mov_b32 s7, s9
1757 ; GFX6-NEXT: v_mov_b32_e32 v0, s8
1758 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[4:7], 0
1759 ; GFX6-NEXT: s_waitcnt vmcnt(0)
1760 ; GFX6-NEXT: buffer_wbinvl1
1761 ; GFX6-NEXT: s_endpgm
1763 ; GFX7-LABEL: global_system_acquire_atomicrmw:
1764 ; GFX7: ; %bb.0: ; %entry
1765 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
1766 ; GFX7-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
1767 ; GFX7-NEXT: s_load_dword s4, s[4:5], 0x2
1768 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1769 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
1770 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
1771 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
1772 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
1773 ; GFX7-NEXT: s_waitcnt vmcnt(0)
1774 ; GFX7-NEXT: buffer_wbinvl1_vol
1775 ; GFX7-NEXT: s_endpgm
1777 ; GFX10-WGP-LABEL: global_system_acquire_atomicrmw:
1778 ; GFX10-WGP: ; %bb.0: ; %entry
1779 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
1780 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
1781 ; GFX10-WGP-NEXT: s_nop 0
1782 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
1783 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1784 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
1785 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[4:5]
1786 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1787 ; GFX10-WGP-NEXT: buffer_gl1_inv
1788 ; GFX10-WGP-NEXT: buffer_gl0_inv
1789 ; GFX10-WGP-NEXT: s_endpgm
1791 ; GFX10-CU-LABEL: global_system_acquire_atomicrmw:
1792 ; GFX10-CU: ; %bb.0: ; %entry
1793 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
1794 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
1795 ; GFX10-CU-NEXT: s_nop 0
1796 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
1797 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1798 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
1799 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[4:5]
1800 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
1801 ; GFX10-CU-NEXT: buffer_gl1_inv
1802 ; GFX10-CU-NEXT: buffer_gl0_inv
1803 ; GFX10-CU-NEXT: s_endpgm
1805 ; SKIP-CACHE-INV-LABEL: global_system_acquire_atomicrmw:
1806 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1807 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
1808 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x2
1809 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1810 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s1
1811 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
1812 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, 0xf000
1813 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
1814 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
1815 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s7
1816 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s6
1817 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s5
1818 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
1819 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
1820 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
1821 ; SKIP-CACHE-INV-NEXT: s_endpgm
1823 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acquire_atomicrmw:
1824 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1825 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1826 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
1827 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
1828 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
1829 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1830 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
1831 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[4:5]
1832 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
1833 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
1834 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
1835 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1837 ; GFX90A-TGSPLIT-LABEL: global_system_acquire_atomicrmw:
1838 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1839 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1840 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
1841 ; GFX90A-TGSPLIT-NEXT: s_nop 0
1842 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
1843 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1844 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
1845 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[4:5]
1846 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1847 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
1848 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
1849 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1851 ; GFX940-NOTTGSPLIT-LABEL: global_system_acquire_atomicrmw:
1852 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1853 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1854 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
1855 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
1856 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
1857 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1858 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1859 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1] sc1
1860 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
1861 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
1862 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1864 ; GFX940-TGSPLIT-LABEL: global_system_acquire_atomicrmw:
1865 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1866 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1867 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
1868 ; GFX940-TGSPLIT-NEXT: s_nop 0
1869 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
1870 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1871 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1872 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1] sc1
1873 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1874 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
1875 ; GFX940-TGSPLIT-NEXT: s_endpgm
1877 ; GFX11-WGP-LABEL: global_system_acquire_atomicrmw:
1878 ; GFX11-WGP: ; %bb.0: ; %entry
1879 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
1880 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
1881 ; GFX11-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
1882 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1883 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
1884 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
1885 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1886 ; GFX11-WGP-NEXT: buffer_gl1_inv
1887 ; GFX11-WGP-NEXT: buffer_gl0_inv
1888 ; GFX11-WGP-NEXT: s_endpgm
1890 ; GFX11-CU-LABEL: global_system_acquire_atomicrmw:
1891 ; GFX11-CU: ; %bb.0: ; %entry
1892 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
1893 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
1894 ; GFX11-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
1895 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1896 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
1897 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
1898 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
1899 ; GFX11-CU-NEXT: buffer_gl1_inv
1900 ; GFX11-CU-NEXT: buffer_gl0_inv
1901 ; GFX11-CU-NEXT: s_endpgm
1903 ; GFX12-WGP-LABEL: global_system_acquire_atomicrmw:
1904 ; GFX12-WGP: ; %bb.0: ; %entry
1905 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
1906 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
1907 ; GFX12-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
1908 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
1909 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
1910 ; GFX12-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1] scope:SCOPE_SYS
1911 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
1912 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
1913 ; GFX12-WGP-NEXT: s_endpgm
1915 ; GFX12-CU-LABEL: global_system_acquire_atomicrmw:
1916 ; GFX12-CU: ; %bb.0: ; %entry
1917 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
1918 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
1919 ; GFX12-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
1920 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
1921 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
1922 ; GFX12-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1] scope:SCOPE_SYS
1923 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
1924 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
1925 ; GFX12-CU-NEXT: s_endpgm
1926 ptr addrspace(1) %out, i32 %in) {
1928 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in acquire
1932 define amdgpu_kernel void @global_system_release_atomicrmw(
1933 ; GFX6-LABEL: global_system_release_atomicrmw:
1934 ; GFX6: ; %bb.0: ; %entry
1935 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
1936 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x2
1937 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1938 ; GFX6-NEXT: s_mov_b32 s11, s5
1939 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
1940 ; GFX6-NEXT: s_mov_b32 s9, 0x100f000
1941 ; GFX6-NEXT: s_mov_b32 s10, -1
1942 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
1943 ; GFX6-NEXT: s_mov_b32 s5, s11
1944 ; GFX6-NEXT: s_mov_b32 s6, s10
1945 ; GFX6-NEXT: s_mov_b32 s7, s9
1946 ; GFX6-NEXT: v_mov_b32_e32 v0, s8
1947 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1948 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[4:7], 0
1949 ; GFX6-NEXT: s_endpgm
1951 ; GFX7-LABEL: global_system_release_atomicrmw:
1952 ; GFX7: ; %bb.0: ; %entry
1953 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
1954 ; GFX7-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
1955 ; GFX7-NEXT: s_load_dword s4, s[4:5], 0x2
1956 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1957 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
1958 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
1959 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
1960 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1961 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
1962 ; GFX7-NEXT: s_endpgm
1964 ; GFX10-WGP-LABEL: global_system_release_atomicrmw:
1965 ; GFX10-WGP: ; %bb.0: ; %entry
1966 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
1967 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
1968 ; GFX10-WGP-NEXT: s_nop 0
1969 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
1970 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1971 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
1972 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1973 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1974 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[4:5]
1975 ; GFX10-WGP-NEXT: s_endpgm
1977 ; GFX10-CU-LABEL: global_system_release_atomicrmw:
1978 ; GFX10-CU: ; %bb.0: ; %entry
1979 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
1980 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
1981 ; GFX10-CU-NEXT: s_nop 0
1982 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
1983 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1984 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
1985 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1986 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
1987 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[4:5]
1988 ; GFX10-CU-NEXT: s_endpgm
1990 ; SKIP-CACHE-INV-LABEL: global_system_release_atomicrmw:
1991 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1992 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
1993 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x2
1994 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1995 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s1
1996 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
1997 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, 0xf000
1998 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
1999 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
2000 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s7
2001 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s6
2002 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s5
2003 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
2004 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2005 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
2006 ; SKIP-CACHE-INV-NEXT: s_endpgm
2008 ; GFX90A-NOTTGSPLIT-LABEL: global_system_release_atomicrmw:
2009 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2010 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2011 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
2012 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
2013 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
2014 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2015 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
2016 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
2017 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2018 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[4:5]
2019 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2021 ; GFX90A-TGSPLIT-LABEL: global_system_release_atomicrmw:
2022 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2023 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2024 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
2025 ; GFX90A-TGSPLIT-NEXT: s_nop 0
2026 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
2027 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2028 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
2029 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
2030 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2031 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[4:5]
2032 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2034 ; GFX940-NOTTGSPLIT-LABEL: global_system_release_atomicrmw:
2035 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2036 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2037 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
2038 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
2039 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
2040 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2041 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2042 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2043 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2044 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1] sc1
2045 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2047 ; GFX940-TGSPLIT-LABEL: global_system_release_atomicrmw:
2048 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2049 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2050 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
2051 ; GFX940-TGSPLIT-NEXT: s_nop 0
2052 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
2053 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2054 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2055 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2056 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2057 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1] sc1
2058 ; GFX940-TGSPLIT-NEXT: s_endpgm
2060 ; GFX11-WGP-LABEL: global_system_release_atomicrmw:
2061 ; GFX11-WGP: ; %bb.0: ; %entry
2062 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
2063 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
2064 ; GFX11-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
2065 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2066 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
2067 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2068 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2069 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
2070 ; GFX11-WGP-NEXT: s_endpgm
2072 ; GFX11-CU-LABEL: global_system_release_atomicrmw:
2073 ; GFX11-CU: ; %bb.0: ; %entry
2074 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
2075 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
2076 ; GFX11-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
2077 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2078 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
2079 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2080 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
2081 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
2082 ; GFX11-CU-NEXT: s_endpgm
2084 ; GFX12-WGP-LABEL: global_system_release_atomicrmw:
2085 ; GFX12-WGP: ; %bb.0: ; %entry
2086 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
2087 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
2088 ; GFX12-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
2089 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
2090 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
2091 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
2092 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
2093 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
2094 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
2095 ; GFX12-WGP-NEXT: s_wait_loadcnt_dscnt 0x0
2096 ; GFX12-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1] scope:SCOPE_SYS
2097 ; GFX12-WGP-NEXT: s_endpgm
2099 ; GFX12-CU-LABEL: global_system_release_atomicrmw:
2100 ; GFX12-CU: ; %bb.0: ; %entry
2101 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
2102 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
2103 ; GFX12-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
2104 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
2105 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
2106 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
2107 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
2108 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
2109 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
2110 ; GFX12-CU-NEXT: s_wait_loadcnt_dscnt 0x0
2111 ; GFX12-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1] scope:SCOPE_SYS
2112 ; GFX12-CU-NEXT: s_endpgm
2113 ptr addrspace(1) %out, i32 %in) {
2115 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in release
2119 define amdgpu_kernel void @global_system_acq_rel_atomicrmw(
2120 ; GFX6-LABEL: global_system_acq_rel_atomicrmw:
2121 ; GFX6: ; %bb.0: ; %entry
2122 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
2123 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x2
2124 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2125 ; GFX6-NEXT: s_mov_b32 s11, s5
2126 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
2127 ; GFX6-NEXT: s_mov_b32 s9, 0x100f000
2128 ; GFX6-NEXT: s_mov_b32 s10, -1
2129 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
2130 ; GFX6-NEXT: s_mov_b32 s5, s11
2131 ; GFX6-NEXT: s_mov_b32 s6, s10
2132 ; GFX6-NEXT: s_mov_b32 s7, s9
2133 ; GFX6-NEXT: v_mov_b32_e32 v0, s8
2134 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2135 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[4:7], 0
2136 ; GFX6-NEXT: s_waitcnt vmcnt(0)
2137 ; GFX6-NEXT: buffer_wbinvl1
2138 ; GFX6-NEXT: s_endpgm
2140 ; GFX7-LABEL: global_system_acq_rel_atomicrmw:
2141 ; GFX7: ; %bb.0: ; %entry
2142 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
2143 ; GFX7-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
2144 ; GFX7-NEXT: s_load_dword s4, s[4:5], 0x2
2145 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2146 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
2147 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
2148 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
2149 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2150 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
2151 ; GFX7-NEXT: s_waitcnt vmcnt(0)
2152 ; GFX7-NEXT: buffer_wbinvl1_vol
2153 ; GFX7-NEXT: s_endpgm
2155 ; GFX10-WGP-LABEL: global_system_acq_rel_atomicrmw:
2156 ; GFX10-WGP: ; %bb.0: ; %entry
2157 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
2158 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
2159 ; GFX10-WGP-NEXT: s_nop 0
2160 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
2161 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2162 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
2163 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2164 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2165 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[4:5]
2166 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2167 ; GFX10-WGP-NEXT: buffer_gl1_inv
2168 ; GFX10-WGP-NEXT: buffer_gl0_inv
2169 ; GFX10-WGP-NEXT: s_endpgm
2171 ; GFX10-CU-LABEL: global_system_acq_rel_atomicrmw:
2172 ; GFX10-CU: ; %bb.0: ; %entry
2173 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
2174 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
2175 ; GFX10-CU-NEXT: s_nop 0
2176 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
2177 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2178 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
2179 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2180 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
2181 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[4:5]
2182 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
2183 ; GFX10-CU-NEXT: buffer_gl1_inv
2184 ; GFX10-CU-NEXT: buffer_gl0_inv
2185 ; GFX10-CU-NEXT: s_endpgm
2187 ; SKIP-CACHE-INV-LABEL: global_system_acq_rel_atomicrmw:
2188 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2189 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
2190 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x2
2191 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2192 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s1
2193 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
2194 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, 0xf000
2195 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
2196 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
2197 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s7
2198 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s6
2199 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s5
2200 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
2201 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2202 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
2203 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
2204 ; SKIP-CACHE-INV-NEXT: s_endpgm
2206 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acq_rel_atomicrmw:
2207 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2208 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2209 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
2210 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
2211 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
2212 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2213 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
2214 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
2215 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2216 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[4:5]
2217 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
2218 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
2219 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
2220 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2222 ; GFX90A-TGSPLIT-LABEL: global_system_acq_rel_atomicrmw:
2223 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2224 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2225 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
2226 ; GFX90A-TGSPLIT-NEXT: s_nop 0
2227 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
2228 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2229 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
2230 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
2231 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2232 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[4:5]
2233 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2234 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
2235 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
2236 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2238 ; GFX940-NOTTGSPLIT-LABEL: global_system_acq_rel_atomicrmw:
2239 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2240 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2241 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
2242 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
2243 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
2244 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2245 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2246 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2247 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2248 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1] sc1
2249 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
2250 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
2251 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2253 ; GFX940-TGSPLIT-LABEL: global_system_acq_rel_atomicrmw:
2254 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2255 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2256 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
2257 ; GFX940-TGSPLIT-NEXT: s_nop 0
2258 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
2259 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2260 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2261 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2262 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2263 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1] sc1
2264 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2265 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
2266 ; GFX940-TGSPLIT-NEXT: s_endpgm
2268 ; GFX11-WGP-LABEL: global_system_acq_rel_atomicrmw:
2269 ; GFX11-WGP: ; %bb.0: ; %entry
2270 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
2271 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
2272 ; GFX11-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
2273 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2274 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
2275 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2276 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2277 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
2278 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2279 ; GFX11-WGP-NEXT: buffer_gl1_inv
2280 ; GFX11-WGP-NEXT: buffer_gl0_inv
2281 ; GFX11-WGP-NEXT: s_endpgm
2283 ; GFX11-CU-LABEL: global_system_acq_rel_atomicrmw:
2284 ; GFX11-CU: ; %bb.0: ; %entry
2285 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
2286 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
2287 ; GFX11-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
2288 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2289 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
2290 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2291 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
2292 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
2293 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
2294 ; GFX11-CU-NEXT: buffer_gl1_inv
2295 ; GFX11-CU-NEXT: buffer_gl0_inv
2296 ; GFX11-CU-NEXT: s_endpgm
2298 ; GFX12-WGP-LABEL: global_system_acq_rel_atomicrmw:
2299 ; GFX12-WGP: ; %bb.0: ; %entry
2300 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
2301 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
2302 ; GFX12-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
2303 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
2304 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
2305 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
2306 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
2307 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
2308 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
2309 ; GFX12-WGP-NEXT: s_wait_loadcnt_dscnt 0x0
2310 ; GFX12-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1] scope:SCOPE_SYS
2311 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
2312 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
2313 ; GFX12-WGP-NEXT: s_endpgm
2315 ; GFX12-CU-LABEL: global_system_acq_rel_atomicrmw:
2316 ; GFX12-CU: ; %bb.0: ; %entry
2317 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
2318 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
2319 ; GFX12-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
2320 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
2321 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
2322 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
2323 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
2324 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
2325 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
2326 ; GFX12-CU-NEXT: s_wait_loadcnt_dscnt 0x0
2327 ; GFX12-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1] scope:SCOPE_SYS
2328 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
2329 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
2330 ; GFX12-CU-NEXT: s_endpgm
2331 ptr addrspace(1) %out, i32 %in) {
2333 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in acq_rel
2337 define amdgpu_kernel void @global_system_seq_cst_atomicrmw(
2338 ; GFX6-LABEL: global_system_seq_cst_atomicrmw:
2339 ; GFX6: ; %bb.0: ; %entry
2340 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
2341 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x2
2342 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2343 ; GFX6-NEXT: s_mov_b32 s11, s5
2344 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
2345 ; GFX6-NEXT: s_mov_b32 s9, 0x100f000
2346 ; GFX6-NEXT: s_mov_b32 s10, -1
2347 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
2348 ; GFX6-NEXT: s_mov_b32 s5, s11
2349 ; GFX6-NEXT: s_mov_b32 s6, s10
2350 ; GFX6-NEXT: s_mov_b32 s7, s9
2351 ; GFX6-NEXT: v_mov_b32_e32 v0, s8
2352 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2353 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[4:7], 0
2354 ; GFX6-NEXT: s_waitcnt vmcnt(0)
2355 ; GFX6-NEXT: buffer_wbinvl1
2356 ; GFX6-NEXT: s_endpgm
2358 ; GFX7-LABEL: global_system_seq_cst_atomicrmw:
2359 ; GFX7: ; %bb.0: ; %entry
2360 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
2361 ; GFX7-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
2362 ; GFX7-NEXT: s_load_dword s4, s[4:5], 0x2
2363 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2364 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
2365 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
2366 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
2367 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2368 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
2369 ; GFX7-NEXT: s_waitcnt vmcnt(0)
2370 ; GFX7-NEXT: buffer_wbinvl1_vol
2371 ; GFX7-NEXT: s_endpgm
2373 ; GFX10-WGP-LABEL: global_system_seq_cst_atomicrmw:
2374 ; GFX10-WGP: ; %bb.0: ; %entry
2375 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
2376 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
2377 ; GFX10-WGP-NEXT: s_nop 0
2378 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
2379 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2380 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
2381 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2382 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2383 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[4:5]
2384 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2385 ; GFX10-WGP-NEXT: buffer_gl1_inv
2386 ; GFX10-WGP-NEXT: buffer_gl0_inv
2387 ; GFX10-WGP-NEXT: s_endpgm
2389 ; GFX10-CU-LABEL: global_system_seq_cst_atomicrmw:
2390 ; GFX10-CU: ; %bb.0: ; %entry
2391 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
2392 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
2393 ; GFX10-CU-NEXT: s_nop 0
2394 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
2395 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2396 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
2397 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2398 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
2399 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[4:5]
2400 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
2401 ; GFX10-CU-NEXT: buffer_gl1_inv
2402 ; GFX10-CU-NEXT: buffer_gl0_inv
2403 ; GFX10-CU-NEXT: s_endpgm
2405 ; SKIP-CACHE-INV-LABEL: global_system_seq_cst_atomicrmw:
2406 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2407 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
2408 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x2
2409 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2410 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s1
2411 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
2412 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, 0xf000
2413 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
2414 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
2415 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s7
2416 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s6
2417 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s5
2418 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
2419 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2420 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
2421 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
2422 ; SKIP-CACHE-INV-NEXT: s_endpgm
2424 ; GFX90A-NOTTGSPLIT-LABEL: global_system_seq_cst_atomicrmw:
2425 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2426 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2427 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
2428 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
2429 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
2430 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2431 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
2432 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
2433 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2434 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[4:5]
2435 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
2436 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
2437 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
2438 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2440 ; GFX90A-TGSPLIT-LABEL: global_system_seq_cst_atomicrmw:
2441 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2442 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2443 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
2444 ; GFX90A-TGSPLIT-NEXT: s_nop 0
2445 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
2446 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2447 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
2448 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
2449 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2450 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[4:5]
2451 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2452 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
2453 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
2454 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2456 ; GFX940-NOTTGSPLIT-LABEL: global_system_seq_cst_atomicrmw:
2457 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2458 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2459 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
2460 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
2461 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
2462 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2463 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2464 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2465 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2466 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1] sc1
2467 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
2468 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
2469 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2471 ; GFX940-TGSPLIT-LABEL: global_system_seq_cst_atomicrmw:
2472 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2473 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2474 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
2475 ; GFX940-TGSPLIT-NEXT: s_nop 0
2476 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
2477 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2478 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2479 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2480 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2481 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1] sc1
2482 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2483 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
2484 ; GFX940-TGSPLIT-NEXT: s_endpgm
2486 ; GFX11-WGP-LABEL: global_system_seq_cst_atomicrmw:
2487 ; GFX11-WGP: ; %bb.0: ; %entry
2488 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
2489 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
2490 ; GFX11-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
2491 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2492 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
2493 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2494 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2495 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
2496 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2497 ; GFX11-WGP-NEXT: buffer_gl1_inv
2498 ; GFX11-WGP-NEXT: buffer_gl0_inv
2499 ; GFX11-WGP-NEXT: s_endpgm
2501 ; GFX11-CU-LABEL: global_system_seq_cst_atomicrmw:
2502 ; GFX11-CU: ; %bb.0: ; %entry
2503 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
2504 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
2505 ; GFX11-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
2506 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2507 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
2508 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2509 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
2510 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
2511 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
2512 ; GFX11-CU-NEXT: buffer_gl1_inv
2513 ; GFX11-CU-NEXT: buffer_gl0_inv
2514 ; GFX11-CU-NEXT: s_endpgm
2516 ; GFX12-WGP-LABEL: global_system_seq_cst_atomicrmw:
2517 ; GFX12-WGP: ; %bb.0: ; %entry
2518 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
2519 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
2520 ; GFX12-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
2521 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
2522 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
2523 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
2524 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
2525 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
2526 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
2527 ; GFX12-WGP-NEXT: s_wait_loadcnt_dscnt 0x0
2528 ; GFX12-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1] scope:SCOPE_SYS
2529 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
2530 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
2531 ; GFX12-WGP-NEXT: s_endpgm
2533 ; GFX12-CU-LABEL: global_system_seq_cst_atomicrmw:
2534 ; GFX12-CU: ; %bb.0: ; %entry
2535 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
2536 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
2537 ; GFX12-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
2538 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
2539 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
2540 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
2541 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
2542 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
2543 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
2544 ; GFX12-CU-NEXT: s_wait_loadcnt_dscnt 0x0
2545 ; GFX12-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1] scope:SCOPE_SYS
2546 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
2547 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
2548 ; GFX12-CU-NEXT: s_endpgm
2549 ptr addrspace(1) %out, i32 %in) {
2551 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in seq_cst
2555 define amdgpu_kernel void @global_system_acquire_ret_atomicrmw(
2556 ; GFX6-LABEL: global_system_acquire_ret_atomicrmw:
2557 ; GFX6: ; %bb.0: ; %entry
2558 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
2559 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x2
2560 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2561 ; GFX6-NEXT: s_mov_b32 s11, s5
2562 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
2563 ; GFX6-NEXT: s_mov_b32 s9, 0x100f000
2564 ; GFX6-NEXT: s_mov_b32 s10, -1
2565 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
2566 ; GFX6-NEXT: s_mov_b32 s5, s11
2567 ; GFX6-NEXT: s_mov_b32 s6, s10
2568 ; GFX6-NEXT: s_mov_b32 s7, s9
2569 ; GFX6-NEXT: v_mov_b32_e32 v0, s8
2570 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[4:7], 0 glc
2571 ; GFX6-NEXT: s_waitcnt vmcnt(0)
2572 ; GFX6-NEXT: buffer_wbinvl1
2573 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
2574 ; GFX6-NEXT: s_endpgm
2576 ; GFX7-LABEL: global_system_acquire_ret_atomicrmw:
2577 ; GFX7: ; %bb.0: ; %entry
2578 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
2579 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
2580 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2581 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
2582 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
2583 ; GFX7-NEXT: v_mov_b32_e32 v2, s6
2584 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
2585 ; GFX7-NEXT: s_waitcnt vmcnt(0)
2586 ; GFX7-NEXT: buffer_wbinvl1_vol
2587 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
2588 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
2589 ; GFX7-NEXT: flat_store_dword v[0:1], v2
2590 ; GFX7-NEXT: s_endpgm
2592 ; GFX10-WGP-LABEL: global_system_acquire_ret_atomicrmw:
2593 ; GFX10-WGP: ; %bb.0: ; %entry
2594 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
2595 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
2596 ; GFX10-WGP-NEXT: s_nop 0
2597 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
2598 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2599 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
2600 ; GFX10-WGP-NEXT: global_atomic_swap v1, v0, v1, s[4:5] glc
2601 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
2602 ; GFX10-WGP-NEXT: buffer_gl1_inv
2603 ; GFX10-WGP-NEXT: buffer_gl0_inv
2604 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
2605 ; GFX10-WGP-NEXT: s_endpgm
2607 ; GFX10-CU-LABEL: global_system_acquire_ret_atomicrmw:
2608 ; GFX10-CU: ; %bb.0: ; %entry
2609 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
2610 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
2611 ; GFX10-CU-NEXT: s_nop 0
2612 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
2613 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2614 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
2615 ; GFX10-CU-NEXT: global_atomic_swap v1, v0, v1, s[4:5] glc
2616 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
2617 ; GFX10-CU-NEXT: buffer_gl1_inv
2618 ; GFX10-CU-NEXT: buffer_gl0_inv
2619 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
2620 ; GFX10-CU-NEXT: s_endpgm
2622 ; SKIP-CACHE-INV-LABEL: global_system_acquire_ret_atomicrmw:
2623 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2624 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
2625 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x2
2626 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2627 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s1
2628 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
2629 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, 0xf000
2630 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
2631 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
2632 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s7
2633 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s6
2634 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s5
2635 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
2636 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
2637 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
2638 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
2639 ; SKIP-CACHE-INV-NEXT: s_endpgm
2641 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acquire_ret_atomicrmw:
2642 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2643 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2644 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
2645 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
2646 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
2647 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2648 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
2649 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[4:5] glc
2650 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
2651 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
2652 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
2653 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
2654 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2656 ; GFX90A-TGSPLIT-LABEL: global_system_acquire_ret_atomicrmw:
2657 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2658 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2659 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
2660 ; GFX90A-TGSPLIT-NEXT: s_nop 0
2661 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
2662 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2663 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
2664 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[4:5] glc
2665 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2666 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
2667 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
2668 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
2669 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2671 ; GFX940-NOTTGSPLIT-LABEL: global_system_acquire_ret_atomicrmw:
2672 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2673 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2674 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
2675 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
2676 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
2677 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2678 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2679 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] sc0 sc1
2680 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
2681 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
2682 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
2683 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2685 ; GFX940-TGSPLIT-LABEL: global_system_acquire_ret_atomicrmw:
2686 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2687 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2688 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
2689 ; GFX940-TGSPLIT-NEXT: s_nop 0
2690 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
2691 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2692 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2693 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] sc0 sc1
2694 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2695 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
2696 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
2697 ; GFX940-TGSPLIT-NEXT: s_endpgm
2699 ; GFX11-WGP-LABEL: global_system_acquire_ret_atomicrmw:
2700 ; GFX11-WGP: ; %bb.0: ; %entry
2701 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
2702 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
2703 ; GFX11-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
2704 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2705 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
2706 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
2707 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
2708 ; GFX11-WGP-NEXT: buffer_gl1_inv
2709 ; GFX11-WGP-NEXT: buffer_gl0_inv
2710 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
2711 ; GFX11-WGP-NEXT: s_endpgm
2713 ; GFX11-CU-LABEL: global_system_acquire_ret_atomicrmw:
2714 ; GFX11-CU: ; %bb.0: ; %entry
2715 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
2716 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
2717 ; GFX11-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
2718 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2719 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
2720 ; GFX11-CU-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
2721 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
2722 ; GFX11-CU-NEXT: buffer_gl1_inv
2723 ; GFX11-CU-NEXT: buffer_gl0_inv
2724 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
2725 ; GFX11-CU-NEXT: s_endpgm
2727 ; GFX12-WGP-LABEL: global_system_acquire_ret_atomicrmw:
2728 ; GFX12-WGP: ; %bb.0: ; %entry
2729 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
2730 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
2731 ; GFX12-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
2732 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
2733 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
2734 ; GFX12-WGP-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] th:TH_ATOMIC_RETURN scope:SCOPE_SYS
2735 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
2736 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
2737 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
2738 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
2739 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
2740 ; GFX12-WGP-NEXT: s_endpgm
2742 ; GFX12-CU-LABEL: global_system_acquire_ret_atomicrmw:
2743 ; GFX12-CU: ; %bb.0: ; %entry
2744 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
2745 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
2746 ; GFX12-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
2747 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
2748 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
2749 ; GFX12-CU-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] th:TH_ATOMIC_RETURN scope:SCOPE_SYS
2750 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
2751 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
2752 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
2753 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
2754 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
2755 ; GFX12-CU-NEXT: s_endpgm
2756 ptr addrspace(1) %out, i32 %in) {
2758 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in acquire
2759 store i32 %val, ptr addrspace(1) %out, align 4
2763 define amdgpu_kernel void @global_system_acq_rel_ret_atomicrmw(
2764 ; GFX6-LABEL: global_system_acq_rel_ret_atomicrmw:
2765 ; GFX6: ; %bb.0: ; %entry
2766 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
2767 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x2
2768 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2769 ; GFX6-NEXT: s_mov_b32 s11, s5
2770 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
2771 ; GFX6-NEXT: s_mov_b32 s9, 0x100f000
2772 ; GFX6-NEXT: s_mov_b32 s10, -1
2773 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
2774 ; GFX6-NEXT: s_mov_b32 s5, s11
2775 ; GFX6-NEXT: s_mov_b32 s6, s10
2776 ; GFX6-NEXT: s_mov_b32 s7, s9
2777 ; GFX6-NEXT: v_mov_b32_e32 v0, s8
2778 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2779 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[4:7], 0 glc
2780 ; GFX6-NEXT: s_waitcnt vmcnt(0)
2781 ; GFX6-NEXT: buffer_wbinvl1
2782 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
2783 ; GFX6-NEXT: s_endpgm
2785 ; GFX7-LABEL: global_system_acq_rel_ret_atomicrmw:
2786 ; GFX7: ; %bb.0: ; %entry
2787 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
2788 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
2789 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2790 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
2791 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
2792 ; GFX7-NEXT: v_mov_b32_e32 v2, s6
2793 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2794 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
2795 ; GFX7-NEXT: s_waitcnt vmcnt(0)
2796 ; GFX7-NEXT: buffer_wbinvl1_vol
2797 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
2798 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
2799 ; GFX7-NEXT: flat_store_dword v[0:1], v2
2800 ; GFX7-NEXT: s_endpgm
2802 ; GFX10-WGP-LABEL: global_system_acq_rel_ret_atomicrmw:
2803 ; GFX10-WGP: ; %bb.0: ; %entry
2804 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
2805 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
2806 ; GFX10-WGP-NEXT: s_nop 0
2807 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
2808 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2809 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
2810 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2811 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2812 ; GFX10-WGP-NEXT: global_atomic_swap v1, v0, v1, s[4:5] glc
2813 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
2814 ; GFX10-WGP-NEXT: buffer_gl1_inv
2815 ; GFX10-WGP-NEXT: buffer_gl0_inv
2816 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
2817 ; GFX10-WGP-NEXT: s_endpgm
2819 ; GFX10-CU-LABEL: global_system_acq_rel_ret_atomicrmw:
2820 ; GFX10-CU: ; %bb.0: ; %entry
2821 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
2822 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
2823 ; GFX10-CU-NEXT: s_nop 0
2824 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
2825 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2826 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
2827 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2828 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
2829 ; GFX10-CU-NEXT: global_atomic_swap v1, v0, v1, s[4:5] glc
2830 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
2831 ; GFX10-CU-NEXT: buffer_gl1_inv
2832 ; GFX10-CU-NEXT: buffer_gl0_inv
2833 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
2834 ; GFX10-CU-NEXT: s_endpgm
2836 ; SKIP-CACHE-INV-LABEL: global_system_acq_rel_ret_atomicrmw:
2837 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2838 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
2839 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x2
2840 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2841 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s1
2842 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
2843 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, 0xf000
2844 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
2845 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
2846 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s7
2847 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s6
2848 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s5
2849 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
2850 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2851 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
2852 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
2853 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
2854 ; SKIP-CACHE-INV-NEXT: s_endpgm
2856 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acq_rel_ret_atomicrmw:
2857 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2858 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2859 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
2860 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
2861 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
2862 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2863 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
2864 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
2865 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2866 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[4:5] glc
2867 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
2868 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
2869 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
2870 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
2871 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2873 ; GFX90A-TGSPLIT-LABEL: global_system_acq_rel_ret_atomicrmw:
2874 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2875 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2876 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
2877 ; GFX90A-TGSPLIT-NEXT: s_nop 0
2878 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
2879 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2880 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
2881 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
2882 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2883 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[4:5] glc
2884 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2885 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
2886 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
2887 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
2888 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2890 ; GFX940-NOTTGSPLIT-LABEL: global_system_acq_rel_ret_atomicrmw:
2891 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2892 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2893 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
2894 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
2895 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
2896 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2897 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2898 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2899 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2900 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] sc0 sc1
2901 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
2902 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
2903 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
2904 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2906 ; GFX940-TGSPLIT-LABEL: global_system_acq_rel_ret_atomicrmw:
2907 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2908 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2909 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
2910 ; GFX940-TGSPLIT-NEXT: s_nop 0
2911 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
2912 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2913 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2914 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2915 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2916 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] sc0 sc1
2917 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2918 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
2919 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
2920 ; GFX940-TGSPLIT-NEXT: s_endpgm
2922 ; GFX11-WGP-LABEL: global_system_acq_rel_ret_atomicrmw:
2923 ; GFX11-WGP: ; %bb.0: ; %entry
2924 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
2925 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
2926 ; GFX11-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
2927 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2928 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
2929 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2930 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2931 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
2932 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
2933 ; GFX11-WGP-NEXT: buffer_gl1_inv
2934 ; GFX11-WGP-NEXT: buffer_gl0_inv
2935 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
2936 ; GFX11-WGP-NEXT: s_endpgm
2938 ; GFX11-CU-LABEL: global_system_acq_rel_ret_atomicrmw:
2939 ; GFX11-CU: ; %bb.0: ; %entry
2940 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
2941 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
2942 ; GFX11-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
2943 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2944 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
2945 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2946 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
2947 ; GFX11-CU-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
2948 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
2949 ; GFX11-CU-NEXT: buffer_gl1_inv
2950 ; GFX11-CU-NEXT: buffer_gl0_inv
2951 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
2952 ; GFX11-CU-NEXT: s_endpgm
2954 ; GFX12-WGP-LABEL: global_system_acq_rel_ret_atomicrmw:
2955 ; GFX12-WGP: ; %bb.0: ; %entry
2956 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
2957 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
2958 ; GFX12-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
2959 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
2960 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
2961 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
2962 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
2963 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
2964 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
2965 ; GFX12-WGP-NEXT: s_wait_loadcnt_dscnt 0x0
2966 ; GFX12-WGP-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] th:TH_ATOMIC_RETURN scope:SCOPE_SYS
2967 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
2968 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
2969 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
2970 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
2971 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
2972 ; GFX12-WGP-NEXT: s_endpgm
2974 ; GFX12-CU-LABEL: global_system_acq_rel_ret_atomicrmw:
2975 ; GFX12-CU: ; %bb.0: ; %entry
2976 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
2977 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
2978 ; GFX12-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
2979 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
2980 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
2981 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
2982 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
2983 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
2984 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
2985 ; GFX12-CU-NEXT: s_wait_loadcnt_dscnt 0x0
2986 ; GFX12-CU-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] th:TH_ATOMIC_RETURN scope:SCOPE_SYS
2987 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
2988 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
2989 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
2990 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
2991 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
2992 ; GFX12-CU-NEXT: s_endpgm
2993 ptr addrspace(1) %out, i32 %in) {
2995 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in acq_rel
2996 store i32 %val, ptr addrspace(1) %out, align 4
3000 define amdgpu_kernel void @global_system_seq_cst_ret_atomicrmw(
3001 ; GFX6-LABEL: global_system_seq_cst_ret_atomicrmw:
3002 ; GFX6: ; %bb.0: ; %entry
3003 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
3004 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x2
3005 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3006 ; GFX6-NEXT: s_mov_b32 s11, s5
3007 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
3008 ; GFX6-NEXT: s_mov_b32 s9, 0x100f000
3009 ; GFX6-NEXT: s_mov_b32 s10, -1
3010 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
3011 ; GFX6-NEXT: s_mov_b32 s5, s11
3012 ; GFX6-NEXT: s_mov_b32 s6, s10
3013 ; GFX6-NEXT: s_mov_b32 s7, s9
3014 ; GFX6-NEXT: v_mov_b32_e32 v0, s8
3015 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3016 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[4:7], 0 glc
3017 ; GFX6-NEXT: s_waitcnt vmcnt(0)
3018 ; GFX6-NEXT: buffer_wbinvl1
3019 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
3020 ; GFX6-NEXT: s_endpgm
3022 ; GFX7-LABEL: global_system_seq_cst_ret_atomicrmw:
3023 ; GFX7: ; %bb.0: ; %entry
3024 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
3025 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
3026 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3027 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
3028 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
3029 ; GFX7-NEXT: v_mov_b32_e32 v2, s6
3030 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3031 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
3032 ; GFX7-NEXT: s_waitcnt vmcnt(0)
3033 ; GFX7-NEXT: buffer_wbinvl1_vol
3034 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
3035 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
3036 ; GFX7-NEXT: flat_store_dword v[0:1], v2
3037 ; GFX7-NEXT: s_endpgm
3039 ; GFX10-WGP-LABEL: global_system_seq_cst_ret_atomicrmw:
3040 ; GFX10-WGP: ; %bb.0: ; %entry
3041 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
3042 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
3043 ; GFX10-WGP-NEXT: s_nop 0
3044 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
3045 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3046 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
3047 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3048 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3049 ; GFX10-WGP-NEXT: global_atomic_swap v1, v0, v1, s[4:5] glc
3050 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
3051 ; GFX10-WGP-NEXT: buffer_gl1_inv
3052 ; GFX10-WGP-NEXT: buffer_gl0_inv
3053 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
3054 ; GFX10-WGP-NEXT: s_endpgm
3056 ; GFX10-CU-LABEL: global_system_seq_cst_ret_atomicrmw:
3057 ; GFX10-CU: ; %bb.0: ; %entry
3058 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
3059 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
3060 ; GFX10-CU-NEXT: s_nop 0
3061 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
3062 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3063 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
3064 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3065 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3066 ; GFX10-CU-NEXT: global_atomic_swap v1, v0, v1, s[4:5] glc
3067 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
3068 ; GFX10-CU-NEXT: buffer_gl1_inv
3069 ; GFX10-CU-NEXT: buffer_gl0_inv
3070 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
3071 ; GFX10-CU-NEXT: s_endpgm
3073 ; SKIP-CACHE-INV-LABEL: global_system_seq_cst_ret_atomicrmw:
3074 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3075 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
3076 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x2
3077 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3078 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s1
3079 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
3080 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, 0xf000
3081 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
3082 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
3083 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s7
3084 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s6
3085 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s5
3086 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
3087 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3088 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
3089 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
3090 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
3091 ; SKIP-CACHE-INV-NEXT: s_endpgm
3093 ; GFX90A-NOTTGSPLIT-LABEL: global_system_seq_cst_ret_atomicrmw:
3094 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3095 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
3096 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
3097 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
3098 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
3099 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3100 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
3101 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
3102 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3103 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[4:5] glc
3104 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
3105 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
3106 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
3107 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
3108 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3110 ; GFX90A-TGSPLIT-LABEL: global_system_seq_cst_ret_atomicrmw:
3111 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3112 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
3113 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
3114 ; GFX90A-TGSPLIT-NEXT: s_nop 0
3115 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
3116 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3117 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
3118 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
3119 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3120 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[4:5] glc
3121 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3122 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
3123 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
3124 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
3125 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3127 ; GFX940-NOTTGSPLIT-LABEL: global_system_seq_cst_ret_atomicrmw:
3128 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3129 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
3130 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
3131 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
3132 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
3133 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3134 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3135 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
3136 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3137 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] sc0 sc1
3138 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
3139 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
3140 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
3141 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3143 ; GFX940-TGSPLIT-LABEL: global_system_seq_cst_ret_atomicrmw:
3144 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3145 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
3146 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
3147 ; GFX940-TGSPLIT-NEXT: s_nop 0
3148 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
3149 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3150 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3151 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
3152 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3153 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] sc0 sc1
3154 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3155 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
3156 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
3157 ; GFX940-TGSPLIT-NEXT: s_endpgm
3159 ; GFX11-WGP-LABEL: global_system_seq_cst_ret_atomicrmw:
3160 ; GFX11-WGP: ; %bb.0: ; %entry
3161 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
3162 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
3163 ; GFX11-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
3164 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3165 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
3166 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3167 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3168 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
3169 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
3170 ; GFX11-WGP-NEXT: buffer_gl1_inv
3171 ; GFX11-WGP-NEXT: buffer_gl0_inv
3172 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
3173 ; GFX11-WGP-NEXT: s_endpgm
3175 ; GFX11-CU-LABEL: global_system_seq_cst_ret_atomicrmw:
3176 ; GFX11-CU: ; %bb.0: ; %entry
3177 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
3178 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
3179 ; GFX11-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
3180 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3181 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
3182 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3183 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3184 ; GFX11-CU-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
3185 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
3186 ; GFX11-CU-NEXT: buffer_gl1_inv
3187 ; GFX11-CU-NEXT: buffer_gl0_inv
3188 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
3189 ; GFX11-CU-NEXT: s_endpgm
3191 ; GFX12-WGP-LABEL: global_system_seq_cst_ret_atomicrmw:
3192 ; GFX12-WGP: ; %bb.0: ; %entry
3193 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
3194 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
3195 ; GFX12-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
3196 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
3197 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
3198 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
3199 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
3200 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
3201 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
3202 ; GFX12-WGP-NEXT: s_wait_loadcnt_dscnt 0x0
3203 ; GFX12-WGP-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] th:TH_ATOMIC_RETURN scope:SCOPE_SYS
3204 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
3205 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
3206 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
3207 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
3208 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
3209 ; GFX12-WGP-NEXT: s_endpgm
3211 ; GFX12-CU-LABEL: global_system_seq_cst_ret_atomicrmw:
3212 ; GFX12-CU: ; %bb.0: ; %entry
3213 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
3214 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
3215 ; GFX12-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
3216 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
3217 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
3218 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
3219 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
3220 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
3221 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
3222 ; GFX12-CU-NEXT: s_wait_loadcnt_dscnt 0x0
3223 ; GFX12-CU-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] th:TH_ATOMIC_RETURN scope:SCOPE_SYS
3224 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
3225 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
3226 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
3227 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
3228 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
3229 ; GFX12-CU-NEXT: s_endpgm
3230 ptr addrspace(1) %out, i32 %in) {
3232 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in seq_cst
3233 store i32 %val, ptr addrspace(1) %out, align 4
3237 define amdgpu_kernel void @global_system_monotonic_monotonic_cmpxchg(
3238 ; GFX6-LABEL: global_system_monotonic_monotonic_cmpxchg:
3239 ; GFX6: ; %bb.0: ; %entry
3240 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
3241 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
3242 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
3243 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3244 ; GFX6-NEXT: s_mov_b32 s12, s5
3245 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
3246 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
3247 ; GFX6-NEXT: s_mov_b32 s11, -1
3248 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
3249 ; GFX6-NEXT: s_mov_b32 s5, s12
3250 ; GFX6-NEXT: s_mov_b32 s6, s11
3251 ; GFX6-NEXT: s_mov_b32 s7, s10
3252 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
3253 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
3254 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
3255 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
3256 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3257 ; GFX6-NEXT: s_endpgm
3259 ; GFX7-LABEL: global_system_monotonic_monotonic_cmpxchg:
3260 ; GFX7: ; %bb.0: ; %entry
3261 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
3262 ; GFX7-NEXT: s_load_dwordx2 s[8:9], s[4:5], 0x0
3263 ; GFX7-NEXT: s_load_dword s7, s[4:5], 0x2
3264 ; GFX7-NEXT: s_load_dword s6, s[4:5], 0x3
3265 ; GFX7-NEXT: s_mov_b64 s[10:11], 16
3266 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3267 ; GFX7-NEXT: s_mov_b32 s4, s8
3268 ; GFX7-NEXT: s_mov_b32 s5, s9
3269 ; GFX7-NEXT: s_mov_b32 s9, s10
3270 ; GFX7-NEXT: s_mov_b32 s8, s11
3271 ; GFX7-NEXT: s_add_u32 s4, s4, s9
3272 ; GFX7-NEXT: s_addc_u32 s8, s5, s8
3273 ; GFX7-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5
3274 ; GFX7-NEXT: s_mov_b32 s5, s8
3275 ; GFX7-NEXT: v_mov_b32_e32 v2, s7
3276 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
3277 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
3278 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
3279 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
3280 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
3281 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3282 ; GFX7-NEXT: s_endpgm
3284 ; GFX10-WGP-LABEL: global_system_monotonic_monotonic_cmpxchg:
3285 ; GFX10-WGP: ; %bb.0: ; %entry
3286 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
3287 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
3288 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
3289 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
3290 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
3291 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3292 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
3293 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
3294 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
3295 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
3296 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
3297 ; GFX10-WGP-NEXT: s_endpgm
3299 ; GFX10-CU-LABEL: global_system_monotonic_monotonic_cmpxchg:
3300 ; GFX10-CU: ; %bb.0: ; %entry
3301 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
3302 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
3303 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
3304 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
3305 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
3306 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3307 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
3308 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
3309 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
3310 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
3311 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
3312 ; GFX10-CU-NEXT: s_endpgm
3314 ; SKIP-CACHE-INV-LABEL: global_system_monotonic_monotonic_cmpxchg:
3315 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3316 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
3317 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
3318 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
3319 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3320 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
3321 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
3322 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
3323 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
3324 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
3325 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
3326 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
3327 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
3328 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
3329 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
3330 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
3331 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
3332 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16
3333 ; SKIP-CACHE-INV-NEXT: s_endpgm
3335 ; GFX90A-NOTTGSPLIT-LABEL: global_system_monotonic_monotonic_cmpxchg:
3336 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3337 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
3338 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
3339 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
3340 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
3341 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
3342 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3343 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
3344 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
3345 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
3346 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
3347 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
3348 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3350 ; GFX90A-TGSPLIT-LABEL: global_system_monotonic_monotonic_cmpxchg:
3351 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3352 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
3353 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
3354 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
3355 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
3356 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
3357 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3358 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
3359 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
3360 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
3361 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
3362 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
3363 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3365 ; GFX940-NOTTGSPLIT-LABEL: global_system_monotonic_monotonic_cmpxchg:
3366 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3367 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
3368 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
3369 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
3370 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
3371 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
3372 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3373 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
3374 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3375 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
3376 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
3377 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
3378 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3380 ; GFX940-TGSPLIT-LABEL: global_system_monotonic_monotonic_cmpxchg:
3381 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3382 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
3383 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
3384 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
3385 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
3386 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
3387 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3388 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
3389 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3390 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
3391 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
3392 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
3393 ; GFX940-TGSPLIT-NEXT: s_endpgm
3395 ; GFX11-WGP-LABEL: global_system_monotonic_monotonic_cmpxchg:
3396 ; GFX11-WGP: ; %bb.0: ; %entry
3397 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
3398 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
3399 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
3400 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
3401 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
3402 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3403 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
3404 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
3405 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
3406 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
3407 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
3408 ; GFX11-WGP-NEXT: s_endpgm
3410 ; GFX11-CU-LABEL: global_system_monotonic_monotonic_cmpxchg:
3411 ; GFX11-CU: ; %bb.0: ; %entry
3412 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
3413 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
3414 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
3415 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
3416 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
3417 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3418 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
3419 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
3420 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
3421 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
3422 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
3423 ; GFX11-CU-NEXT: s_endpgm
3425 ; GFX12-WGP-LABEL: global_system_monotonic_monotonic_cmpxchg:
3426 ; GFX12-WGP: ; %bb.0: ; %entry
3427 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
3428 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
3429 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
3430 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
3431 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
3432 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
3433 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
3434 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
3435 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
3436 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
3437 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
3438 ; GFX12-WGP-NEXT: s_endpgm
3440 ; GFX12-CU-LABEL: global_system_monotonic_monotonic_cmpxchg:
3441 ; GFX12-CU: ; %bb.0: ; %entry
3442 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
3443 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
3444 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
3445 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
3446 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
3447 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
3448 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
3449 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
3450 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
3451 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
3452 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
3453 ; GFX12-CU-NEXT: s_endpgm
3454 ptr addrspace(1) %out, i32 %in, i32 %old) {
3456 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
3457 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in monotonic monotonic
3461 define amdgpu_kernel void @global_system_acquire_monotonic_cmpxchg(
3462 ; GFX6-LABEL: global_system_acquire_monotonic_cmpxchg:
3463 ; GFX6: ; %bb.0: ; %entry
3464 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
3465 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
3466 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
3467 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3468 ; GFX6-NEXT: s_mov_b32 s12, s5
3469 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
3470 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
3471 ; GFX6-NEXT: s_mov_b32 s11, -1
3472 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
3473 ; GFX6-NEXT: s_mov_b32 s5, s12
3474 ; GFX6-NEXT: s_mov_b32 s6, s11
3475 ; GFX6-NEXT: s_mov_b32 s7, s10
3476 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
3477 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
3478 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
3479 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
3480 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3481 ; GFX6-NEXT: s_waitcnt vmcnt(0)
3482 ; GFX6-NEXT: buffer_wbinvl1
3483 ; GFX6-NEXT: s_endpgm
3485 ; GFX7-LABEL: global_system_acquire_monotonic_cmpxchg:
3486 ; GFX7: ; %bb.0: ; %entry
3487 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
3488 ; GFX7-NEXT: s_load_dwordx2 s[8:9], s[4:5], 0x0
3489 ; GFX7-NEXT: s_load_dword s7, s[4:5], 0x2
3490 ; GFX7-NEXT: s_load_dword s6, s[4:5], 0x3
3491 ; GFX7-NEXT: s_mov_b64 s[10:11], 16
3492 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3493 ; GFX7-NEXT: s_mov_b32 s4, s8
3494 ; GFX7-NEXT: s_mov_b32 s5, s9
3495 ; GFX7-NEXT: s_mov_b32 s9, s10
3496 ; GFX7-NEXT: s_mov_b32 s8, s11
3497 ; GFX7-NEXT: s_add_u32 s4, s4, s9
3498 ; GFX7-NEXT: s_addc_u32 s8, s5, s8
3499 ; GFX7-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5
3500 ; GFX7-NEXT: s_mov_b32 s5, s8
3501 ; GFX7-NEXT: v_mov_b32_e32 v2, s7
3502 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
3503 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
3504 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
3505 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
3506 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
3507 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3508 ; GFX7-NEXT: s_waitcnt vmcnt(0)
3509 ; GFX7-NEXT: buffer_wbinvl1_vol
3510 ; GFX7-NEXT: s_endpgm
3512 ; GFX10-WGP-LABEL: global_system_acquire_monotonic_cmpxchg:
3513 ; GFX10-WGP: ; %bb.0: ; %entry
3514 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
3515 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
3516 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
3517 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
3518 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
3519 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3520 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
3521 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
3522 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
3523 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
3524 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
3525 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3526 ; GFX10-WGP-NEXT: buffer_gl1_inv
3527 ; GFX10-WGP-NEXT: buffer_gl0_inv
3528 ; GFX10-WGP-NEXT: s_endpgm
3530 ; GFX10-CU-LABEL: global_system_acquire_monotonic_cmpxchg:
3531 ; GFX10-CU: ; %bb.0: ; %entry
3532 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
3533 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
3534 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
3535 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
3536 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
3537 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3538 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
3539 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
3540 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
3541 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
3542 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
3543 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3544 ; GFX10-CU-NEXT: buffer_gl1_inv
3545 ; GFX10-CU-NEXT: buffer_gl0_inv
3546 ; GFX10-CU-NEXT: s_endpgm
3548 ; SKIP-CACHE-INV-LABEL: global_system_acquire_monotonic_cmpxchg:
3549 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3550 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
3551 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
3552 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
3553 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3554 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
3555 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
3556 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
3557 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
3558 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
3559 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
3560 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
3561 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
3562 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
3563 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
3564 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
3565 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
3566 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16
3567 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
3568 ; SKIP-CACHE-INV-NEXT: s_endpgm
3570 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acquire_monotonic_cmpxchg:
3571 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3572 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
3573 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
3574 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
3575 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
3576 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
3577 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3578 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
3579 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
3580 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
3581 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
3582 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
3583 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
3584 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
3585 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
3586 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3588 ; GFX90A-TGSPLIT-LABEL: global_system_acquire_monotonic_cmpxchg:
3589 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3590 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
3591 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
3592 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
3593 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
3594 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
3595 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3596 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
3597 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
3598 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
3599 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
3600 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
3601 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3602 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
3603 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
3604 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3606 ; GFX940-NOTTGSPLIT-LABEL: global_system_acquire_monotonic_cmpxchg:
3607 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3608 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
3609 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
3610 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
3611 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
3612 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
3613 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3614 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
3615 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3616 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
3617 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
3618 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
3619 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
3620 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
3621 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3623 ; GFX940-TGSPLIT-LABEL: global_system_acquire_monotonic_cmpxchg:
3624 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3625 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
3626 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
3627 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
3628 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
3629 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
3630 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3631 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
3632 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3633 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
3634 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
3635 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
3636 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3637 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
3638 ; GFX940-TGSPLIT-NEXT: s_endpgm
3640 ; GFX11-WGP-LABEL: global_system_acquire_monotonic_cmpxchg:
3641 ; GFX11-WGP: ; %bb.0: ; %entry
3642 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
3643 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
3644 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
3645 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
3646 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
3647 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3648 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
3649 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
3650 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
3651 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
3652 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
3653 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3654 ; GFX11-WGP-NEXT: buffer_gl1_inv
3655 ; GFX11-WGP-NEXT: buffer_gl0_inv
3656 ; GFX11-WGP-NEXT: s_endpgm
3658 ; GFX11-CU-LABEL: global_system_acquire_monotonic_cmpxchg:
3659 ; GFX11-CU: ; %bb.0: ; %entry
3660 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
3661 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
3662 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
3663 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
3664 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
3665 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3666 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
3667 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
3668 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
3669 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
3670 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
3671 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3672 ; GFX11-CU-NEXT: buffer_gl1_inv
3673 ; GFX11-CU-NEXT: buffer_gl0_inv
3674 ; GFX11-CU-NEXT: s_endpgm
3676 ; GFX12-WGP-LABEL: global_system_acquire_monotonic_cmpxchg:
3677 ; GFX12-WGP: ; %bb.0: ; %entry
3678 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
3679 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
3680 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
3681 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
3682 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
3683 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
3684 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
3685 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
3686 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
3687 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
3688 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
3689 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
3690 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
3691 ; GFX12-WGP-NEXT: s_endpgm
3693 ; GFX12-CU-LABEL: global_system_acquire_monotonic_cmpxchg:
3694 ; GFX12-CU: ; %bb.0: ; %entry
3695 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
3696 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
3697 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
3698 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
3699 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
3700 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
3701 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
3702 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
3703 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
3704 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
3705 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
3706 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
3707 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
3708 ; GFX12-CU-NEXT: s_endpgm
3709 ptr addrspace(1) %out, i32 %in, i32 %old) {
3711 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
3712 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in acquire monotonic
3716 define amdgpu_kernel void @global_system_release_monotonic_cmpxchg(
3717 ; GFX6-LABEL: global_system_release_monotonic_cmpxchg:
3718 ; GFX6: ; %bb.0: ; %entry
3719 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
3720 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
3721 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
3722 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3723 ; GFX6-NEXT: s_mov_b32 s12, s5
3724 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
3725 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
3726 ; GFX6-NEXT: s_mov_b32 s11, -1
3727 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
3728 ; GFX6-NEXT: s_mov_b32 s5, s12
3729 ; GFX6-NEXT: s_mov_b32 s6, s11
3730 ; GFX6-NEXT: s_mov_b32 s7, s10
3731 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
3732 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
3733 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
3734 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
3735 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3736 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3737 ; GFX6-NEXT: s_endpgm
3739 ; GFX7-LABEL: global_system_release_monotonic_cmpxchg:
3740 ; GFX7: ; %bb.0: ; %entry
3741 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
3742 ; GFX7-NEXT: s_load_dwordx2 s[8:9], s[4:5], 0x0
3743 ; GFX7-NEXT: s_load_dword s7, s[4:5], 0x2
3744 ; GFX7-NEXT: s_load_dword s6, s[4:5], 0x3
3745 ; GFX7-NEXT: s_mov_b64 s[10:11], 16
3746 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3747 ; GFX7-NEXT: s_mov_b32 s4, s8
3748 ; GFX7-NEXT: s_mov_b32 s5, s9
3749 ; GFX7-NEXT: s_mov_b32 s9, s10
3750 ; GFX7-NEXT: s_mov_b32 s8, s11
3751 ; GFX7-NEXT: s_add_u32 s4, s4, s9
3752 ; GFX7-NEXT: s_addc_u32 s8, s5, s8
3753 ; GFX7-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5
3754 ; GFX7-NEXT: s_mov_b32 s5, s8
3755 ; GFX7-NEXT: v_mov_b32_e32 v2, s7
3756 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
3757 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
3758 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
3759 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
3760 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
3761 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3762 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3763 ; GFX7-NEXT: s_endpgm
3765 ; GFX10-WGP-LABEL: global_system_release_monotonic_cmpxchg:
3766 ; GFX10-WGP: ; %bb.0: ; %entry
3767 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
3768 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
3769 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
3770 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
3771 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
3772 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3773 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
3774 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
3775 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
3776 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
3777 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3778 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3779 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
3780 ; GFX10-WGP-NEXT: s_endpgm
3782 ; GFX10-CU-LABEL: global_system_release_monotonic_cmpxchg:
3783 ; GFX10-CU: ; %bb.0: ; %entry
3784 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
3785 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
3786 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
3787 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
3788 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
3789 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3790 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
3791 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
3792 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
3793 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
3794 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3795 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3796 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
3797 ; GFX10-CU-NEXT: s_endpgm
3799 ; SKIP-CACHE-INV-LABEL: global_system_release_monotonic_cmpxchg:
3800 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3801 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
3802 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
3803 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
3804 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3805 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
3806 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
3807 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
3808 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
3809 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
3810 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
3811 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
3812 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
3813 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
3814 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
3815 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
3816 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
3817 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3818 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16
3819 ; SKIP-CACHE-INV-NEXT: s_endpgm
3821 ; GFX90A-NOTTGSPLIT-LABEL: global_system_release_monotonic_cmpxchg:
3822 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3823 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
3824 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
3825 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
3826 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
3827 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
3828 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3829 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
3830 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
3831 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
3832 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
3833 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
3834 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3835 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
3836 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3838 ; GFX90A-TGSPLIT-LABEL: global_system_release_monotonic_cmpxchg:
3839 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3840 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
3841 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
3842 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
3843 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
3844 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
3845 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3846 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
3847 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
3848 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
3849 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
3850 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
3851 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3852 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
3853 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3855 ; GFX940-NOTTGSPLIT-LABEL: global_system_release_monotonic_cmpxchg:
3856 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3857 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
3858 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
3859 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
3860 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
3861 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
3862 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3863 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
3864 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3865 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
3866 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
3867 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
3868 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3869 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
3870 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3872 ; GFX940-TGSPLIT-LABEL: global_system_release_monotonic_cmpxchg:
3873 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3874 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
3875 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
3876 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
3877 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
3878 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
3879 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3880 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
3881 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3882 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
3883 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
3884 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
3885 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3886 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
3887 ; GFX940-TGSPLIT-NEXT: s_endpgm
3889 ; GFX11-WGP-LABEL: global_system_release_monotonic_cmpxchg:
3890 ; GFX11-WGP: ; %bb.0: ; %entry
3891 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
3892 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
3893 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
3894 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
3895 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
3896 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3897 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
3898 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
3899 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
3900 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
3901 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3902 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3903 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
3904 ; GFX11-WGP-NEXT: s_endpgm
3906 ; GFX11-CU-LABEL: global_system_release_monotonic_cmpxchg:
3907 ; GFX11-CU: ; %bb.0: ; %entry
3908 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
3909 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
3910 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
3911 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
3912 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
3913 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3914 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
3915 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
3916 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
3917 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
3918 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3919 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3920 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
3921 ; GFX11-CU-NEXT: s_endpgm
3923 ; GFX12-WGP-LABEL: global_system_release_monotonic_cmpxchg:
3924 ; GFX12-WGP: ; %bb.0: ; %entry
3925 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
3926 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
3927 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
3928 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
3929 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
3930 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
3931 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
3932 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
3933 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
3934 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
3935 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
3936 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
3937 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
3938 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
3939 ; GFX12-WGP-NEXT: s_wait_loadcnt_dscnt 0x0
3940 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
3941 ; GFX12-WGP-NEXT: s_endpgm
3943 ; GFX12-CU-LABEL: global_system_release_monotonic_cmpxchg:
3944 ; GFX12-CU: ; %bb.0: ; %entry
3945 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
3946 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
3947 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
3948 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
3949 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
3950 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
3951 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
3952 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
3953 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
3954 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
3955 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
3956 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
3957 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
3958 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
3959 ; GFX12-CU-NEXT: s_wait_loadcnt_dscnt 0x0
3960 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
3961 ; GFX12-CU-NEXT: s_endpgm
3962 ptr addrspace(1) %out, i32 %in, i32 %old) {
3964 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
3965 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in release monotonic
3969 define amdgpu_kernel void @global_system_acq_rel_monotonic_cmpxchg(
3970 ; GFX6-LABEL: global_system_acq_rel_monotonic_cmpxchg:
3971 ; GFX6: ; %bb.0: ; %entry
3972 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
3973 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
3974 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
3975 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3976 ; GFX6-NEXT: s_mov_b32 s12, s5
3977 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
3978 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
3979 ; GFX6-NEXT: s_mov_b32 s11, -1
3980 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
3981 ; GFX6-NEXT: s_mov_b32 s5, s12
3982 ; GFX6-NEXT: s_mov_b32 s6, s11
3983 ; GFX6-NEXT: s_mov_b32 s7, s10
3984 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
3985 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
3986 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
3987 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
3988 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3989 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3990 ; GFX6-NEXT: s_waitcnt vmcnt(0)
3991 ; GFX6-NEXT: buffer_wbinvl1
3992 ; GFX6-NEXT: s_endpgm
3994 ; GFX7-LABEL: global_system_acq_rel_monotonic_cmpxchg:
3995 ; GFX7: ; %bb.0: ; %entry
3996 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
3997 ; GFX7-NEXT: s_load_dwordx2 s[8:9], s[4:5], 0x0
3998 ; GFX7-NEXT: s_load_dword s7, s[4:5], 0x2
3999 ; GFX7-NEXT: s_load_dword s6, s[4:5], 0x3
4000 ; GFX7-NEXT: s_mov_b64 s[10:11], 16
4001 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4002 ; GFX7-NEXT: s_mov_b32 s4, s8
4003 ; GFX7-NEXT: s_mov_b32 s5, s9
4004 ; GFX7-NEXT: s_mov_b32 s9, s10
4005 ; GFX7-NEXT: s_mov_b32 s8, s11
4006 ; GFX7-NEXT: s_add_u32 s4, s4, s9
4007 ; GFX7-NEXT: s_addc_u32 s8, s5, s8
4008 ; GFX7-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5
4009 ; GFX7-NEXT: s_mov_b32 s5, s8
4010 ; GFX7-NEXT: v_mov_b32_e32 v2, s7
4011 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
4012 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
4013 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
4014 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
4015 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
4016 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4017 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
4018 ; GFX7-NEXT: s_waitcnt vmcnt(0)
4019 ; GFX7-NEXT: buffer_wbinvl1_vol
4020 ; GFX7-NEXT: s_endpgm
4022 ; GFX10-WGP-LABEL: global_system_acq_rel_monotonic_cmpxchg:
4023 ; GFX10-WGP: ; %bb.0: ; %entry
4024 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
4025 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
4026 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
4027 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
4028 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
4029 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4030 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
4031 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
4032 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
4033 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
4034 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4035 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4036 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
4037 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4038 ; GFX10-WGP-NEXT: buffer_gl1_inv
4039 ; GFX10-WGP-NEXT: buffer_gl0_inv
4040 ; GFX10-WGP-NEXT: s_endpgm
4042 ; GFX10-CU-LABEL: global_system_acq_rel_monotonic_cmpxchg:
4043 ; GFX10-CU: ; %bb.0: ; %entry
4044 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
4045 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
4046 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
4047 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
4048 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
4049 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4050 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
4051 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
4052 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
4053 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
4054 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4055 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
4056 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
4057 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
4058 ; GFX10-CU-NEXT: buffer_gl1_inv
4059 ; GFX10-CU-NEXT: buffer_gl0_inv
4060 ; GFX10-CU-NEXT: s_endpgm
4062 ; SKIP-CACHE-INV-LABEL: global_system_acq_rel_monotonic_cmpxchg:
4063 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4064 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
4065 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
4066 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
4067 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4068 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
4069 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
4070 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
4071 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
4072 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
4073 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
4074 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
4075 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
4076 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
4077 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
4078 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
4079 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
4080 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4081 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16
4082 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
4083 ; SKIP-CACHE-INV-NEXT: s_endpgm
4085 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acq_rel_monotonic_cmpxchg:
4086 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4087 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
4088 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
4089 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
4090 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
4091 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
4092 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4093 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
4094 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
4095 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
4096 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
4097 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
4098 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4099 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
4100 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4101 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
4102 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
4103 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4105 ; GFX90A-TGSPLIT-LABEL: global_system_acq_rel_monotonic_cmpxchg:
4106 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4107 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
4108 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
4109 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
4110 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
4111 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
4112 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4113 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
4114 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
4115 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
4116 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
4117 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
4118 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4119 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
4120 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4121 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
4122 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
4123 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4125 ; GFX940-NOTTGSPLIT-LABEL: global_system_acq_rel_monotonic_cmpxchg:
4126 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4127 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
4128 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
4129 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4130 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
4131 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
4132 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4133 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
4134 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4135 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
4136 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
4137 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
4138 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4139 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
4140 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4141 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
4142 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4144 ; GFX940-TGSPLIT-LABEL: global_system_acq_rel_monotonic_cmpxchg:
4145 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4146 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
4147 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
4148 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4149 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
4150 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
4151 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4152 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
4153 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4154 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
4155 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
4156 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
4157 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4158 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
4159 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4160 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
4161 ; GFX940-TGSPLIT-NEXT: s_endpgm
4163 ; GFX11-WGP-LABEL: global_system_acq_rel_monotonic_cmpxchg:
4164 ; GFX11-WGP: ; %bb.0: ; %entry
4165 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
4166 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
4167 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
4168 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
4169 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
4170 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4171 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
4172 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
4173 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
4174 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
4175 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4176 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4177 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
4178 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4179 ; GFX11-WGP-NEXT: buffer_gl1_inv
4180 ; GFX11-WGP-NEXT: buffer_gl0_inv
4181 ; GFX11-WGP-NEXT: s_endpgm
4183 ; GFX11-CU-LABEL: global_system_acq_rel_monotonic_cmpxchg:
4184 ; GFX11-CU: ; %bb.0: ; %entry
4185 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
4186 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
4187 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
4188 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
4189 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
4190 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4191 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
4192 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
4193 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
4194 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
4195 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4196 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
4197 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
4198 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
4199 ; GFX11-CU-NEXT: buffer_gl1_inv
4200 ; GFX11-CU-NEXT: buffer_gl0_inv
4201 ; GFX11-CU-NEXT: s_endpgm
4203 ; GFX12-WGP-LABEL: global_system_acq_rel_monotonic_cmpxchg:
4204 ; GFX12-WGP: ; %bb.0: ; %entry
4205 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
4206 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
4207 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
4208 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
4209 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
4210 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
4211 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
4212 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
4213 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
4214 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
4215 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
4216 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
4217 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
4218 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
4219 ; GFX12-WGP-NEXT: s_wait_loadcnt_dscnt 0x0
4220 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
4221 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
4222 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
4223 ; GFX12-WGP-NEXT: s_endpgm
4225 ; GFX12-CU-LABEL: global_system_acq_rel_monotonic_cmpxchg:
4226 ; GFX12-CU: ; %bb.0: ; %entry
4227 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
4228 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
4229 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
4230 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
4231 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
4232 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
4233 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
4234 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
4235 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
4236 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
4237 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
4238 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
4239 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
4240 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
4241 ; GFX12-CU-NEXT: s_wait_loadcnt_dscnt 0x0
4242 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
4243 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
4244 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
4245 ; GFX12-CU-NEXT: s_endpgm
4246 ptr addrspace(1) %out, i32 %in, i32 %old) {
4248 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
4249 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in acq_rel monotonic
4253 define amdgpu_kernel void @global_system_seq_cst_monotonic_cmpxchg(
4254 ; GFX6-LABEL: global_system_seq_cst_monotonic_cmpxchg:
4255 ; GFX6: ; %bb.0: ; %entry
4256 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
4257 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
4258 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
4259 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4260 ; GFX6-NEXT: s_mov_b32 s12, s5
4261 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
4262 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
4263 ; GFX6-NEXT: s_mov_b32 s11, -1
4264 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
4265 ; GFX6-NEXT: s_mov_b32 s5, s12
4266 ; GFX6-NEXT: s_mov_b32 s6, s11
4267 ; GFX6-NEXT: s_mov_b32 s7, s10
4268 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
4269 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
4270 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
4271 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
4272 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4273 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
4274 ; GFX6-NEXT: s_waitcnt vmcnt(0)
4275 ; GFX6-NEXT: buffer_wbinvl1
4276 ; GFX6-NEXT: s_endpgm
4278 ; GFX7-LABEL: global_system_seq_cst_monotonic_cmpxchg:
4279 ; GFX7: ; %bb.0: ; %entry
4280 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
4281 ; GFX7-NEXT: s_load_dwordx2 s[8:9], s[4:5], 0x0
4282 ; GFX7-NEXT: s_load_dword s7, s[4:5], 0x2
4283 ; GFX7-NEXT: s_load_dword s6, s[4:5], 0x3
4284 ; GFX7-NEXT: s_mov_b64 s[10:11], 16
4285 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4286 ; GFX7-NEXT: s_mov_b32 s4, s8
4287 ; GFX7-NEXT: s_mov_b32 s5, s9
4288 ; GFX7-NEXT: s_mov_b32 s9, s10
4289 ; GFX7-NEXT: s_mov_b32 s8, s11
4290 ; GFX7-NEXT: s_add_u32 s4, s4, s9
4291 ; GFX7-NEXT: s_addc_u32 s8, s5, s8
4292 ; GFX7-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5
4293 ; GFX7-NEXT: s_mov_b32 s5, s8
4294 ; GFX7-NEXT: v_mov_b32_e32 v2, s7
4295 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
4296 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
4297 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
4298 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
4299 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
4300 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4301 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
4302 ; GFX7-NEXT: s_waitcnt vmcnt(0)
4303 ; GFX7-NEXT: buffer_wbinvl1_vol
4304 ; GFX7-NEXT: s_endpgm
4306 ; GFX10-WGP-LABEL: global_system_seq_cst_monotonic_cmpxchg:
4307 ; GFX10-WGP: ; %bb.0: ; %entry
4308 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
4309 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
4310 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
4311 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
4312 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
4313 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4314 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
4315 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
4316 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
4317 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
4318 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4319 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4320 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
4321 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4322 ; GFX10-WGP-NEXT: buffer_gl1_inv
4323 ; GFX10-WGP-NEXT: buffer_gl0_inv
4324 ; GFX10-WGP-NEXT: s_endpgm
4326 ; GFX10-CU-LABEL: global_system_seq_cst_monotonic_cmpxchg:
4327 ; GFX10-CU: ; %bb.0: ; %entry
4328 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
4329 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
4330 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
4331 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
4332 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
4333 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4334 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
4335 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
4336 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
4337 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
4338 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4339 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
4340 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
4341 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
4342 ; GFX10-CU-NEXT: buffer_gl1_inv
4343 ; GFX10-CU-NEXT: buffer_gl0_inv
4344 ; GFX10-CU-NEXT: s_endpgm
4346 ; SKIP-CACHE-INV-LABEL: global_system_seq_cst_monotonic_cmpxchg:
4347 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4348 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
4349 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
4350 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
4351 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4352 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
4353 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
4354 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
4355 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
4356 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
4357 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
4358 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
4359 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
4360 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
4361 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
4362 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
4363 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
4364 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4365 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16
4366 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
4367 ; SKIP-CACHE-INV-NEXT: s_endpgm
4369 ; GFX90A-NOTTGSPLIT-LABEL: global_system_seq_cst_monotonic_cmpxchg:
4370 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4371 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
4372 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
4373 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
4374 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
4375 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
4376 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4377 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
4378 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
4379 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
4380 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
4381 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
4382 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4383 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
4384 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4385 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
4386 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
4387 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4389 ; GFX90A-TGSPLIT-LABEL: global_system_seq_cst_monotonic_cmpxchg:
4390 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4391 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
4392 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
4393 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
4394 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
4395 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
4396 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4397 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
4398 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
4399 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
4400 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
4401 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
4402 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4403 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
4404 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4405 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
4406 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
4407 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4409 ; GFX940-NOTTGSPLIT-LABEL: global_system_seq_cst_monotonic_cmpxchg:
4410 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4411 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
4412 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
4413 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4414 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
4415 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
4416 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4417 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
4418 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4419 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
4420 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
4421 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
4422 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4423 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
4424 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4425 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
4426 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4428 ; GFX940-TGSPLIT-LABEL: global_system_seq_cst_monotonic_cmpxchg:
4429 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4430 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
4431 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
4432 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4433 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
4434 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
4435 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4436 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
4437 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4438 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
4439 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
4440 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
4441 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4442 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
4443 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4444 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
4445 ; GFX940-TGSPLIT-NEXT: s_endpgm
4447 ; GFX11-WGP-LABEL: global_system_seq_cst_monotonic_cmpxchg:
4448 ; GFX11-WGP: ; %bb.0: ; %entry
4449 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
4450 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
4451 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
4452 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
4453 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
4454 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4455 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
4456 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
4457 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
4458 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
4459 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4460 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4461 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
4462 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4463 ; GFX11-WGP-NEXT: buffer_gl1_inv
4464 ; GFX11-WGP-NEXT: buffer_gl0_inv
4465 ; GFX11-WGP-NEXT: s_endpgm
4467 ; GFX11-CU-LABEL: global_system_seq_cst_monotonic_cmpxchg:
4468 ; GFX11-CU: ; %bb.0: ; %entry
4469 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
4470 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
4471 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
4472 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
4473 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
4474 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4475 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
4476 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
4477 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
4478 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
4479 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4480 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
4481 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
4482 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
4483 ; GFX11-CU-NEXT: buffer_gl1_inv
4484 ; GFX11-CU-NEXT: buffer_gl0_inv
4485 ; GFX11-CU-NEXT: s_endpgm
4487 ; GFX12-WGP-LABEL: global_system_seq_cst_monotonic_cmpxchg:
4488 ; GFX12-WGP: ; %bb.0: ; %entry
4489 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
4490 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
4491 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
4492 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
4493 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
4494 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
4495 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
4496 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
4497 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
4498 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
4499 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
4500 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
4501 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
4502 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
4503 ; GFX12-WGP-NEXT: s_wait_loadcnt_dscnt 0x0
4504 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
4505 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
4506 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
4507 ; GFX12-WGP-NEXT: s_endpgm
4509 ; GFX12-CU-LABEL: global_system_seq_cst_monotonic_cmpxchg:
4510 ; GFX12-CU: ; %bb.0: ; %entry
4511 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
4512 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
4513 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
4514 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
4515 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
4516 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
4517 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
4518 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
4519 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
4520 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
4521 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
4522 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
4523 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
4524 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
4525 ; GFX12-CU-NEXT: s_wait_loadcnt_dscnt 0x0
4526 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
4527 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
4528 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
4529 ; GFX12-CU-NEXT: s_endpgm
4530 ptr addrspace(1) %out, i32 %in, i32 %old) {
4532 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
4533 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in seq_cst monotonic
4537 define amdgpu_kernel void @global_system_monotonic_acquire_cmpxchg(
4538 ; GFX6-LABEL: global_system_monotonic_acquire_cmpxchg:
4539 ; GFX6: ; %bb.0: ; %entry
4540 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
4541 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
4542 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
4543 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4544 ; GFX6-NEXT: s_mov_b32 s12, s5
4545 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
4546 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
4547 ; GFX6-NEXT: s_mov_b32 s11, -1
4548 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
4549 ; GFX6-NEXT: s_mov_b32 s5, s12
4550 ; GFX6-NEXT: s_mov_b32 s6, s11
4551 ; GFX6-NEXT: s_mov_b32 s7, s10
4552 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
4553 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
4554 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
4555 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
4556 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
4557 ; GFX6-NEXT: s_waitcnt vmcnt(0)
4558 ; GFX6-NEXT: buffer_wbinvl1
4559 ; GFX6-NEXT: s_endpgm
4561 ; GFX7-LABEL: global_system_monotonic_acquire_cmpxchg:
4562 ; GFX7: ; %bb.0: ; %entry
4563 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
4564 ; GFX7-NEXT: s_load_dwordx2 s[8:9], s[4:5], 0x0
4565 ; GFX7-NEXT: s_load_dword s7, s[4:5], 0x2
4566 ; GFX7-NEXT: s_load_dword s6, s[4:5], 0x3
4567 ; GFX7-NEXT: s_mov_b64 s[10:11], 16
4568 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4569 ; GFX7-NEXT: s_mov_b32 s4, s8
4570 ; GFX7-NEXT: s_mov_b32 s5, s9
4571 ; GFX7-NEXT: s_mov_b32 s9, s10
4572 ; GFX7-NEXT: s_mov_b32 s8, s11
4573 ; GFX7-NEXT: s_add_u32 s4, s4, s9
4574 ; GFX7-NEXT: s_addc_u32 s8, s5, s8
4575 ; GFX7-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5
4576 ; GFX7-NEXT: s_mov_b32 s5, s8
4577 ; GFX7-NEXT: v_mov_b32_e32 v2, s7
4578 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
4579 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
4580 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
4581 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
4582 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
4583 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
4584 ; GFX7-NEXT: s_waitcnt vmcnt(0)
4585 ; GFX7-NEXT: buffer_wbinvl1_vol
4586 ; GFX7-NEXT: s_endpgm
4588 ; GFX10-WGP-LABEL: global_system_monotonic_acquire_cmpxchg:
4589 ; GFX10-WGP: ; %bb.0: ; %entry
4590 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
4591 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
4592 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
4593 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
4594 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
4595 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4596 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
4597 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
4598 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
4599 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
4600 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
4601 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4602 ; GFX10-WGP-NEXT: buffer_gl1_inv
4603 ; GFX10-WGP-NEXT: buffer_gl0_inv
4604 ; GFX10-WGP-NEXT: s_endpgm
4606 ; GFX10-CU-LABEL: global_system_monotonic_acquire_cmpxchg:
4607 ; GFX10-CU: ; %bb.0: ; %entry
4608 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
4609 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
4610 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
4611 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
4612 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
4613 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4614 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
4615 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
4616 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
4617 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
4618 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
4619 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
4620 ; GFX10-CU-NEXT: buffer_gl1_inv
4621 ; GFX10-CU-NEXT: buffer_gl0_inv
4622 ; GFX10-CU-NEXT: s_endpgm
4624 ; SKIP-CACHE-INV-LABEL: global_system_monotonic_acquire_cmpxchg:
4625 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4626 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
4627 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
4628 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
4629 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4630 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
4631 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
4632 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
4633 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
4634 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
4635 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
4636 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
4637 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
4638 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
4639 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
4640 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
4641 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
4642 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16
4643 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
4644 ; SKIP-CACHE-INV-NEXT: s_endpgm
4646 ; GFX90A-NOTTGSPLIT-LABEL: global_system_monotonic_acquire_cmpxchg:
4647 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4648 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
4649 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
4650 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
4651 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
4652 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
4653 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4654 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
4655 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
4656 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
4657 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
4658 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
4659 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4660 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
4661 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
4662 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4664 ; GFX90A-TGSPLIT-LABEL: global_system_monotonic_acquire_cmpxchg:
4665 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4666 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
4667 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
4668 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
4669 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
4670 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
4671 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4672 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
4673 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
4674 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
4675 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
4676 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
4677 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4678 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
4679 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
4680 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4682 ; GFX940-NOTTGSPLIT-LABEL: global_system_monotonic_acquire_cmpxchg:
4683 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4684 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
4685 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
4686 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4687 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
4688 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
4689 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4690 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
4691 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4692 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
4693 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
4694 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
4695 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4696 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
4697 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4699 ; GFX940-TGSPLIT-LABEL: global_system_monotonic_acquire_cmpxchg:
4700 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4701 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
4702 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
4703 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4704 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
4705 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
4706 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4707 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
4708 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4709 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
4710 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
4711 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
4712 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4713 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
4714 ; GFX940-TGSPLIT-NEXT: s_endpgm
4716 ; GFX11-WGP-LABEL: global_system_monotonic_acquire_cmpxchg:
4717 ; GFX11-WGP: ; %bb.0: ; %entry
4718 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
4719 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
4720 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
4721 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
4722 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
4723 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4724 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
4725 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
4726 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
4727 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
4728 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
4729 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4730 ; GFX11-WGP-NEXT: buffer_gl1_inv
4731 ; GFX11-WGP-NEXT: buffer_gl0_inv
4732 ; GFX11-WGP-NEXT: s_endpgm
4734 ; GFX11-CU-LABEL: global_system_monotonic_acquire_cmpxchg:
4735 ; GFX11-CU: ; %bb.0: ; %entry
4736 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
4737 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
4738 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
4739 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
4740 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
4741 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4742 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
4743 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
4744 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
4745 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
4746 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
4747 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
4748 ; GFX11-CU-NEXT: buffer_gl1_inv
4749 ; GFX11-CU-NEXT: buffer_gl0_inv
4750 ; GFX11-CU-NEXT: s_endpgm
4752 ; GFX12-WGP-LABEL: global_system_monotonic_acquire_cmpxchg:
4753 ; GFX12-WGP: ; %bb.0: ; %entry
4754 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
4755 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
4756 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
4757 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
4758 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
4759 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
4760 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
4761 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
4762 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
4763 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
4764 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
4765 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
4766 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
4767 ; GFX12-WGP-NEXT: s_endpgm
4769 ; GFX12-CU-LABEL: global_system_monotonic_acquire_cmpxchg:
4770 ; GFX12-CU: ; %bb.0: ; %entry
4771 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
4772 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
4773 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
4774 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
4775 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
4776 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
4777 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
4778 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
4779 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
4780 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
4781 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
4782 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
4783 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
4784 ; GFX12-CU-NEXT: s_endpgm
4785 ptr addrspace(1) %out, i32 %in, i32 %old) {
4787 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
4788 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in monotonic acquire
4792 define amdgpu_kernel void @global_system_acquire_acquire_cmpxchg(
4793 ; GFX6-LABEL: global_system_acquire_acquire_cmpxchg:
4794 ; GFX6: ; %bb.0: ; %entry
4795 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
4796 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
4797 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
4798 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4799 ; GFX6-NEXT: s_mov_b32 s12, s5
4800 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
4801 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
4802 ; GFX6-NEXT: s_mov_b32 s11, -1
4803 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
4804 ; GFX6-NEXT: s_mov_b32 s5, s12
4805 ; GFX6-NEXT: s_mov_b32 s6, s11
4806 ; GFX6-NEXT: s_mov_b32 s7, s10
4807 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
4808 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
4809 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
4810 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
4811 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
4812 ; GFX6-NEXT: s_waitcnt vmcnt(0)
4813 ; GFX6-NEXT: buffer_wbinvl1
4814 ; GFX6-NEXT: s_endpgm
4816 ; GFX7-LABEL: global_system_acquire_acquire_cmpxchg:
4817 ; GFX7: ; %bb.0: ; %entry
4818 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
4819 ; GFX7-NEXT: s_load_dwordx2 s[8:9], s[4:5], 0x0
4820 ; GFX7-NEXT: s_load_dword s7, s[4:5], 0x2
4821 ; GFX7-NEXT: s_load_dword s6, s[4:5], 0x3
4822 ; GFX7-NEXT: s_mov_b64 s[10:11], 16
4823 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4824 ; GFX7-NEXT: s_mov_b32 s4, s8
4825 ; GFX7-NEXT: s_mov_b32 s5, s9
4826 ; GFX7-NEXT: s_mov_b32 s9, s10
4827 ; GFX7-NEXT: s_mov_b32 s8, s11
4828 ; GFX7-NEXT: s_add_u32 s4, s4, s9
4829 ; GFX7-NEXT: s_addc_u32 s8, s5, s8
4830 ; GFX7-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5
4831 ; GFX7-NEXT: s_mov_b32 s5, s8
4832 ; GFX7-NEXT: v_mov_b32_e32 v2, s7
4833 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
4834 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
4835 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
4836 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
4837 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
4838 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
4839 ; GFX7-NEXT: s_waitcnt vmcnt(0)
4840 ; GFX7-NEXT: buffer_wbinvl1_vol
4841 ; GFX7-NEXT: s_endpgm
4843 ; GFX10-WGP-LABEL: global_system_acquire_acquire_cmpxchg:
4844 ; GFX10-WGP: ; %bb.0: ; %entry
4845 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
4846 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
4847 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
4848 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
4849 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
4850 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4851 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
4852 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
4853 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
4854 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
4855 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
4856 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4857 ; GFX10-WGP-NEXT: buffer_gl1_inv
4858 ; GFX10-WGP-NEXT: buffer_gl0_inv
4859 ; GFX10-WGP-NEXT: s_endpgm
4861 ; GFX10-CU-LABEL: global_system_acquire_acquire_cmpxchg:
4862 ; GFX10-CU: ; %bb.0: ; %entry
4863 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
4864 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
4865 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
4866 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
4867 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
4868 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4869 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
4870 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
4871 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
4872 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
4873 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
4874 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
4875 ; GFX10-CU-NEXT: buffer_gl1_inv
4876 ; GFX10-CU-NEXT: buffer_gl0_inv
4877 ; GFX10-CU-NEXT: s_endpgm
4879 ; SKIP-CACHE-INV-LABEL: global_system_acquire_acquire_cmpxchg:
4880 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4881 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
4882 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
4883 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
4884 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4885 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
4886 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
4887 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
4888 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
4889 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
4890 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
4891 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
4892 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
4893 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
4894 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
4895 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
4896 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
4897 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16
4898 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
4899 ; SKIP-CACHE-INV-NEXT: s_endpgm
4901 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acquire_acquire_cmpxchg:
4902 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4903 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
4904 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
4905 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
4906 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
4907 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
4908 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4909 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
4910 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
4911 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
4912 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
4913 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
4914 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4915 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
4916 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
4917 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4919 ; GFX90A-TGSPLIT-LABEL: global_system_acquire_acquire_cmpxchg:
4920 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4921 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
4922 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
4923 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
4924 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
4925 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
4926 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4927 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
4928 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
4929 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
4930 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
4931 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
4932 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4933 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
4934 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
4935 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4937 ; GFX940-NOTTGSPLIT-LABEL: global_system_acquire_acquire_cmpxchg:
4938 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4939 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
4940 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
4941 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4942 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
4943 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
4944 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4945 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
4946 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4947 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
4948 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
4949 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
4950 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4951 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
4952 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4954 ; GFX940-TGSPLIT-LABEL: global_system_acquire_acquire_cmpxchg:
4955 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4956 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
4957 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
4958 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4959 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
4960 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
4961 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4962 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
4963 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4964 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
4965 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
4966 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
4967 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4968 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
4969 ; GFX940-TGSPLIT-NEXT: s_endpgm
4971 ; GFX11-WGP-LABEL: global_system_acquire_acquire_cmpxchg:
4972 ; GFX11-WGP: ; %bb.0: ; %entry
4973 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
4974 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
4975 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
4976 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
4977 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
4978 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4979 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
4980 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
4981 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
4982 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
4983 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
4984 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4985 ; GFX11-WGP-NEXT: buffer_gl1_inv
4986 ; GFX11-WGP-NEXT: buffer_gl0_inv
4987 ; GFX11-WGP-NEXT: s_endpgm
4989 ; GFX11-CU-LABEL: global_system_acquire_acquire_cmpxchg:
4990 ; GFX11-CU: ; %bb.0: ; %entry
4991 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
4992 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
4993 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
4994 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
4995 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
4996 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4997 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
4998 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
4999 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
5000 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
5001 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
5002 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
5003 ; GFX11-CU-NEXT: buffer_gl1_inv
5004 ; GFX11-CU-NEXT: buffer_gl0_inv
5005 ; GFX11-CU-NEXT: s_endpgm
5007 ; GFX12-WGP-LABEL: global_system_acquire_acquire_cmpxchg:
5008 ; GFX12-WGP: ; %bb.0: ; %entry
5009 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
5010 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
5011 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
5012 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
5013 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
5014 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
5015 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
5016 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
5017 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
5018 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
5019 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
5020 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
5021 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
5022 ; GFX12-WGP-NEXT: s_endpgm
5024 ; GFX12-CU-LABEL: global_system_acquire_acquire_cmpxchg:
5025 ; GFX12-CU: ; %bb.0: ; %entry
5026 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
5027 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
5028 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
5029 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
5030 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
5031 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
5032 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
5033 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
5034 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
5035 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
5036 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
5037 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
5038 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
5039 ; GFX12-CU-NEXT: s_endpgm
5040 ptr addrspace(1) %out, i32 %in, i32 %old) {
5042 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
5043 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in acquire acquire
5047 define amdgpu_kernel void @global_system_release_acquire_cmpxchg(
5048 ; GFX6-LABEL: global_system_release_acquire_cmpxchg:
5049 ; GFX6: ; %bb.0: ; %entry
5050 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
5051 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
5052 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
5053 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5054 ; GFX6-NEXT: s_mov_b32 s12, s5
5055 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
5056 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
5057 ; GFX6-NEXT: s_mov_b32 s11, -1
5058 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
5059 ; GFX6-NEXT: s_mov_b32 s5, s12
5060 ; GFX6-NEXT: s_mov_b32 s6, s11
5061 ; GFX6-NEXT: s_mov_b32 s7, s10
5062 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
5063 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
5064 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
5065 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
5066 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5067 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
5068 ; GFX6-NEXT: s_waitcnt vmcnt(0)
5069 ; GFX6-NEXT: buffer_wbinvl1
5070 ; GFX6-NEXT: s_endpgm
5072 ; GFX7-LABEL: global_system_release_acquire_cmpxchg:
5073 ; GFX7: ; %bb.0: ; %entry
5074 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
5075 ; GFX7-NEXT: s_load_dwordx2 s[8:9], s[4:5], 0x0
5076 ; GFX7-NEXT: s_load_dword s7, s[4:5], 0x2
5077 ; GFX7-NEXT: s_load_dword s6, s[4:5], 0x3
5078 ; GFX7-NEXT: s_mov_b64 s[10:11], 16
5079 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5080 ; GFX7-NEXT: s_mov_b32 s4, s8
5081 ; GFX7-NEXT: s_mov_b32 s5, s9
5082 ; GFX7-NEXT: s_mov_b32 s9, s10
5083 ; GFX7-NEXT: s_mov_b32 s8, s11
5084 ; GFX7-NEXT: s_add_u32 s4, s4, s9
5085 ; GFX7-NEXT: s_addc_u32 s8, s5, s8
5086 ; GFX7-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5
5087 ; GFX7-NEXT: s_mov_b32 s5, s8
5088 ; GFX7-NEXT: v_mov_b32_e32 v2, s7
5089 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
5090 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
5091 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
5092 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5093 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
5094 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5095 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
5096 ; GFX7-NEXT: s_waitcnt vmcnt(0)
5097 ; GFX7-NEXT: buffer_wbinvl1_vol
5098 ; GFX7-NEXT: s_endpgm
5100 ; GFX10-WGP-LABEL: global_system_release_acquire_cmpxchg:
5101 ; GFX10-WGP: ; %bb.0: ; %entry
5102 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
5103 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
5104 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
5105 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
5106 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
5107 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5108 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
5109 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
5110 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
5111 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
5112 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5113 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5114 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
5115 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5116 ; GFX10-WGP-NEXT: buffer_gl1_inv
5117 ; GFX10-WGP-NEXT: buffer_gl0_inv
5118 ; GFX10-WGP-NEXT: s_endpgm
5120 ; GFX10-CU-LABEL: global_system_release_acquire_cmpxchg:
5121 ; GFX10-CU: ; %bb.0: ; %entry
5122 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
5123 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
5124 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
5125 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
5126 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
5127 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5128 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
5129 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
5130 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
5131 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
5132 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5133 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
5134 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
5135 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
5136 ; GFX10-CU-NEXT: buffer_gl1_inv
5137 ; GFX10-CU-NEXT: buffer_gl0_inv
5138 ; GFX10-CU-NEXT: s_endpgm
5140 ; SKIP-CACHE-INV-LABEL: global_system_release_acquire_cmpxchg:
5141 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5142 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
5143 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
5144 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
5145 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5146 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
5147 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
5148 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
5149 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
5150 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
5151 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
5152 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
5153 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
5154 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
5155 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
5156 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
5157 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
5158 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5159 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16
5160 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
5161 ; SKIP-CACHE-INV-NEXT: s_endpgm
5163 ; GFX90A-NOTTGSPLIT-LABEL: global_system_release_acquire_cmpxchg:
5164 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5165 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
5166 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
5167 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
5168 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
5169 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
5170 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5171 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
5172 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
5173 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
5174 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
5175 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
5176 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5177 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
5178 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5179 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
5180 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
5181 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5183 ; GFX90A-TGSPLIT-LABEL: global_system_release_acquire_cmpxchg:
5184 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5185 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
5186 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
5187 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
5188 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
5189 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
5190 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5191 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
5192 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
5193 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
5194 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
5195 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
5196 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5197 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
5198 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5199 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
5200 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
5201 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5203 ; GFX940-NOTTGSPLIT-LABEL: global_system_release_acquire_cmpxchg:
5204 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5205 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
5206 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
5207 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5208 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
5209 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
5210 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5211 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
5212 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5213 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
5214 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
5215 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5216 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5217 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
5218 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5219 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
5220 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5222 ; GFX940-TGSPLIT-LABEL: global_system_release_acquire_cmpxchg:
5223 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5224 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
5225 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
5226 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5227 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
5228 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
5229 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5230 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
5231 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5232 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
5233 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
5234 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5235 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5236 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
5237 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5238 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
5239 ; GFX940-TGSPLIT-NEXT: s_endpgm
5241 ; GFX11-WGP-LABEL: global_system_release_acquire_cmpxchg:
5242 ; GFX11-WGP: ; %bb.0: ; %entry
5243 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
5244 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
5245 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
5246 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
5247 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
5248 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5249 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
5250 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
5251 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
5252 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
5253 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5254 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5255 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
5256 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5257 ; GFX11-WGP-NEXT: buffer_gl1_inv
5258 ; GFX11-WGP-NEXT: buffer_gl0_inv
5259 ; GFX11-WGP-NEXT: s_endpgm
5261 ; GFX11-CU-LABEL: global_system_release_acquire_cmpxchg:
5262 ; GFX11-CU: ; %bb.0: ; %entry
5263 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
5264 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
5265 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
5266 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
5267 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
5268 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5269 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
5270 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
5271 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
5272 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
5273 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5274 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
5275 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
5276 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
5277 ; GFX11-CU-NEXT: buffer_gl1_inv
5278 ; GFX11-CU-NEXT: buffer_gl0_inv
5279 ; GFX11-CU-NEXT: s_endpgm
5281 ; GFX12-WGP-LABEL: global_system_release_acquire_cmpxchg:
5282 ; GFX12-WGP: ; %bb.0: ; %entry
5283 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
5284 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
5285 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
5286 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
5287 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
5288 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
5289 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
5290 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
5291 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
5292 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
5293 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
5294 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
5295 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
5296 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
5297 ; GFX12-WGP-NEXT: s_wait_loadcnt_dscnt 0x0
5298 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
5299 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
5300 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
5301 ; GFX12-WGP-NEXT: s_endpgm
5303 ; GFX12-CU-LABEL: global_system_release_acquire_cmpxchg:
5304 ; GFX12-CU: ; %bb.0: ; %entry
5305 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
5306 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
5307 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
5308 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
5309 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
5310 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
5311 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
5312 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
5313 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
5314 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
5315 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
5316 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
5317 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
5318 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
5319 ; GFX12-CU-NEXT: s_wait_loadcnt_dscnt 0x0
5320 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
5321 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
5322 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
5323 ; GFX12-CU-NEXT: s_endpgm
5324 ptr addrspace(1) %out, i32 %in, i32 %old) {
5326 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
5327 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in release acquire
5331 define amdgpu_kernel void @global_system_acq_rel_acquire_cmpxchg(
5332 ; GFX6-LABEL: global_system_acq_rel_acquire_cmpxchg:
5333 ; GFX6: ; %bb.0: ; %entry
5334 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
5335 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
5336 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
5337 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5338 ; GFX6-NEXT: s_mov_b32 s12, s5
5339 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
5340 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
5341 ; GFX6-NEXT: s_mov_b32 s11, -1
5342 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
5343 ; GFX6-NEXT: s_mov_b32 s5, s12
5344 ; GFX6-NEXT: s_mov_b32 s6, s11
5345 ; GFX6-NEXT: s_mov_b32 s7, s10
5346 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
5347 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
5348 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
5349 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
5350 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5351 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
5352 ; GFX6-NEXT: s_waitcnt vmcnt(0)
5353 ; GFX6-NEXT: buffer_wbinvl1
5354 ; GFX6-NEXT: s_endpgm
5356 ; GFX7-LABEL: global_system_acq_rel_acquire_cmpxchg:
5357 ; GFX7: ; %bb.0: ; %entry
5358 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
5359 ; GFX7-NEXT: s_load_dwordx2 s[8:9], s[4:5], 0x0
5360 ; GFX7-NEXT: s_load_dword s7, s[4:5], 0x2
5361 ; GFX7-NEXT: s_load_dword s6, s[4:5], 0x3
5362 ; GFX7-NEXT: s_mov_b64 s[10:11], 16
5363 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5364 ; GFX7-NEXT: s_mov_b32 s4, s8
5365 ; GFX7-NEXT: s_mov_b32 s5, s9
5366 ; GFX7-NEXT: s_mov_b32 s9, s10
5367 ; GFX7-NEXT: s_mov_b32 s8, s11
5368 ; GFX7-NEXT: s_add_u32 s4, s4, s9
5369 ; GFX7-NEXT: s_addc_u32 s8, s5, s8
5370 ; GFX7-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5
5371 ; GFX7-NEXT: s_mov_b32 s5, s8
5372 ; GFX7-NEXT: v_mov_b32_e32 v2, s7
5373 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
5374 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
5375 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
5376 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5377 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
5378 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5379 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
5380 ; GFX7-NEXT: s_waitcnt vmcnt(0)
5381 ; GFX7-NEXT: buffer_wbinvl1_vol
5382 ; GFX7-NEXT: s_endpgm
5384 ; GFX10-WGP-LABEL: global_system_acq_rel_acquire_cmpxchg:
5385 ; GFX10-WGP: ; %bb.0: ; %entry
5386 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
5387 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
5388 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
5389 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
5390 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
5391 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5392 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
5393 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
5394 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
5395 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
5396 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5397 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5398 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
5399 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5400 ; GFX10-WGP-NEXT: buffer_gl1_inv
5401 ; GFX10-WGP-NEXT: buffer_gl0_inv
5402 ; GFX10-WGP-NEXT: s_endpgm
5404 ; GFX10-CU-LABEL: global_system_acq_rel_acquire_cmpxchg:
5405 ; GFX10-CU: ; %bb.0: ; %entry
5406 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
5407 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
5408 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
5409 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
5410 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
5411 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5412 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
5413 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
5414 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
5415 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
5416 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5417 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
5418 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
5419 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
5420 ; GFX10-CU-NEXT: buffer_gl1_inv
5421 ; GFX10-CU-NEXT: buffer_gl0_inv
5422 ; GFX10-CU-NEXT: s_endpgm
5424 ; SKIP-CACHE-INV-LABEL: global_system_acq_rel_acquire_cmpxchg:
5425 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5426 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
5427 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
5428 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
5429 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5430 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
5431 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
5432 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
5433 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
5434 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
5435 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
5436 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
5437 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
5438 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
5439 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
5440 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
5441 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
5442 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5443 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16
5444 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
5445 ; SKIP-CACHE-INV-NEXT: s_endpgm
5447 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acq_rel_acquire_cmpxchg:
5448 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5449 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
5450 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
5451 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
5452 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
5453 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
5454 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5455 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
5456 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
5457 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
5458 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
5459 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
5460 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5461 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
5462 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5463 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
5464 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
5465 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5467 ; GFX90A-TGSPLIT-LABEL: global_system_acq_rel_acquire_cmpxchg:
5468 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5469 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
5470 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
5471 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
5472 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
5473 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
5474 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5475 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
5476 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
5477 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
5478 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
5479 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
5480 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5481 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
5482 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5483 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
5484 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
5485 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5487 ; GFX940-NOTTGSPLIT-LABEL: global_system_acq_rel_acquire_cmpxchg:
5488 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5489 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
5490 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
5491 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5492 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
5493 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
5494 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5495 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
5496 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5497 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
5498 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
5499 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5500 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5501 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
5502 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5503 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
5504 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5506 ; GFX940-TGSPLIT-LABEL: global_system_acq_rel_acquire_cmpxchg:
5507 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5508 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
5509 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
5510 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5511 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
5512 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
5513 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5514 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
5515 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5516 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
5517 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
5518 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5519 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5520 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
5521 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5522 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
5523 ; GFX940-TGSPLIT-NEXT: s_endpgm
5525 ; GFX11-WGP-LABEL: global_system_acq_rel_acquire_cmpxchg:
5526 ; GFX11-WGP: ; %bb.0: ; %entry
5527 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
5528 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
5529 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
5530 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
5531 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
5532 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5533 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
5534 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
5535 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
5536 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
5537 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5538 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5539 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
5540 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5541 ; GFX11-WGP-NEXT: buffer_gl1_inv
5542 ; GFX11-WGP-NEXT: buffer_gl0_inv
5543 ; GFX11-WGP-NEXT: s_endpgm
5545 ; GFX11-CU-LABEL: global_system_acq_rel_acquire_cmpxchg:
5546 ; GFX11-CU: ; %bb.0: ; %entry
5547 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
5548 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
5549 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
5550 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
5551 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
5552 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5553 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
5554 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
5555 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
5556 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
5557 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5558 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
5559 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
5560 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
5561 ; GFX11-CU-NEXT: buffer_gl1_inv
5562 ; GFX11-CU-NEXT: buffer_gl0_inv
5563 ; GFX11-CU-NEXT: s_endpgm
5565 ; GFX12-WGP-LABEL: global_system_acq_rel_acquire_cmpxchg:
5566 ; GFX12-WGP: ; %bb.0: ; %entry
5567 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
5568 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
5569 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
5570 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
5571 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
5572 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
5573 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
5574 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
5575 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
5576 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
5577 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
5578 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
5579 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
5580 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
5581 ; GFX12-WGP-NEXT: s_wait_loadcnt_dscnt 0x0
5582 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
5583 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
5584 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
5585 ; GFX12-WGP-NEXT: s_endpgm
5587 ; GFX12-CU-LABEL: global_system_acq_rel_acquire_cmpxchg:
5588 ; GFX12-CU: ; %bb.0: ; %entry
5589 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
5590 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
5591 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
5592 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
5593 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
5594 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
5595 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
5596 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
5597 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
5598 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
5599 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
5600 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
5601 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
5602 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
5603 ; GFX12-CU-NEXT: s_wait_loadcnt_dscnt 0x0
5604 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
5605 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
5606 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
5607 ; GFX12-CU-NEXT: s_endpgm
5608 ptr addrspace(1) %out, i32 %in, i32 %old) {
5610 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
5611 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in acq_rel acquire
5615 define amdgpu_kernel void @global_system_seq_cst_acquire_cmpxchg(
5616 ; GFX6-LABEL: global_system_seq_cst_acquire_cmpxchg:
5617 ; GFX6: ; %bb.0: ; %entry
5618 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
5619 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
5620 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
5621 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5622 ; GFX6-NEXT: s_mov_b32 s12, s5
5623 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
5624 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
5625 ; GFX6-NEXT: s_mov_b32 s11, -1
5626 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
5627 ; GFX6-NEXT: s_mov_b32 s5, s12
5628 ; GFX6-NEXT: s_mov_b32 s6, s11
5629 ; GFX6-NEXT: s_mov_b32 s7, s10
5630 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
5631 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
5632 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
5633 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
5634 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5635 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
5636 ; GFX6-NEXT: s_waitcnt vmcnt(0)
5637 ; GFX6-NEXT: buffer_wbinvl1
5638 ; GFX6-NEXT: s_endpgm
5640 ; GFX7-LABEL: global_system_seq_cst_acquire_cmpxchg:
5641 ; GFX7: ; %bb.0: ; %entry
5642 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
5643 ; GFX7-NEXT: s_load_dwordx2 s[8:9], s[4:5], 0x0
5644 ; GFX7-NEXT: s_load_dword s7, s[4:5], 0x2
5645 ; GFX7-NEXT: s_load_dword s6, s[4:5], 0x3
5646 ; GFX7-NEXT: s_mov_b64 s[10:11], 16
5647 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5648 ; GFX7-NEXT: s_mov_b32 s4, s8
5649 ; GFX7-NEXT: s_mov_b32 s5, s9
5650 ; GFX7-NEXT: s_mov_b32 s9, s10
5651 ; GFX7-NEXT: s_mov_b32 s8, s11
5652 ; GFX7-NEXT: s_add_u32 s4, s4, s9
5653 ; GFX7-NEXT: s_addc_u32 s8, s5, s8
5654 ; GFX7-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5
5655 ; GFX7-NEXT: s_mov_b32 s5, s8
5656 ; GFX7-NEXT: v_mov_b32_e32 v2, s7
5657 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
5658 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
5659 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
5660 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5661 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
5662 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5663 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
5664 ; GFX7-NEXT: s_waitcnt vmcnt(0)
5665 ; GFX7-NEXT: buffer_wbinvl1_vol
5666 ; GFX7-NEXT: s_endpgm
5668 ; GFX10-WGP-LABEL: global_system_seq_cst_acquire_cmpxchg:
5669 ; GFX10-WGP: ; %bb.0: ; %entry
5670 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
5671 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
5672 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
5673 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
5674 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
5675 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5676 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
5677 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
5678 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
5679 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
5680 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5681 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5682 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
5683 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5684 ; GFX10-WGP-NEXT: buffer_gl1_inv
5685 ; GFX10-WGP-NEXT: buffer_gl0_inv
5686 ; GFX10-WGP-NEXT: s_endpgm
5688 ; GFX10-CU-LABEL: global_system_seq_cst_acquire_cmpxchg:
5689 ; GFX10-CU: ; %bb.0: ; %entry
5690 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
5691 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
5692 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
5693 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
5694 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
5695 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5696 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
5697 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
5698 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
5699 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
5700 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5701 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
5702 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
5703 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
5704 ; GFX10-CU-NEXT: buffer_gl1_inv
5705 ; GFX10-CU-NEXT: buffer_gl0_inv
5706 ; GFX10-CU-NEXT: s_endpgm
5708 ; SKIP-CACHE-INV-LABEL: global_system_seq_cst_acquire_cmpxchg:
5709 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5710 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
5711 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
5712 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
5713 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5714 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
5715 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
5716 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
5717 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
5718 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
5719 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
5720 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
5721 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
5722 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
5723 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
5724 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
5725 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
5726 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5727 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16
5728 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
5729 ; SKIP-CACHE-INV-NEXT: s_endpgm
5731 ; GFX90A-NOTTGSPLIT-LABEL: global_system_seq_cst_acquire_cmpxchg:
5732 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5733 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
5734 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
5735 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
5736 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
5737 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
5738 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5739 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
5740 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
5741 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
5742 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
5743 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
5744 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5745 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
5746 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5747 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
5748 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
5749 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5751 ; GFX90A-TGSPLIT-LABEL: global_system_seq_cst_acquire_cmpxchg:
5752 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5753 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
5754 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
5755 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
5756 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
5757 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
5758 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5759 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
5760 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
5761 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
5762 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
5763 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
5764 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5765 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
5766 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5767 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
5768 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
5769 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5771 ; GFX940-NOTTGSPLIT-LABEL: global_system_seq_cst_acquire_cmpxchg:
5772 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5773 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
5774 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
5775 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5776 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
5777 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
5778 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5779 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
5780 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5781 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
5782 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
5783 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5784 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5785 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
5786 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5787 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
5788 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5790 ; GFX940-TGSPLIT-LABEL: global_system_seq_cst_acquire_cmpxchg:
5791 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5792 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
5793 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
5794 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5795 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
5796 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
5797 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5798 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
5799 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5800 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
5801 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
5802 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5803 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5804 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
5805 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5806 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
5807 ; GFX940-TGSPLIT-NEXT: s_endpgm
5809 ; GFX11-WGP-LABEL: global_system_seq_cst_acquire_cmpxchg:
5810 ; GFX11-WGP: ; %bb.0: ; %entry
5811 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
5812 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
5813 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
5814 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
5815 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
5816 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5817 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
5818 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
5819 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
5820 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
5821 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5822 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5823 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
5824 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5825 ; GFX11-WGP-NEXT: buffer_gl1_inv
5826 ; GFX11-WGP-NEXT: buffer_gl0_inv
5827 ; GFX11-WGP-NEXT: s_endpgm
5829 ; GFX11-CU-LABEL: global_system_seq_cst_acquire_cmpxchg:
5830 ; GFX11-CU: ; %bb.0: ; %entry
5831 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
5832 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
5833 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
5834 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
5835 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
5836 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5837 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
5838 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
5839 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
5840 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
5841 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5842 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
5843 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
5844 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
5845 ; GFX11-CU-NEXT: buffer_gl1_inv
5846 ; GFX11-CU-NEXT: buffer_gl0_inv
5847 ; GFX11-CU-NEXT: s_endpgm
5849 ; GFX12-WGP-LABEL: global_system_seq_cst_acquire_cmpxchg:
5850 ; GFX12-WGP: ; %bb.0: ; %entry
5851 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
5852 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
5853 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
5854 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
5855 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
5856 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
5857 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
5858 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
5859 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
5860 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
5861 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
5862 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
5863 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
5864 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
5865 ; GFX12-WGP-NEXT: s_wait_loadcnt_dscnt 0x0
5866 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
5867 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
5868 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
5869 ; GFX12-WGP-NEXT: s_endpgm
5871 ; GFX12-CU-LABEL: global_system_seq_cst_acquire_cmpxchg:
5872 ; GFX12-CU: ; %bb.0: ; %entry
5873 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
5874 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
5875 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
5876 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
5877 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
5878 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
5879 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
5880 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
5881 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
5882 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
5883 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
5884 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
5885 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
5886 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
5887 ; GFX12-CU-NEXT: s_wait_loadcnt_dscnt 0x0
5888 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
5889 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
5890 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
5891 ; GFX12-CU-NEXT: s_endpgm
5892 ptr addrspace(1) %out, i32 %in, i32 %old) {
5894 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
5895 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in seq_cst acquire
5899 define amdgpu_kernel void @global_system_seq_cst_seq_cst_cmpxchg(
5900 ; GFX6-LABEL: global_system_seq_cst_seq_cst_cmpxchg:
5901 ; GFX6: ; %bb.0: ; %entry
5902 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
5903 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
5904 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
5905 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5906 ; GFX6-NEXT: s_mov_b32 s12, s5
5907 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
5908 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
5909 ; GFX6-NEXT: s_mov_b32 s11, -1
5910 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
5911 ; GFX6-NEXT: s_mov_b32 s5, s12
5912 ; GFX6-NEXT: s_mov_b32 s6, s11
5913 ; GFX6-NEXT: s_mov_b32 s7, s10
5914 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
5915 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
5916 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
5917 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
5918 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5919 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
5920 ; GFX6-NEXT: s_waitcnt vmcnt(0)
5921 ; GFX6-NEXT: buffer_wbinvl1
5922 ; GFX6-NEXT: s_endpgm
5924 ; GFX7-LABEL: global_system_seq_cst_seq_cst_cmpxchg:
5925 ; GFX7: ; %bb.0: ; %entry
5926 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
5927 ; GFX7-NEXT: s_load_dwordx2 s[8:9], s[4:5], 0x0
5928 ; GFX7-NEXT: s_load_dword s7, s[4:5], 0x2
5929 ; GFX7-NEXT: s_load_dword s6, s[4:5], 0x3
5930 ; GFX7-NEXT: s_mov_b64 s[10:11], 16
5931 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5932 ; GFX7-NEXT: s_mov_b32 s4, s8
5933 ; GFX7-NEXT: s_mov_b32 s5, s9
5934 ; GFX7-NEXT: s_mov_b32 s9, s10
5935 ; GFX7-NEXT: s_mov_b32 s8, s11
5936 ; GFX7-NEXT: s_add_u32 s4, s4, s9
5937 ; GFX7-NEXT: s_addc_u32 s8, s5, s8
5938 ; GFX7-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5
5939 ; GFX7-NEXT: s_mov_b32 s5, s8
5940 ; GFX7-NEXT: v_mov_b32_e32 v2, s7
5941 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
5942 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
5943 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
5944 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5945 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
5946 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5947 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
5948 ; GFX7-NEXT: s_waitcnt vmcnt(0)
5949 ; GFX7-NEXT: buffer_wbinvl1_vol
5950 ; GFX7-NEXT: s_endpgm
5952 ; GFX10-WGP-LABEL: global_system_seq_cst_seq_cst_cmpxchg:
5953 ; GFX10-WGP: ; %bb.0: ; %entry
5954 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
5955 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
5956 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
5957 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
5958 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
5959 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5960 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
5961 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
5962 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
5963 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
5964 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5965 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5966 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
5967 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5968 ; GFX10-WGP-NEXT: buffer_gl1_inv
5969 ; GFX10-WGP-NEXT: buffer_gl0_inv
5970 ; GFX10-WGP-NEXT: s_endpgm
5972 ; GFX10-CU-LABEL: global_system_seq_cst_seq_cst_cmpxchg:
5973 ; GFX10-CU: ; %bb.0: ; %entry
5974 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
5975 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
5976 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
5977 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
5978 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
5979 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5980 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
5981 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
5982 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
5983 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
5984 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5985 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
5986 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
5987 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
5988 ; GFX10-CU-NEXT: buffer_gl1_inv
5989 ; GFX10-CU-NEXT: buffer_gl0_inv
5990 ; GFX10-CU-NEXT: s_endpgm
5992 ; SKIP-CACHE-INV-LABEL: global_system_seq_cst_seq_cst_cmpxchg:
5993 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5994 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
5995 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
5996 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
5997 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5998 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
5999 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
6000 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
6001 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
6002 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
6003 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
6004 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
6005 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
6006 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
6007 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
6008 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
6009 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
6010 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6011 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16
6012 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
6013 ; SKIP-CACHE-INV-NEXT: s_endpgm
6015 ; GFX90A-NOTTGSPLIT-LABEL: global_system_seq_cst_seq_cst_cmpxchg:
6016 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6017 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
6018 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6019 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
6020 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
6021 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
6022 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6023 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
6024 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
6025 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
6026 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
6027 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
6028 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6029 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
6030 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6031 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
6032 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
6033 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6035 ; GFX90A-TGSPLIT-LABEL: global_system_seq_cst_seq_cst_cmpxchg:
6036 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6037 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
6038 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6039 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
6040 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
6041 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
6042 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6043 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
6044 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
6045 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
6046 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
6047 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
6048 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6049 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
6050 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6051 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
6052 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
6053 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6055 ; GFX940-NOTTGSPLIT-LABEL: global_system_seq_cst_seq_cst_cmpxchg:
6056 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6057 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
6058 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6059 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6060 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
6061 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
6062 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6063 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
6064 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6065 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
6066 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
6067 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6068 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6069 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
6070 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6071 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
6072 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6074 ; GFX940-TGSPLIT-LABEL: global_system_seq_cst_seq_cst_cmpxchg:
6075 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6076 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
6077 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6078 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6079 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
6080 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
6081 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6082 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
6083 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6084 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
6085 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
6086 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6087 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6088 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
6089 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6090 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
6091 ; GFX940-TGSPLIT-NEXT: s_endpgm
6093 ; GFX11-WGP-LABEL: global_system_seq_cst_seq_cst_cmpxchg:
6094 ; GFX11-WGP: ; %bb.0: ; %entry
6095 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
6096 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
6097 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
6098 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
6099 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
6100 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6101 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
6102 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
6103 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
6104 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
6105 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6106 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6107 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
6108 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6109 ; GFX11-WGP-NEXT: buffer_gl1_inv
6110 ; GFX11-WGP-NEXT: buffer_gl0_inv
6111 ; GFX11-WGP-NEXT: s_endpgm
6113 ; GFX11-CU-LABEL: global_system_seq_cst_seq_cst_cmpxchg:
6114 ; GFX11-CU: ; %bb.0: ; %entry
6115 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
6116 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
6117 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
6118 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
6119 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
6120 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6121 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
6122 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
6123 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
6124 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
6125 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6126 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
6127 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
6128 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
6129 ; GFX11-CU-NEXT: buffer_gl1_inv
6130 ; GFX11-CU-NEXT: buffer_gl0_inv
6131 ; GFX11-CU-NEXT: s_endpgm
6133 ; GFX12-WGP-LABEL: global_system_seq_cst_seq_cst_cmpxchg:
6134 ; GFX12-WGP: ; %bb.0: ; %entry
6135 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
6136 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
6137 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
6138 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
6139 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
6140 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
6141 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
6142 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
6143 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
6144 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
6145 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
6146 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
6147 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
6148 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
6149 ; GFX12-WGP-NEXT: s_wait_loadcnt_dscnt 0x0
6150 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
6151 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
6152 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
6153 ; GFX12-WGP-NEXT: s_endpgm
6155 ; GFX12-CU-LABEL: global_system_seq_cst_seq_cst_cmpxchg:
6156 ; GFX12-CU: ; %bb.0: ; %entry
6157 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
6158 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
6159 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
6160 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
6161 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
6162 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
6163 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
6164 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
6165 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
6166 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
6167 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
6168 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
6169 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
6170 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
6171 ; GFX12-CU-NEXT: s_wait_loadcnt_dscnt 0x0
6172 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
6173 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
6174 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
6175 ; GFX12-CU-NEXT: s_endpgm
6176 ptr addrspace(1) %out, i32 %in, i32 %old) {
6178 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
6179 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in seq_cst seq_cst
6183 define amdgpu_kernel void @global_system_monotonic_monotonic_ret_cmpxchg(
6184 ; GFX6-LABEL: global_system_monotonic_monotonic_ret_cmpxchg:
6185 ; GFX6: ; %bb.0: ; %entry
6186 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
6187 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
6188 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
6189 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6190 ; GFX6-NEXT: s_mov_b32 s12, s5
6191 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
6192 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
6193 ; GFX6-NEXT: s_mov_b32 s11, -1
6194 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
6195 ; GFX6-NEXT: s_mov_b32 s5, s12
6196 ; GFX6-NEXT: s_mov_b32 s6, s11
6197 ; GFX6-NEXT: s_mov_b32 s7, s10
6198 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
6199 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
6200 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
6201 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
6202 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
6203 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
6204 ; GFX6-NEXT: s_waitcnt vmcnt(0)
6205 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
6206 ; GFX6-NEXT: s_endpgm
6208 ; GFX7-LABEL: global_system_monotonic_monotonic_ret_cmpxchg:
6209 ; GFX7: ; %bb.0: ; %entry
6210 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
6211 ; GFX7-NEXT: s_load_dword s9, s[6:7], 0x2
6212 ; GFX7-NEXT: s_load_dword s8, s[6:7], 0x3
6213 ; GFX7-NEXT: s_mov_b64 s[12:13], 16
6214 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6215 ; GFX7-NEXT: s_mov_b32 s6, s4
6216 ; GFX7-NEXT: s_mov_b32 s7, s5
6217 ; GFX7-NEXT: s_mov_b32 s11, s12
6218 ; GFX7-NEXT: s_mov_b32 s10, s13
6219 ; GFX7-NEXT: s_add_u32 s6, s6, s11
6220 ; GFX7-NEXT: s_addc_u32 s10, s7, s10
6221 ; GFX7-NEXT: ; kill: def $sgpr6 killed $sgpr6 def $sgpr6_sgpr7
6222 ; GFX7-NEXT: s_mov_b32 s7, s10
6223 ; GFX7-NEXT: v_mov_b32_e32 v2, s9
6224 ; GFX7-NEXT: v_mov_b32_e32 v0, s8
6225 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
6226 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
6227 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
6228 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
6229 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6230 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
6231 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
6232 ; GFX7-NEXT: s_waitcnt vmcnt(0)
6233 ; GFX7-NEXT: flat_store_dword v[0:1], v2
6234 ; GFX7-NEXT: s_endpgm
6236 ; GFX10-WGP-LABEL: global_system_monotonic_monotonic_ret_cmpxchg:
6237 ; GFX10-WGP: ; %bb.0: ; %entry
6238 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
6239 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
6240 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
6241 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
6242 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
6243 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6244 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
6245 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
6246 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
6247 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
6248 ; GFX10-WGP-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
6249 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
6250 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
6251 ; GFX10-WGP-NEXT: s_endpgm
6253 ; GFX10-CU-LABEL: global_system_monotonic_monotonic_ret_cmpxchg:
6254 ; GFX10-CU: ; %bb.0: ; %entry
6255 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
6256 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
6257 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
6258 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
6259 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
6260 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6261 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
6262 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
6263 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
6264 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
6265 ; GFX10-CU-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
6266 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
6267 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
6268 ; GFX10-CU-NEXT: s_endpgm
6270 ; SKIP-CACHE-INV-LABEL: global_system_monotonic_monotonic_ret_cmpxchg:
6271 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6272 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
6273 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
6274 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
6275 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6276 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
6277 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
6278 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
6279 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
6280 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
6281 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
6282 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
6283 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
6284 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
6285 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
6286 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
6287 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
6288 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16 glc
6289 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
6290 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
6291 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
6292 ; SKIP-CACHE-INV-NEXT: s_endpgm
6294 ; GFX90A-NOTTGSPLIT-LABEL: global_system_monotonic_monotonic_ret_cmpxchg:
6295 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6296 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
6297 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6298 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
6299 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
6300 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
6301 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6302 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
6303 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
6304 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
6305 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
6306 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
6307 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6308 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
6309 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6311 ; GFX90A-TGSPLIT-LABEL: global_system_monotonic_monotonic_ret_cmpxchg:
6312 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6313 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
6314 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6315 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
6316 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
6317 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
6318 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6319 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
6320 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
6321 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
6322 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
6323 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
6324 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6325 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
6326 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6328 ; GFX940-NOTTGSPLIT-LABEL: global_system_monotonic_monotonic_ret_cmpxchg:
6329 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6330 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
6331 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6332 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6333 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
6334 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
6335 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6336 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
6337 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6338 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
6339 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
6340 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
6341 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6342 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
6343 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6345 ; GFX940-TGSPLIT-LABEL: global_system_monotonic_monotonic_ret_cmpxchg:
6346 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6347 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
6348 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6349 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6350 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
6351 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
6352 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6353 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
6354 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6355 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
6356 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
6357 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
6358 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6359 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
6360 ; GFX940-TGSPLIT-NEXT: s_endpgm
6362 ; GFX11-WGP-LABEL: global_system_monotonic_monotonic_ret_cmpxchg:
6363 ; GFX11-WGP: ; %bb.0: ; %entry
6364 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
6365 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
6366 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
6367 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
6368 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
6369 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6370 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
6371 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
6372 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
6373 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
6374 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
6375 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
6376 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
6377 ; GFX11-WGP-NEXT: s_endpgm
6379 ; GFX11-CU-LABEL: global_system_monotonic_monotonic_ret_cmpxchg:
6380 ; GFX11-CU: ; %bb.0: ; %entry
6381 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
6382 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
6383 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
6384 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
6385 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
6386 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6387 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
6388 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
6389 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
6390 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
6391 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
6392 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
6393 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
6394 ; GFX11-CU-NEXT: s_endpgm
6396 ; GFX12-WGP-LABEL: global_system_monotonic_monotonic_ret_cmpxchg:
6397 ; GFX12-WGP: ; %bb.0: ; %entry
6398 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
6399 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
6400 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
6401 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
6402 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
6403 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
6404 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
6405 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
6406 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
6407 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
6408 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
6409 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
6410 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
6411 ; GFX12-WGP-NEXT: s_endpgm
6413 ; GFX12-CU-LABEL: global_system_monotonic_monotonic_ret_cmpxchg:
6414 ; GFX12-CU: ; %bb.0: ; %entry
6415 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
6416 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
6417 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
6418 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
6419 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
6420 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
6421 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
6422 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
6423 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
6424 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
6425 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
6426 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
6427 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
6428 ; GFX12-CU-NEXT: s_endpgm
6429 ptr addrspace(1) %out, i32 %in, i32 %old) {
6431 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
6432 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in monotonic monotonic
6433 %val0 = extractvalue { i32, i1 } %val, 0
6434 store i32 %val0, ptr addrspace(1) %out, align 4
6438 define amdgpu_kernel void @global_system_acquire_monotonic_ret_cmpxchg(
6439 ; GFX6-LABEL: global_system_acquire_monotonic_ret_cmpxchg:
6440 ; GFX6: ; %bb.0: ; %entry
6441 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
6442 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
6443 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
6444 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6445 ; GFX6-NEXT: s_mov_b32 s12, s5
6446 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
6447 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
6448 ; GFX6-NEXT: s_mov_b32 s11, -1
6449 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
6450 ; GFX6-NEXT: s_mov_b32 s5, s12
6451 ; GFX6-NEXT: s_mov_b32 s6, s11
6452 ; GFX6-NEXT: s_mov_b32 s7, s10
6453 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
6454 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
6455 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
6456 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
6457 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
6458 ; GFX6-NEXT: s_waitcnt vmcnt(0)
6459 ; GFX6-NEXT: buffer_wbinvl1
6460 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
6461 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
6462 ; GFX6-NEXT: s_endpgm
6464 ; GFX7-LABEL: global_system_acquire_monotonic_ret_cmpxchg:
6465 ; GFX7: ; %bb.0: ; %entry
6466 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
6467 ; GFX7-NEXT: s_load_dword s9, s[6:7], 0x2
6468 ; GFX7-NEXT: s_load_dword s8, s[6:7], 0x3
6469 ; GFX7-NEXT: s_mov_b64 s[12:13], 16
6470 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6471 ; GFX7-NEXT: s_mov_b32 s6, s4
6472 ; GFX7-NEXT: s_mov_b32 s7, s5
6473 ; GFX7-NEXT: s_mov_b32 s11, s12
6474 ; GFX7-NEXT: s_mov_b32 s10, s13
6475 ; GFX7-NEXT: s_add_u32 s6, s6, s11
6476 ; GFX7-NEXT: s_addc_u32 s10, s7, s10
6477 ; GFX7-NEXT: ; kill: def $sgpr6 killed $sgpr6 def $sgpr6_sgpr7
6478 ; GFX7-NEXT: s_mov_b32 s7, s10
6479 ; GFX7-NEXT: v_mov_b32_e32 v2, s9
6480 ; GFX7-NEXT: v_mov_b32_e32 v0, s8
6481 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
6482 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
6483 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
6484 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
6485 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6486 ; GFX7-NEXT: s_waitcnt vmcnt(0)
6487 ; GFX7-NEXT: buffer_wbinvl1_vol
6488 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
6489 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
6490 ; GFX7-NEXT: flat_store_dword v[0:1], v2
6491 ; GFX7-NEXT: s_endpgm
6493 ; GFX10-WGP-LABEL: global_system_acquire_monotonic_ret_cmpxchg:
6494 ; GFX10-WGP: ; %bb.0: ; %entry
6495 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
6496 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
6497 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
6498 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
6499 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
6500 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6501 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
6502 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
6503 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
6504 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
6505 ; GFX10-WGP-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
6506 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
6507 ; GFX10-WGP-NEXT: buffer_gl1_inv
6508 ; GFX10-WGP-NEXT: buffer_gl0_inv
6509 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
6510 ; GFX10-WGP-NEXT: s_endpgm
6512 ; GFX10-CU-LABEL: global_system_acquire_monotonic_ret_cmpxchg:
6513 ; GFX10-CU: ; %bb.0: ; %entry
6514 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
6515 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
6516 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
6517 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
6518 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
6519 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6520 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
6521 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
6522 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
6523 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
6524 ; GFX10-CU-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
6525 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
6526 ; GFX10-CU-NEXT: buffer_gl1_inv
6527 ; GFX10-CU-NEXT: buffer_gl0_inv
6528 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
6529 ; GFX10-CU-NEXT: s_endpgm
6531 ; SKIP-CACHE-INV-LABEL: global_system_acquire_monotonic_ret_cmpxchg:
6532 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6533 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
6534 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
6535 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
6536 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6537 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
6538 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
6539 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
6540 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
6541 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
6542 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
6543 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
6544 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
6545 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
6546 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
6547 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
6548 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
6549 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16 glc
6550 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
6551 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
6552 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
6553 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
6554 ; SKIP-CACHE-INV-NEXT: s_endpgm
6556 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acquire_monotonic_ret_cmpxchg:
6557 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6558 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
6559 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6560 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
6561 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
6562 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
6563 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6564 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
6565 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
6566 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
6567 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
6568 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
6569 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6570 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
6571 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
6572 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
6573 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6575 ; GFX90A-TGSPLIT-LABEL: global_system_acquire_monotonic_ret_cmpxchg:
6576 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6577 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
6578 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6579 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
6580 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
6581 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
6582 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6583 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
6584 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
6585 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
6586 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
6587 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
6588 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6589 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
6590 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
6591 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
6592 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6594 ; GFX940-NOTTGSPLIT-LABEL: global_system_acquire_monotonic_ret_cmpxchg:
6595 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6596 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
6597 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6598 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6599 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
6600 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
6601 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6602 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
6603 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6604 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
6605 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
6606 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
6607 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6608 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
6609 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
6610 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6612 ; GFX940-TGSPLIT-LABEL: global_system_acquire_monotonic_ret_cmpxchg:
6613 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6614 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
6615 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6616 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6617 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
6618 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
6619 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6620 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
6621 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6622 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
6623 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
6624 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
6625 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6626 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
6627 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
6628 ; GFX940-TGSPLIT-NEXT: s_endpgm
6630 ; GFX11-WGP-LABEL: global_system_acquire_monotonic_ret_cmpxchg:
6631 ; GFX11-WGP: ; %bb.0: ; %entry
6632 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
6633 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
6634 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
6635 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
6636 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
6637 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6638 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
6639 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
6640 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
6641 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
6642 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
6643 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
6644 ; GFX11-WGP-NEXT: buffer_gl1_inv
6645 ; GFX11-WGP-NEXT: buffer_gl0_inv
6646 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
6647 ; GFX11-WGP-NEXT: s_endpgm
6649 ; GFX11-CU-LABEL: global_system_acquire_monotonic_ret_cmpxchg:
6650 ; GFX11-CU: ; %bb.0: ; %entry
6651 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
6652 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
6653 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
6654 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
6655 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
6656 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6657 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
6658 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
6659 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
6660 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
6661 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
6662 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
6663 ; GFX11-CU-NEXT: buffer_gl1_inv
6664 ; GFX11-CU-NEXT: buffer_gl0_inv
6665 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
6666 ; GFX11-CU-NEXT: s_endpgm
6668 ; GFX12-WGP-LABEL: global_system_acquire_monotonic_ret_cmpxchg:
6669 ; GFX12-WGP: ; %bb.0: ; %entry
6670 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
6671 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
6672 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
6673 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
6674 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
6675 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
6676 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
6677 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
6678 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
6679 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
6680 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
6681 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
6682 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
6683 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
6684 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
6685 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
6686 ; GFX12-WGP-NEXT: s_endpgm
6688 ; GFX12-CU-LABEL: global_system_acquire_monotonic_ret_cmpxchg:
6689 ; GFX12-CU: ; %bb.0: ; %entry
6690 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
6691 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
6692 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
6693 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
6694 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
6695 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
6696 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
6697 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
6698 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
6699 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
6700 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
6701 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
6702 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
6703 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
6704 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
6705 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
6706 ; GFX12-CU-NEXT: s_endpgm
6707 ptr addrspace(1) %out, i32 %in, i32 %old) {
6709 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
6710 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in acquire monotonic
6711 %val0 = extractvalue { i32, i1 } %val, 0
6712 store i32 %val0, ptr addrspace(1) %out, align 4
6716 define amdgpu_kernel void @global_system_acq_rel_monotonic_ret_cmpxchg(
6717 ; GFX6-LABEL: global_system_acq_rel_monotonic_ret_cmpxchg:
6718 ; GFX6: ; %bb.0: ; %entry
6719 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
6720 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
6721 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
6722 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6723 ; GFX6-NEXT: s_mov_b32 s12, s5
6724 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
6725 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
6726 ; GFX6-NEXT: s_mov_b32 s11, -1
6727 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
6728 ; GFX6-NEXT: s_mov_b32 s5, s12
6729 ; GFX6-NEXT: s_mov_b32 s6, s11
6730 ; GFX6-NEXT: s_mov_b32 s7, s10
6731 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
6732 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
6733 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
6734 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
6735 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6736 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
6737 ; GFX6-NEXT: s_waitcnt vmcnt(0)
6738 ; GFX6-NEXT: buffer_wbinvl1
6739 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
6740 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
6741 ; GFX6-NEXT: s_endpgm
6743 ; GFX7-LABEL: global_system_acq_rel_monotonic_ret_cmpxchg:
6744 ; GFX7: ; %bb.0: ; %entry
6745 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
6746 ; GFX7-NEXT: s_load_dword s9, s[6:7], 0x2
6747 ; GFX7-NEXT: s_load_dword s8, s[6:7], 0x3
6748 ; GFX7-NEXT: s_mov_b64 s[12:13], 16
6749 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6750 ; GFX7-NEXT: s_mov_b32 s6, s4
6751 ; GFX7-NEXT: s_mov_b32 s7, s5
6752 ; GFX7-NEXT: s_mov_b32 s11, s12
6753 ; GFX7-NEXT: s_mov_b32 s10, s13
6754 ; GFX7-NEXT: s_add_u32 s6, s6, s11
6755 ; GFX7-NEXT: s_addc_u32 s10, s7, s10
6756 ; GFX7-NEXT: ; kill: def $sgpr6 killed $sgpr6 def $sgpr6_sgpr7
6757 ; GFX7-NEXT: s_mov_b32 s7, s10
6758 ; GFX7-NEXT: v_mov_b32_e32 v2, s9
6759 ; GFX7-NEXT: v_mov_b32_e32 v0, s8
6760 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
6761 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
6762 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
6763 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
6764 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6765 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6766 ; GFX7-NEXT: s_waitcnt vmcnt(0)
6767 ; GFX7-NEXT: buffer_wbinvl1_vol
6768 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
6769 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
6770 ; GFX7-NEXT: flat_store_dword v[0:1], v2
6771 ; GFX7-NEXT: s_endpgm
6773 ; GFX10-WGP-LABEL: global_system_acq_rel_monotonic_ret_cmpxchg:
6774 ; GFX10-WGP: ; %bb.0: ; %entry
6775 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
6776 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
6777 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
6778 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
6779 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
6780 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6781 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
6782 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
6783 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
6784 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
6785 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6786 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6787 ; GFX10-WGP-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
6788 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
6789 ; GFX10-WGP-NEXT: buffer_gl1_inv
6790 ; GFX10-WGP-NEXT: buffer_gl0_inv
6791 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
6792 ; GFX10-WGP-NEXT: s_endpgm
6794 ; GFX10-CU-LABEL: global_system_acq_rel_monotonic_ret_cmpxchg:
6795 ; GFX10-CU: ; %bb.0: ; %entry
6796 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
6797 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
6798 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
6799 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
6800 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
6801 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6802 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
6803 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
6804 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
6805 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
6806 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6807 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
6808 ; GFX10-CU-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
6809 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
6810 ; GFX10-CU-NEXT: buffer_gl1_inv
6811 ; GFX10-CU-NEXT: buffer_gl0_inv
6812 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
6813 ; GFX10-CU-NEXT: s_endpgm
6815 ; SKIP-CACHE-INV-LABEL: global_system_acq_rel_monotonic_ret_cmpxchg:
6816 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6817 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
6818 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
6819 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
6820 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6821 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
6822 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
6823 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
6824 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
6825 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
6826 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
6827 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
6828 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
6829 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
6830 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
6831 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
6832 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
6833 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6834 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16 glc
6835 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
6836 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
6837 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
6838 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
6839 ; SKIP-CACHE-INV-NEXT: s_endpgm
6841 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acq_rel_monotonic_ret_cmpxchg:
6842 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6843 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
6844 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6845 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
6846 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
6847 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
6848 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6849 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
6850 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
6851 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
6852 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
6853 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
6854 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6855 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
6856 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6857 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
6858 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
6859 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
6860 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6862 ; GFX90A-TGSPLIT-LABEL: global_system_acq_rel_monotonic_ret_cmpxchg:
6863 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6864 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
6865 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6866 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
6867 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
6868 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
6869 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6870 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
6871 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
6872 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
6873 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
6874 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
6875 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6876 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
6877 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6878 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
6879 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
6880 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
6881 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6883 ; GFX940-NOTTGSPLIT-LABEL: global_system_acq_rel_monotonic_ret_cmpxchg:
6884 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6885 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
6886 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6887 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6888 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
6889 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
6890 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6891 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
6892 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6893 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
6894 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
6895 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6896 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6897 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
6898 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6899 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
6900 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
6901 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6903 ; GFX940-TGSPLIT-LABEL: global_system_acq_rel_monotonic_ret_cmpxchg:
6904 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6905 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
6906 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6907 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6908 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
6909 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
6910 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6911 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
6912 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6913 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
6914 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
6915 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6916 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6917 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
6918 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6919 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
6920 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
6921 ; GFX940-TGSPLIT-NEXT: s_endpgm
6923 ; GFX11-WGP-LABEL: global_system_acq_rel_monotonic_ret_cmpxchg:
6924 ; GFX11-WGP: ; %bb.0: ; %entry
6925 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
6926 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
6927 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
6928 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
6929 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
6930 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6931 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
6932 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
6933 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
6934 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
6935 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6936 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6937 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
6938 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
6939 ; GFX11-WGP-NEXT: buffer_gl1_inv
6940 ; GFX11-WGP-NEXT: buffer_gl0_inv
6941 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
6942 ; GFX11-WGP-NEXT: s_endpgm
6944 ; GFX11-CU-LABEL: global_system_acq_rel_monotonic_ret_cmpxchg:
6945 ; GFX11-CU: ; %bb.0: ; %entry
6946 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
6947 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
6948 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
6949 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
6950 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
6951 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6952 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
6953 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
6954 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
6955 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
6956 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6957 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
6958 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
6959 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
6960 ; GFX11-CU-NEXT: buffer_gl1_inv
6961 ; GFX11-CU-NEXT: buffer_gl0_inv
6962 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
6963 ; GFX11-CU-NEXT: s_endpgm
6965 ; GFX12-WGP-LABEL: global_system_acq_rel_monotonic_ret_cmpxchg:
6966 ; GFX12-WGP: ; %bb.0: ; %entry
6967 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
6968 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
6969 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
6970 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
6971 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
6972 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
6973 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
6974 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
6975 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
6976 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
6977 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
6978 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
6979 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
6980 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
6981 ; GFX12-WGP-NEXT: s_wait_loadcnt_dscnt 0x0
6982 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
6983 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
6984 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
6985 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
6986 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
6987 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
6988 ; GFX12-WGP-NEXT: s_endpgm
6990 ; GFX12-CU-LABEL: global_system_acq_rel_monotonic_ret_cmpxchg:
6991 ; GFX12-CU: ; %bb.0: ; %entry
6992 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
6993 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
6994 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
6995 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
6996 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
6997 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
6998 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
6999 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
7000 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
7001 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
7002 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
7003 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
7004 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
7005 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
7006 ; GFX12-CU-NEXT: s_wait_loadcnt_dscnt 0x0
7007 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
7008 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
7009 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
7010 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
7011 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
7012 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
7013 ; GFX12-CU-NEXT: s_endpgm
7014 ptr addrspace(1) %out, i32 %in, i32 %old) {
7016 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
7017 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in acq_rel monotonic
7018 %val0 = extractvalue { i32, i1 } %val, 0
7019 store i32 %val0, ptr addrspace(1) %out, align 4
7023 define amdgpu_kernel void @global_system_seq_cst_monotonic_ret_cmpxchg(
7024 ; GFX6-LABEL: global_system_seq_cst_monotonic_ret_cmpxchg:
7025 ; GFX6: ; %bb.0: ; %entry
7026 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
7027 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
7028 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
7029 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7030 ; GFX6-NEXT: s_mov_b32 s12, s5
7031 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
7032 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
7033 ; GFX6-NEXT: s_mov_b32 s11, -1
7034 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
7035 ; GFX6-NEXT: s_mov_b32 s5, s12
7036 ; GFX6-NEXT: s_mov_b32 s6, s11
7037 ; GFX6-NEXT: s_mov_b32 s7, s10
7038 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
7039 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
7040 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
7041 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
7042 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7043 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
7044 ; GFX6-NEXT: s_waitcnt vmcnt(0)
7045 ; GFX6-NEXT: buffer_wbinvl1
7046 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
7047 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
7048 ; GFX6-NEXT: s_endpgm
7050 ; GFX7-LABEL: global_system_seq_cst_monotonic_ret_cmpxchg:
7051 ; GFX7: ; %bb.0: ; %entry
7052 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
7053 ; GFX7-NEXT: s_load_dword s9, s[6:7], 0x2
7054 ; GFX7-NEXT: s_load_dword s8, s[6:7], 0x3
7055 ; GFX7-NEXT: s_mov_b64 s[12:13], 16
7056 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7057 ; GFX7-NEXT: s_mov_b32 s6, s4
7058 ; GFX7-NEXT: s_mov_b32 s7, s5
7059 ; GFX7-NEXT: s_mov_b32 s11, s12
7060 ; GFX7-NEXT: s_mov_b32 s10, s13
7061 ; GFX7-NEXT: s_add_u32 s6, s6, s11
7062 ; GFX7-NEXT: s_addc_u32 s10, s7, s10
7063 ; GFX7-NEXT: ; kill: def $sgpr6 killed $sgpr6 def $sgpr6_sgpr7
7064 ; GFX7-NEXT: s_mov_b32 s7, s10
7065 ; GFX7-NEXT: v_mov_b32_e32 v2, s9
7066 ; GFX7-NEXT: v_mov_b32_e32 v0, s8
7067 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
7068 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
7069 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
7070 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
7071 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7072 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
7073 ; GFX7-NEXT: s_waitcnt vmcnt(0)
7074 ; GFX7-NEXT: buffer_wbinvl1_vol
7075 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
7076 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
7077 ; GFX7-NEXT: flat_store_dword v[0:1], v2
7078 ; GFX7-NEXT: s_endpgm
7080 ; GFX10-WGP-LABEL: global_system_seq_cst_monotonic_ret_cmpxchg:
7081 ; GFX10-WGP: ; %bb.0: ; %entry
7082 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
7083 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
7084 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
7085 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
7086 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
7087 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7088 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
7089 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
7090 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
7091 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
7092 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7093 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
7094 ; GFX10-WGP-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
7095 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
7096 ; GFX10-WGP-NEXT: buffer_gl1_inv
7097 ; GFX10-WGP-NEXT: buffer_gl0_inv
7098 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
7099 ; GFX10-WGP-NEXT: s_endpgm
7101 ; GFX10-CU-LABEL: global_system_seq_cst_monotonic_ret_cmpxchg:
7102 ; GFX10-CU: ; %bb.0: ; %entry
7103 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
7104 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
7105 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
7106 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
7107 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
7108 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7109 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
7110 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
7111 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
7112 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
7113 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7114 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
7115 ; GFX10-CU-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
7116 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
7117 ; GFX10-CU-NEXT: buffer_gl1_inv
7118 ; GFX10-CU-NEXT: buffer_gl0_inv
7119 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
7120 ; GFX10-CU-NEXT: s_endpgm
7122 ; SKIP-CACHE-INV-LABEL: global_system_seq_cst_monotonic_ret_cmpxchg:
7123 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7124 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
7125 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
7126 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
7127 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7128 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
7129 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
7130 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
7131 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
7132 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
7133 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
7134 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
7135 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
7136 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
7137 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
7138 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
7139 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
7140 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7141 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16 glc
7142 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
7143 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
7144 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
7145 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
7146 ; SKIP-CACHE-INV-NEXT: s_endpgm
7148 ; GFX90A-NOTTGSPLIT-LABEL: global_system_seq_cst_monotonic_ret_cmpxchg:
7149 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7150 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
7151 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7152 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
7153 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
7154 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
7155 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7156 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
7157 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
7158 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
7159 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
7160 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
7161 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7162 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
7163 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7164 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
7165 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
7166 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
7167 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7169 ; GFX90A-TGSPLIT-LABEL: global_system_seq_cst_monotonic_ret_cmpxchg:
7170 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7171 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
7172 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7173 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
7174 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
7175 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
7176 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7177 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
7178 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
7179 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
7180 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
7181 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
7182 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7183 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
7184 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7185 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
7186 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
7187 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
7188 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7190 ; GFX940-NOTTGSPLIT-LABEL: global_system_seq_cst_monotonic_ret_cmpxchg:
7191 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7192 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
7193 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7194 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7195 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
7196 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
7197 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7198 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
7199 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7200 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
7201 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
7202 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
7203 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7204 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
7205 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7206 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
7207 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
7208 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7210 ; GFX940-TGSPLIT-LABEL: global_system_seq_cst_monotonic_ret_cmpxchg:
7211 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7212 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
7213 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7214 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7215 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
7216 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
7217 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7218 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
7219 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7220 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
7221 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
7222 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
7223 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7224 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
7225 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7226 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
7227 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
7228 ; GFX940-TGSPLIT-NEXT: s_endpgm
7230 ; GFX11-WGP-LABEL: global_system_seq_cst_monotonic_ret_cmpxchg:
7231 ; GFX11-WGP: ; %bb.0: ; %entry
7232 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
7233 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
7234 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
7235 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
7236 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
7237 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7238 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
7239 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
7240 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
7241 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
7242 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7243 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
7244 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
7245 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
7246 ; GFX11-WGP-NEXT: buffer_gl1_inv
7247 ; GFX11-WGP-NEXT: buffer_gl0_inv
7248 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
7249 ; GFX11-WGP-NEXT: s_endpgm
7251 ; GFX11-CU-LABEL: global_system_seq_cst_monotonic_ret_cmpxchg:
7252 ; GFX11-CU: ; %bb.0: ; %entry
7253 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
7254 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
7255 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
7256 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
7257 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
7258 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7259 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
7260 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
7261 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
7262 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
7263 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7264 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
7265 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
7266 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
7267 ; GFX11-CU-NEXT: buffer_gl1_inv
7268 ; GFX11-CU-NEXT: buffer_gl0_inv
7269 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
7270 ; GFX11-CU-NEXT: s_endpgm
7272 ; GFX12-WGP-LABEL: global_system_seq_cst_monotonic_ret_cmpxchg:
7273 ; GFX12-WGP: ; %bb.0: ; %entry
7274 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
7275 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
7276 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
7277 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
7278 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
7279 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
7280 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
7281 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
7282 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
7283 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
7284 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
7285 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
7286 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
7287 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
7288 ; GFX12-WGP-NEXT: s_wait_loadcnt_dscnt 0x0
7289 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
7290 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
7291 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
7292 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
7293 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
7294 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
7295 ; GFX12-WGP-NEXT: s_endpgm
7297 ; GFX12-CU-LABEL: global_system_seq_cst_monotonic_ret_cmpxchg:
7298 ; GFX12-CU: ; %bb.0: ; %entry
7299 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
7300 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
7301 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
7302 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
7303 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
7304 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
7305 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
7306 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
7307 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
7308 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
7309 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
7310 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
7311 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
7312 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
7313 ; GFX12-CU-NEXT: s_wait_loadcnt_dscnt 0x0
7314 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
7315 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
7316 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
7317 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
7318 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
7319 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
7320 ; GFX12-CU-NEXT: s_endpgm
7321 ptr addrspace(1) %out, i32 %in, i32 %old) {
7323 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
7324 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in seq_cst monotonic
7325 %val0 = extractvalue { i32, i1 } %val, 0
7326 store i32 %val0, ptr addrspace(1) %out, align 4
7330 define amdgpu_kernel void @global_system_monotonic_acquire_ret_cmpxchg(
7331 ; GFX6-LABEL: global_system_monotonic_acquire_ret_cmpxchg:
7332 ; GFX6: ; %bb.0: ; %entry
7333 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
7334 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
7335 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
7336 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7337 ; GFX6-NEXT: s_mov_b32 s12, s5
7338 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
7339 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
7340 ; GFX6-NEXT: s_mov_b32 s11, -1
7341 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
7342 ; GFX6-NEXT: s_mov_b32 s5, s12
7343 ; GFX6-NEXT: s_mov_b32 s6, s11
7344 ; GFX6-NEXT: s_mov_b32 s7, s10
7345 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
7346 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
7347 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
7348 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
7349 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
7350 ; GFX6-NEXT: s_waitcnt vmcnt(0)
7351 ; GFX6-NEXT: buffer_wbinvl1
7352 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
7353 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
7354 ; GFX6-NEXT: s_endpgm
7356 ; GFX7-LABEL: global_system_monotonic_acquire_ret_cmpxchg:
7357 ; GFX7: ; %bb.0: ; %entry
7358 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
7359 ; GFX7-NEXT: s_load_dword s9, s[6:7], 0x2
7360 ; GFX7-NEXT: s_load_dword s8, s[6:7], 0x3
7361 ; GFX7-NEXT: s_mov_b64 s[12:13], 16
7362 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7363 ; GFX7-NEXT: s_mov_b32 s6, s4
7364 ; GFX7-NEXT: s_mov_b32 s7, s5
7365 ; GFX7-NEXT: s_mov_b32 s11, s12
7366 ; GFX7-NEXT: s_mov_b32 s10, s13
7367 ; GFX7-NEXT: s_add_u32 s6, s6, s11
7368 ; GFX7-NEXT: s_addc_u32 s10, s7, s10
7369 ; GFX7-NEXT: ; kill: def $sgpr6 killed $sgpr6 def $sgpr6_sgpr7
7370 ; GFX7-NEXT: s_mov_b32 s7, s10
7371 ; GFX7-NEXT: v_mov_b32_e32 v2, s9
7372 ; GFX7-NEXT: v_mov_b32_e32 v0, s8
7373 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
7374 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
7375 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
7376 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
7377 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
7378 ; GFX7-NEXT: s_waitcnt vmcnt(0)
7379 ; GFX7-NEXT: buffer_wbinvl1_vol
7380 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
7381 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
7382 ; GFX7-NEXT: flat_store_dword v[0:1], v2
7383 ; GFX7-NEXT: s_endpgm
7385 ; GFX10-WGP-LABEL: global_system_monotonic_acquire_ret_cmpxchg:
7386 ; GFX10-WGP: ; %bb.0: ; %entry
7387 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
7388 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
7389 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
7390 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
7391 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
7392 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7393 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
7394 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
7395 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
7396 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
7397 ; GFX10-WGP-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
7398 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
7399 ; GFX10-WGP-NEXT: buffer_gl1_inv
7400 ; GFX10-WGP-NEXT: buffer_gl0_inv
7401 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
7402 ; GFX10-WGP-NEXT: s_endpgm
7404 ; GFX10-CU-LABEL: global_system_monotonic_acquire_ret_cmpxchg:
7405 ; GFX10-CU: ; %bb.0: ; %entry
7406 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
7407 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
7408 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
7409 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
7410 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
7411 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7412 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
7413 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
7414 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
7415 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
7416 ; GFX10-CU-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
7417 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
7418 ; GFX10-CU-NEXT: buffer_gl1_inv
7419 ; GFX10-CU-NEXT: buffer_gl0_inv
7420 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
7421 ; GFX10-CU-NEXT: s_endpgm
7423 ; SKIP-CACHE-INV-LABEL: global_system_monotonic_acquire_ret_cmpxchg:
7424 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7425 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
7426 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
7427 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
7428 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7429 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
7430 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
7431 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
7432 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
7433 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
7434 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
7435 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
7436 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
7437 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
7438 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
7439 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
7440 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
7441 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16 glc
7442 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
7443 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
7444 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
7445 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
7446 ; SKIP-CACHE-INV-NEXT: s_endpgm
7448 ; GFX90A-NOTTGSPLIT-LABEL: global_system_monotonic_acquire_ret_cmpxchg:
7449 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7450 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
7451 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7452 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
7453 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
7454 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
7455 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7456 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
7457 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
7458 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
7459 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
7460 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
7461 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7462 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
7463 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
7464 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
7465 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7467 ; GFX90A-TGSPLIT-LABEL: global_system_monotonic_acquire_ret_cmpxchg:
7468 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7469 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
7470 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7471 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
7472 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
7473 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
7474 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7475 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
7476 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
7477 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
7478 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
7479 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
7480 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7481 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
7482 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
7483 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
7484 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7486 ; GFX940-NOTTGSPLIT-LABEL: global_system_monotonic_acquire_ret_cmpxchg:
7487 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7488 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
7489 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7490 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7491 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
7492 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
7493 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7494 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
7495 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7496 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
7497 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
7498 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
7499 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7500 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
7501 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
7502 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7504 ; GFX940-TGSPLIT-LABEL: global_system_monotonic_acquire_ret_cmpxchg:
7505 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7506 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
7507 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7508 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7509 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
7510 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
7511 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7512 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
7513 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7514 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
7515 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
7516 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
7517 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7518 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
7519 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
7520 ; GFX940-TGSPLIT-NEXT: s_endpgm
7522 ; GFX11-WGP-LABEL: global_system_monotonic_acquire_ret_cmpxchg:
7523 ; GFX11-WGP: ; %bb.0: ; %entry
7524 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
7525 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
7526 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
7527 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
7528 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
7529 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7530 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
7531 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
7532 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
7533 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
7534 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
7535 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
7536 ; GFX11-WGP-NEXT: buffer_gl1_inv
7537 ; GFX11-WGP-NEXT: buffer_gl0_inv
7538 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
7539 ; GFX11-WGP-NEXT: s_endpgm
7541 ; GFX11-CU-LABEL: global_system_monotonic_acquire_ret_cmpxchg:
7542 ; GFX11-CU: ; %bb.0: ; %entry
7543 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
7544 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
7545 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
7546 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
7547 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
7548 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7549 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
7550 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
7551 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
7552 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
7553 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
7554 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
7555 ; GFX11-CU-NEXT: buffer_gl1_inv
7556 ; GFX11-CU-NEXT: buffer_gl0_inv
7557 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
7558 ; GFX11-CU-NEXT: s_endpgm
7560 ; GFX12-WGP-LABEL: global_system_monotonic_acquire_ret_cmpxchg:
7561 ; GFX12-WGP: ; %bb.0: ; %entry
7562 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
7563 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
7564 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
7565 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
7566 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
7567 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
7568 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
7569 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
7570 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
7571 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
7572 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
7573 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
7574 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
7575 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
7576 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
7577 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
7578 ; GFX12-WGP-NEXT: s_endpgm
7580 ; GFX12-CU-LABEL: global_system_monotonic_acquire_ret_cmpxchg:
7581 ; GFX12-CU: ; %bb.0: ; %entry
7582 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
7583 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
7584 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
7585 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
7586 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
7587 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
7588 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
7589 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
7590 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
7591 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
7592 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
7593 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
7594 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
7595 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
7596 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
7597 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
7598 ; GFX12-CU-NEXT: s_endpgm
7599 ptr addrspace(1) %out, i32 %in, i32 %old) {
7601 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
7602 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in monotonic acquire
7603 %val0 = extractvalue { i32, i1 } %val, 0
7604 store i32 %val0, ptr addrspace(1) %out, align 4
7608 define amdgpu_kernel void @global_system_acquire_acquire_ret_cmpxchg(
7609 ; GFX6-LABEL: global_system_acquire_acquire_ret_cmpxchg:
7610 ; GFX6: ; %bb.0: ; %entry
7611 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
7612 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
7613 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
7614 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7615 ; GFX6-NEXT: s_mov_b32 s12, s5
7616 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
7617 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
7618 ; GFX6-NEXT: s_mov_b32 s11, -1
7619 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
7620 ; GFX6-NEXT: s_mov_b32 s5, s12
7621 ; GFX6-NEXT: s_mov_b32 s6, s11
7622 ; GFX6-NEXT: s_mov_b32 s7, s10
7623 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
7624 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
7625 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
7626 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
7627 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
7628 ; GFX6-NEXT: s_waitcnt vmcnt(0)
7629 ; GFX6-NEXT: buffer_wbinvl1
7630 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
7631 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
7632 ; GFX6-NEXT: s_endpgm
7634 ; GFX7-LABEL: global_system_acquire_acquire_ret_cmpxchg:
7635 ; GFX7: ; %bb.0: ; %entry
7636 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
7637 ; GFX7-NEXT: s_load_dword s9, s[6:7], 0x2
7638 ; GFX7-NEXT: s_load_dword s8, s[6:7], 0x3
7639 ; GFX7-NEXT: s_mov_b64 s[12:13], 16
7640 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7641 ; GFX7-NEXT: s_mov_b32 s6, s4
7642 ; GFX7-NEXT: s_mov_b32 s7, s5
7643 ; GFX7-NEXT: s_mov_b32 s11, s12
7644 ; GFX7-NEXT: s_mov_b32 s10, s13
7645 ; GFX7-NEXT: s_add_u32 s6, s6, s11
7646 ; GFX7-NEXT: s_addc_u32 s10, s7, s10
7647 ; GFX7-NEXT: ; kill: def $sgpr6 killed $sgpr6 def $sgpr6_sgpr7
7648 ; GFX7-NEXT: s_mov_b32 s7, s10
7649 ; GFX7-NEXT: v_mov_b32_e32 v2, s9
7650 ; GFX7-NEXT: v_mov_b32_e32 v0, s8
7651 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
7652 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
7653 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
7654 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
7655 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
7656 ; GFX7-NEXT: s_waitcnt vmcnt(0)
7657 ; GFX7-NEXT: buffer_wbinvl1_vol
7658 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
7659 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
7660 ; GFX7-NEXT: flat_store_dword v[0:1], v2
7661 ; GFX7-NEXT: s_endpgm
7663 ; GFX10-WGP-LABEL: global_system_acquire_acquire_ret_cmpxchg:
7664 ; GFX10-WGP: ; %bb.0: ; %entry
7665 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
7666 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
7667 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
7668 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
7669 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
7670 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7671 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
7672 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
7673 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
7674 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
7675 ; GFX10-WGP-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
7676 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
7677 ; GFX10-WGP-NEXT: buffer_gl1_inv
7678 ; GFX10-WGP-NEXT: buffer_gl0_inv
7679 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
7680 ; GFX10-WGP-NEXT: s_endpgm
7682 ; GFX10-CU-LABEL: global_system_acquire_acquire_ret_cmpxchg:
7683 ; GFX10-CU: ; %bb.0: ; %entry
7684 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
7685 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
7686 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
7687 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
7688 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
7689 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7690 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
7691 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
7692 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
7693 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
7694 ; GFX10-CU-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
7695 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
7696 ; GFX10-CU-NEXT: buffer_gl1_inv
7697 ; GFX10-CU-NEXT: buffer_gl0_inv
7698 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
7699 ; GFX10-CU-NEXT: s_endpgm
7701 ; SKIP-CACHE-INV-LABEL: global_system_acquire_acquire_ret_cmpxchg:
7702 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7703 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
7704 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
7705 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
7706 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7707 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
7708 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
7709 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
7710 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
7711 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
7712 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
7713 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
7714 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
7715 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
7716 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
7717 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
7718 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
7719 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16 glc
7720 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
7721 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
7722 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
7723 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
7724 ; SKIP-CACHE-INV-NEXT: s_endpgm
7726 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acquire_acquire_ret_cmpxchg:
7727 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7728 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
7729 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7730 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
7731 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
7732 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
7733 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7734 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
7735 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
7736 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
7737 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
7738 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
7739 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7740 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
7741 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
7742 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
7743 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7745 ; GFX90A-TGSPLIT-LABEL: global_system_acquire_acquire_ret_cmpxchg:
7746 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7747 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
7748 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7749 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
7750 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
7751 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
7752 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7753 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
7754 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
7755 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
7756 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
7757 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
7758 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7759 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
7760 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
7761 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
7762 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7764 ; GFX940-NOTTGSPLIT-LABEL: global_system_acquire_acquire_ret_cmpxchg:
7765 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7766 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
7767 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7768 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7769 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
7770 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
7771 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7772 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
7773 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7774 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
7775 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
7776 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
7777 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7778 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
7779 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
7780 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7782 ; GFX940-TGSPLIT-LABEL: global_system_acquire_acquire_ret_cmpxchg:
7783 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7784 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
7785 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7786 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7787 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
7788 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
7789 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7790 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
7791 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7792 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
7793 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
7794 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
7795 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7796 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
7797 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
7798 ; GFX940-TGSPLIT-NEXT: s_endpgm
7800 ; GFX11-WGP-LABEL: global_system_acquire_acquire_ret_cmpxchg:
7801 ; GFX11-WGP: ; %bb.0: ; %entry
7802 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
7803 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
7804 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
7805 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
7806 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
7807 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7808 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
7809 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
7810 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
7811 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
7812 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
7813 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
7814 ; GFX11-WGP-NEXT: buffer_gl1_inv
7815 ; GFX11-WGP-NEXT: buffer_gl0_inv
7816 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
7817 ; GFX11-WGP-NEXT: s_endpgm
7819 ; GFX11-CU-LABEL: global_system_acquire_acquire_ret_cmpxchg:
7820 ; GFX11-CU: ; %bb.0: ; %entry
7821 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
7822 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
7823 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
7824 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
7825 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
7826 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7827 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
7828 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
7829 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
7830 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
7831 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
7832 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
7833 ; GFX11-CU-NEXT: buffer_gl1_inv
7834 ; GFX11-CU-NEXT: buffer_gl0_inv
7835 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
7836 ; GFX11-CU-NEXT: s_endpgm
7838 ; GFX12-WGP-LABEL: global_system_acquire_acquire_ret_cmpxchg:
7839 ; GFX12-WGP: ; %bb.0: ; %entry
7840 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
7841 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
7842 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
7843 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
7844 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
7845 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
7846 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
7847 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
7848 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
7849 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
7850 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
7851 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
7852 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
7853 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
7854 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
7855 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
7856 ; GFX12-WGP-NEXT: s_endpgm
7858 ; GFX12-CU-LABEL: global_system_acquire_acquire_ret_cmpxchg:
7859 ; GFX12-CU: ; %bb.0: ; %entry
7860 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
7861 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
7862 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
7863 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
7864 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
7865 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
7866 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
7867 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
7868 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
7869 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
7870 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
7871 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
7872 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
7873 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
7874 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
7875 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
7876 ; GFX12-CU-NEXT: s_endpgm
7877 ptr addrspace(1) %out, i32 %in, i32 %old) {
7879 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
7880 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in acquire acquire
7881 %val0 = extractvalue { i32, i1 } %val, 0
7882 store i32 %val0, ptr addrspace(1) %out, align 4
7886 define amdgpu_kernel void @global_system_release_acquire_ret_cmpxchg(
7887 ; GFX6-LABEL: global_system_release_acquire_ret_cmpxchg:
7888 ; GFX6: ; %bb.0: ; %entry
7889 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
7890 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
7891 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
7892 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7893 ; GFX6-NEXT: s_mov_b32 s12, s5
7894 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
7895 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
7896 ; GFX6-NEXT: s_mov_b32 s11, -1
7897 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
7898 ; GFX6-NEXT: s_mov_b32 s5, s12
7899 ; GFX6-NEXT: s_mov_b32 s6, s11
7900 ; GFX6-NEXT: s_mov_b32 s7, s10
7901 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
7902 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
7903 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
7904 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
7905 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7906 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
7907 ; GFX6-NEXT: s_waitcnt vmcnt(0)
7908 ; GFX6-NEXT: buffer_wbinvl1
7909 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
7910 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
7911 ; GFX6-NEXT: s_endpgm
7913 ; GFX7-LABEL: global_system_release_acquire_ret_cmpxchg:
7914 ; GFX7: ; %bb.0: ; %entry
7915 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
7916 ; GFX7-NEXT: s_load_dword s9, s[6:7], 0x2
7917 ; GFX7-NEXT: s_load_dword s8, s[6:7], 0x3
7918 ; GFX7-NEXT: s_mov_b64 s[12:13], 16
7919 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7920 ; GFX7-NEXT: s_mov_b32 s6, s4
7921 ; GFX7-NEXT: s_mov_b32 s7, s5
7922 ; GFX7-NEXT: s_mov_b32 s11, s12
7923 ; GFX7-NEXT: s_mov_b32 s10, s13
7924 ; GFX7-NEXT: s_add_u32 s6, s6, s11
7925 ; GFX7-NEXT: s_addc_u32 s10, s7, s10
7926 ; GFX7-NEXT: ; kill: def $sgpr6 killed $sgpr6 def $sgpr6_sgpr7
7927 ; GFX7-NEXT: s_mov_b32 s7, s10
7928 ; GFX7-NEXT: v_mov_b32_e32 v2, s9
7929 ; GFX7-NEXT: v_mov_b32_e32 v0, s8
7930 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
7931 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
7932 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
7933 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
7934 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7935 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
7936 ; GFX7-NEXT: s_waitcnt vmcnt(0)
7937 ; GFX7-NEXT: buffer_wbinvl1_vol
7938 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
7939 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
7940 ; GFX7-NEXT: flat_store_dword v[0:1], v2
7941 ; GFX7-NEXT: s_endpgm
7943 ; GFX10-WGP-LABEL: global_system_release_acquire_ret_cmpxchg:
7944 ; GFX10-WGP: ; %bb.0: ; %entry
7945 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
7946 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
7947 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
7948 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
7949 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
7950 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7951 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
7952 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
7953 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
7954 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
7955 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7956 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
7957 ; GFX10-WGP-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
7958 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
7959 ; GFX10-WGP-NEXT: buffer_gl1_inv
7960 ; GFX10-WGP-NEXT: buffer_gl0_inv
7961 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
7962 ; GFX10-WGP-NEXT: s_endpgm
7964 ; GFX10-CU-LABEL: global_system_release_acquire_ret_cmpxchg:
7965 ; GFX10-CU: ; %bb.0: ; %entry
7966 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
7967 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
7968 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
7969 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
7970 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
7971 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7972 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
7973 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
7974 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
7975 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
7976 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7977 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
7978 ; GFX10-CU-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
7979 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
7980 ; GFX10-CU-NEXT: buffer_gl1_inv
7981 ; GFX10-CU-NEXT: buffer_gl0_inv
7982 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
7983 ; GFX10-CU-NEXT: s_endpgm
7985 ; SKIP-CACHE-INV-LABEL: global_system_release_acquire_ret_cmpxchg:
7986 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7987 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
7988 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
7989 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
7990 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7991 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
7992 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
7993 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
7994 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
7995 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
7996 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
7997 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
7998 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
7999 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
8000 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
8001 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
8002 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
8003 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8004 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16 glc
8005 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8006 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
8007 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8008 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
8009 ; SKIP-CACHE-INV-NEXT: s_endpgm
8011 ; GFX90A-NOTTGSPLIT-LABEL: global_system_release_acquire_ret_cmpxchg:
8012 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8013 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
8014 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8015 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
8016 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
8017 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
8018 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8019 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
8020 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
8021 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
8022 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
8023 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
8024 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8025 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
8026 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8027 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
8028 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
8029 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
8030 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8032 ; GFX90A-TGSPLIT-LABEL: global_system_release_acquire_ret_cmpxchg:
8033 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8034 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
8035 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8036 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
8037 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
8038 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
8039 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8040 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
8041 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
8042 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
8043 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
8044 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
8045 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8046 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
8047 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8048 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
8049 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
8050 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
8051 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8053 ; GFX940-NOTTGSPLIT-LABEL: global_system_release_acquire_ret_cmpxchg:
8054 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8055 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
8056 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8057 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8058 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
8059 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
8060 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8061 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
8062 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8063 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
8064 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
8065 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8066 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8067 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
8068 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8069 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
8070 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
8071 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8073 ; GFX940-TGSPLIT-LABEL: global_system_release_acquire_ret_cmpxchg:
8074 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8075 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
8076 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8077 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8078 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
8079 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
8080 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8081 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
8082 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8083 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
8084 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
8085 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8086 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8087 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
8088 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8089 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
8090 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
8091 ; GFX940-TGSPLIT-NEXT: s_endpgm
8093 ; GFX11-WGP-LABEL: global_system_release_acquire_ret_cmpxchg:
8094 ; GFX11-WGP: ; %bb.0: ; %entry
8095 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
8096 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
8097 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
8098 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
8099 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
8100 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8101 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
8102 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
8103 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
8104 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
8105 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8106 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8107 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
8108 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
8109 ; GFX11-WGP-NEXT: buffer_gl1_inv
8110 ; GFX11-WGP-NEXT: buffer_gl0_inv
8111 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
8112 ; GFX11-WGP-NEXT: s_endpgm
8114 ; GFX11-CU-LABEL: global_system_release_acquire_ret_cmpxchg:
8115 ; GFX11-CU: ; %bb.0: ; %entry
8116 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
8117 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
8118 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
8119 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
8120 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
8121 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8122 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
8123 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
8124 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
8125 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
8126 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8127 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
8128 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
8129 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
8130 ; GFX11-CU-NEXT: buffer_gl1_inv
8131 ; GFX11-CU-NEXT: buffer_gl0_inv
8132 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
8133 ; GFX11-CU-NEXT: s_endpgm
8135 ; GFX12-WGP-LABEL: global_system_release_acquire_ret_cmpxchg:
8136 ; GFX12-WGP: ; %bb.0: ; %entry
8137 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
8138 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
8139 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
8140 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
8141 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
8142 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
8143 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
8144 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
8145 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
8146 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
8147 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
8148 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
8149 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
8150 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
8151 ; GFX12-WGP-NEXT: s_wait_loadcnt_dscnt 0x0
8152 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
8153 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
8154 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
8155 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
8156 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
8157 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
8158 ; GFX12-WGP-NEXT: s_endpgm
8160 ; GFX12-CU-LABEL: global_system_release_acquire_ret_cmpxchg:
8161 ; GFX12-CU: ; %bb.0: ; %entry
8162 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
8163 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
8164 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
8165 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
8166 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
8167 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
8168 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
8169 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
8170 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
8171 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
8172 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
8173 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
8174 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
8175 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
8176 ; GFX12-CU-NEXT: s_wait_loadcnt_dscnt 0x0
8177 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
8178 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
8179 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
8180 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
8181 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
8182 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
8183 ; GFX12-CU-NEXT: s_endpgm
8184 ptr addrspace(1) %out, i32 %in, i32 %old) {
8186 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
8187 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in release acquire
8188 %val0 = extractvalue { i32, i1 } %val, 0
8189 store i32 %val0, ptr addrspace(1) %out, align 4
8193 define amdgpu_kernel void @global_system_acq_rel_acquire_ret_cmpxchg(
8194 ; GFX6-LABEL: global_system_acq_rel_acquire_ret_cmpxchg:
8195 ; GFX6: ; %bb.0: ; %entry
8196 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
8197 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
8198 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
8199 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8200 ; GFX6-NEXT: s_mov_b32 s12, s5
8201 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
8202 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
8203 ; GFX6-NEXT: s_mov_b32 s11, -1
8204 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
8205 ; GFX6-NEXT: s_mov_b32 s5, s12
8206 ; GFX6-NEXT: s_mov_b32 s6, s11
8207 ; GFX6-NEXT: s_mov_b32 s7, s10
8208 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
8209 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
8210 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
8211 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
8212 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8213 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
8214 ; GFX6-NEXT: s_waitcnt vmcnt(0)
8215 ; GFX6-NEXT: buffer_wbinvl1
8216 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
8217 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
8218 ; GFX6-NEXT: s_endpgm
8220 ; GFX7-LABEL: global_system_acq_rel_acquire_ret_cmpxchg:
8221 ; GFX7: ; %bb.0: ; %entry
8222 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
8223 ; GFX7-NEXT: s_load_dword s9, s[6:7], 0x2
8224 ; GFX7-NEXT: s_load_dword s8, s[6:7], 0x3
8225 ; GFX7-NEXT: s_mov_b64 s[12:13], 16
8226 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8227 ; GFX7-NEXT: s_mov_b32 s6, s4
8228 ; GFX7-NEXT: s_mov_b32 s7, s5
8229 ; GFX7-NEXT: s_mov_b32 s11, s12
8230 ; GFX7-NEXT: s_mov_b32 s10, s13
8231 ; GFX7-NEXT: s_add_u32 s6, s6, s11
8232 ; GFX7-NEXT: s_addc_u32 s10, s7, s10
8233 ; GFX7-NEXT: ; kill: def $sgpr6 killed $sgpr6 def $sgpr6_sgpr7
8234 ; GFX7-NEXT: s_mov_b32 s7, s10
8235 ; GFX7-NEXT: v_mov_b32_e32 v2, s9
8236 ; GFX7-NEXT: v_mov_b32_e32 v0, s8
8237 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
8238 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
8239 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
8240 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
8241 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8242 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
8243 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8244 ; GFX7-NEXT: buffer_wbinvl1_vol
8245 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
8246 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
8247 ; GFX7-NEXT: flat_store_dword v[0:1], v2
8248 ; GFX7-NEXT: s_endpgm
8250 ; GFX10-WGP-LABEL: global_system_acq_rel_acquire_ret_cmpxchg:
8251 ; GFX10-WGP: ; %bb.0: ; %entry
8252 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
8253 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
8254 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
8255 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
8256 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
8257 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8258 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
8259 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
8260 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
8261 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
8262 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8263 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8264 ; GFX10-WGP-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
8265 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
8266 ; GFX10-WGP-NEXT: buffer_gl1_inv
8267 ; GFX10-WGP-NEXT: buffer_gl0_inv
8268 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
8269 ; GFX10-WGP-NEXT: s_endpgm
8271 ; GFX10-CU-LABEL: global_system_acq_rel_acquire_ret_cmpxchg:
8272 ; GFX10-CU: ; %bb.0: ; %entry
8273 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
8274 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
8275 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
8276 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
8277 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
8278 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8279 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
8280 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
8281 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
8282 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
8283 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8284 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
8285 ; GFX10-CU-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
8286 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
8287 ; GFX10-CU-NEXT: buffer_gl1_inv
8288 ; GFX10-CU-NEXT: buffer_gl0_inv
8289 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
8290 ; GFX10-CU-NEXT: s_endpgm
8292 ; SKIP-CACHE-INV-LABEL: global_system_acq_rel_acquire_ret_cmpxchg:
8293 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8294 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
8295 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
8296 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
8297 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8298 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
8299 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
8300 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
8301 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
8302 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
8303 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
8304 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
8305 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
8306 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
8307 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
8308 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
8309 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
8310 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8311 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16 glc
8312 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8313 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
8314 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8315 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
8316 ; SKIP-CACHE-INV-NEXT: s_endpgm
8318 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acq_rel_acquire_ret_cmpxchg:
8319 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8320 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
8321 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8322 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
8323 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
8324 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
8325 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8326 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
8327 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
8328 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
8329 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
8330 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
8331 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8332 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
8333 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8334 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
8335 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
8336 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
8337 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8339 ; GFX90A-TGSPLIT-LABEL: global_system_acq_rel_acquire_ret_cmpxchg:
8340 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8341 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
8342 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8343 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
8344 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
8345 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
8346 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8347 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
8348 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
8349 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
8350 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
8351 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
8352 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8353 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
8354 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8355 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
8356 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
8357 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
8358 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8360 ; GFX940-NOTTGSPLIT-LABEL: global_system_acq_rel_acquire_ret_cmpxchg:
8361 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8362 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
8363 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8364 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8365 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
8366 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
8367 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8368 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
8369 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8370 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
8371 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
8372 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8373 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8374 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
8375 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8376 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
8377 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
8378 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8380 ; GFX940-TGSPLIT-LABEL: global_system_acq_rel_acquire_ret_cmpxchg:
8381 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8382 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
8383 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8384 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8385 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
8386 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
8387 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8388 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
8389 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8390 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
8391 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
8392 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8393 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8394 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
8395 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8396 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
8397 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
8398 ; GFX940-TGSPLIT-NEXT: s_endpgm
8400 ; GFX11-WGP-LABEL: global_system_acq_rel_acquire_ret_cmpxchg:
8401 ; GFX11-WGP: ; %bb.0: ; %entry
8402 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
8403 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
8404 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
8405 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
8406 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
8407 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8408 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
8409 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
8410 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
8411 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
8412 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8413 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8414 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
8415 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
8416 ; GFX11-WGP-NEXT: buffer_gl1_inv
8417 ; GFX11-WGP-NEXT: buffer_gl0_inv
8418 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
8419 ; GFX11-WGP-NEXT: s_endpgm
8421 ; GFX11-CU-LABEL: global_system_acq_rel_acquire_ret_cmpxchg:
8422 ; GFX11-CU: ; %bb.0: ; %entry
8423 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
8424 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
8425 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
8426 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
8427 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
8428 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8429 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
8430 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
8431 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
8432 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
8433 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8434 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
8435 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
8436 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
8437 ; GFX11-CU-NEXT: buffer_gl1_inv
8438 ; GFX11-CU-NEXT: buffer_gl0_inv
8439 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
8440 ; GFX11-CU-NEXT: s_endpgm
8442 ; GFX12-WGP-LABEL: global_system_acq_rel_acquire_ret_cmpxchg:
8443 ; GFX12-WGP: ; %bb.0: ; %entry
8444 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
8445 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
8446 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
8447 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
8448 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
8449 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
8450 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
8451 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
8452 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
8453 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
8454 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
8455 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
8456 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
8457 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
8458 ; GFX12-WGP-NEXT: s_wait_loadcnt_dscnt 0x0
8459 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
8460 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
8461 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
8462 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
8463 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
8464 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
8465 ; GFX12-WGP-NEXT: s_endpgm
8467 ; GFX12-CU-LABEL: global_system_acq_rel_acquire_ret_cmpxchg:
8468 ; GFX12-CU: ; %bb.0: ; %entry
8469 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
8470 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
8471 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
8472 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
8473 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
8474 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
8475 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
8476 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
8477 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
8478 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
8479 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
8480 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
8481 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
8482 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
8483 ; GFX12-CU-NEXT: s_wait_loadcnt_dscnt 0x0
8484 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
8485 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
8486 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
8487 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
8488 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
8489 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
8490 ; GFX12-CU-NEXT: s_endpgm
8491 ptr addrspace(1) %out, i32 %in, i32 %old) {
8493 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
8494 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in acq_rel acquire
8495 %val0 = extractvalue { i32, i1 } %val, 0
8496 store i32 %val0, ptr addrspace(1) %out, align 4
8500 define amdgpu_kernel void @global_system_seq_cst_acquire_ret_cmpxchg(
8501 ; GFX6-LABEL: global_system_seq_cst_acquire_ret_cmpxchg:
8502 ; GFX6: ; %bb.0: ; %entry
8503 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
8504 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
8505 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
8506 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8507 ; GFX6-NEXT: s_mov_b32 s12, s5
8508 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
8509 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
8510 ; GFX6-NEXT: s_mov_b32 s11, -1
8511 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
8512 ; GFX6-NEXT: s_mov_b32 s5, s12
8513 ; GFX6-NEXT: s_mov_b32 s6, s11
8514 ; GFX6-NEXT: s_mov_b32 s7, s10
8515 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
8516 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
8517 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
8518 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
8519 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8520 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
8521 ; GFX6-NEXT: s_waitcnt vmcnt(0)
8522 ; GFX6-NEXT: buffer_wbinvl1
8523 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
8524 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
8525 ; GFX6-NEXT: s_endpgm
8527 ; GFX7-LABEL: global_system_seq_cst_acquire_ret_cmpxchg:
8528 ; GFX7: ; %bb.0: ; %entry
8529 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
8530 ; GFX7-NEXT: s_load_dword s9, s[6:7], 0x2
8531 ; GFX7-NEXT: s_load_dword s8, s[6:7], 0x3
8532 ; GFX7-NEXT: s_mov_b64 s[12:13], 16
8533 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8534 ; GFX7-NEXT: s_mov_b32 s6, s4
8535 ; GFX7-NEXT: s_mov_b32 s7, s5
8536 ; GFX7-NEXT: s_mov_b32 s11, s12
8537 ; GFX7-NEXT: s_mov_b32 s10, s13
8538 ; GFX7-NEXT: s_add_u32 s6, s6, s11
8539 ; GFX7-NEXT: s_addc_u32 s10, s7, s10
8540 ; GFX7-NEXT: ; kill: def $sgpr6 killed $sgpr6 def $sgpr6_sgpr7
8541 ; GFX7-NEXT: s_mov_b32 s7, s10
8542 ; GFX7-NEXT: v_mov_b32_e32 v2, s9
8543 ; GFX7-NEXT: v_mov_b32_e32 v0, s8
8544 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
8545 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
8546 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
8547 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
8548 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8549 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
8550 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8551 ; GFX7-NEXT: buffer_wbinvl1_vol
8552 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
8553 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
8554 ; GFX7-NEXT: flat_store_dword v[0:1], v2
8555 ; GFX7-NEXT: s_endpgm
8557 ; GFX10-WGP-LABEL: global_system_seq_cst_acquire_ret_cmpxchg:
8558 ; GFX10-WGP: ; %bb.0: ; %entry
8559 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
8560 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
8561 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
8562 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
8563 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
8564 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8565 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
8566 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
8567 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
8568 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
8569 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8570 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8571 ; GFX10-WGP-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
8572 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
8573 ; GFX10-WGP-NEXT: buffer_gl1_inv
8574 ; GFX10-WGP-NEXT: buffer_gl0_inv
8575 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
8576 ; GFX10-WGP-NEXT: s_endpgm
8578 ; GFX10-CU-LABEL: global_system_seq_cst_acquire_ret_cmpxchg:
8579 ; GFX10-CU: ; %bb.0: ; %entry
8580 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
8581 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
8582 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
8583 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
8584 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
8585 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8586 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
8587 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
8588 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
8589 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
8590 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8591 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
8592 ; GFX10-CU-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
8593 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
8594 ; GFX10-CU-NEXT: buffer_gl1_inv
8595 ; GFX10-CU-NEXT: buffer_gl0_inv
8596 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
8597 ; GFX10-CU-NEXT: s_endpgm
8599 ; SKIP-CACHE-INV-LABEL: global_system_seq_cst_acquire_ret_cmpxchg:
8600 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8601 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
8602 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
8603 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
8604 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8605 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
8606 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
8607 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
8608 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
8609 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
8610 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
8611 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
8612 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
8613 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
8614 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
8615 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
8616 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
8617 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8618 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16 glc
8619 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8620 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
8621 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8622 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
8623 ; SKIP-CACHE-INV-NEXT: s_endpgm
8625 ; GFX90A-NOTTGSPLIT-LABEL: global_system_seq_cst_acquire_ret_cmpxchg:
8626 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8627 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
8628 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8629 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
8630 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
8631 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
8632 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8633 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
8634 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
8635 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
8636 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
8637 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
8638 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8639 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
8640 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8641 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
8642 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
8643 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
8644 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8646 ; GFX90A-TGSPLIT-LABEL: global_system_seq_cst_acquire_ret_cmpxchg:
8647 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8648 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
8649 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8650 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
8651 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
8652 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
8653 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8654 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
8655 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
8656 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
8657 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
8658 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
8659 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8660 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
8661 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8662 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
8663 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
8664 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
8665 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8667 ; GFX940-NOTTGSPLIT-LABEL: global_system_seq_cst_acquire_ret_cmpxchg:
8668 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8669 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
8670 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8671 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8672 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
8673 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
8674 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8675 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
8676 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8677 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
8678 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
8679 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8680 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8681 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
8682 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8683 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
8684 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
8685 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8687 ; GFX940-TGSPLIT-LABEL: global_system_seq_cst_acquire_ret_cmpxchg:
8688 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8689 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
8690 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8691 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8692 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
8693 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
8694 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8695 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
8696 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8697 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
8698 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
8699 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8700 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8701 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
8702 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8703 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
8704 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
8705 ; GFX940-TGSPLIT-NEXT: s_endpgm
8707 ; GFX11-WGP-LABEL: global_system_seq_cst_acquire_ret_cmpxchg:
8708 ; GFX11-WGP: ; %bb.0: ; %entry
8709 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
8710 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
8711 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
8712 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
8713 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
8714 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8715 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
8716 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
8717 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
8718 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
8719 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8720 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8721 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
8722 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
8723 ; GFX11-WGP-NEXT: buffer_gl1_inv
8724 ; GFX11-WGP-NEXT: buffer_gl0_inv
8725 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
8726 ; GFX11-WGP-NEXT: s_endpgm
8728 ; GFX11-CU-LABEL: global_system_seq_cst_acquire_ret_cmpxchg:
8729 ; GFX11-CU: ; %bb.0: ; %entry
8730 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
8731 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
8732 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
8733 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
8734 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
8735 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8736 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
8737 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
8738 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
8739 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
8740 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8741 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
8742 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
8743 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
8744 ; GFX11-CU-NEXT: buffer_gl1_inv
8745 ; GFX11-CU-NEXT: buffer_gl0_inv
8746 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
8747 ; GFX11-CU-NEXT: s_endpgm
8749 ; GFX12-WGP-LABEL: global_system_seq_cst_acquire_ret_cmpxchg:
8750 ; GFX12-WGP: ; %bb.0: ; %entry
8751 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
8752 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
8753 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
8754 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
8755 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
8756 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
8757 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
8758 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
8759 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
8760 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
8761 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
8762 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
8763 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
8764 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
8765 ; GFX12-WGP-NEXT: s_wait_loadcnt_dscnt 0x0
8766 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
8767 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
8768 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
8769 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
8770 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
8771 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
8772 ; GFX12-WGP-NEXT: s_endpgm
8774 ; GFX12-CU-LABEL: global_system_seq_cst_acquire_ret_cmpxchg:
8775 ; GFX12-CU: ; %bb.0: ; %entry
8776 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
8777 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
8778 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
8779 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
8780 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
8781 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
8782 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
8783 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
8784 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
8785 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
8786 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
8787 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
8788 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
8789 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
8790 ; GFX12-CU-NEXT: s_wait_loadcnt_dscnt 0x0
8791 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
8792 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
8793 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
8794 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
8795 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
8796 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
8797 ; GFX12-CU-NEXT: s_endpgm
8798 ptr addrspace(1) %out, i32 %in, i32 %old) {
8800 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
8801 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in seq_cst acquire
8802 %val0 = extractvalue { i32, i1 } %val, 0
8803 store i32 %val0, ptr addrspace(1) %out, align 4
8807 define amdgpu_kernel void @global_system_monotonic_seq_cst_ret_cmpxchg(
8808 ; GFX6-LABEL: global_system_monotonic_seq_cst_ret_cmpxchg:
8809 ; GFX6: ; %bb.0: ; %entry
8810 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
8811 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
8812 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
8813 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8814 ; GFX6-NEXT: s_mov_b32 s12, s5
8815 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
8816 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
8817 ; GFX6-NEXT: s_mov_b32 s11, -1
8818 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
8819 ; GFX6-NEXT: s_mov_b32 s5, s12
8820 ; GFX6-NEXT: s_mov_b32 s6, s11
8821 ; GFX6-NEXT: s_mov_b32 s7, s10
8822 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
8823 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
8824 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
8825 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
8826 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8827 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
8828 ; GFX6-NEXT: s_waitcnt vmcnt(0)
8829 ; GFX6-NEXT: buffer_wbinvl1
8830 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
8831 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
8832 ; GFX6-NEXT: s_endpgm
8834 ; GFX7-LABEL: global_system_monotonic_seq_cst_ret_cmpxchg:
8835 ; GFX7: ; %bb.0: ; %entry
8836 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
8837 ; GFX7-NEXT: s_load_dword s9, s[6:7], 0x2
8838 ; GFX7-NEXT: s_load_dword s8, s[6:7], 0x3
8839 ; GFX7-NEXT: s_mov_b64 s[12:13], 16
8840 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8841 ; GFX7-NEXT: s_mov_b32 s6, s4
8842 ; GFX7-NEXT: s_mov_b32 s7, s5
8843 ; GFX7-NEXT: s_mov_b32 s11, s12
8844 ; GFX7-NEXT: s_mov_b32 s10, s13
8845 ; GFX7-NEXT: s_add_u32 s6, s6, s11
8846 ; GFX7-NEXT: s_addc_u32 s10, s7, s10
8847 ; GFX7-NEXT: ; kill: def $sgpr6 killed $sgpr6 def $sgpr6_sgpr7
8848 ; GFX7-NEXT: s_mov_b32 s7, s10
8849 ; GFX7-NEXT: v_mov_b32_e32 v2, s9
8850 ; GFX7-NEXT: v_mov_b32_e32 v0, s8
8851 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
8852 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
8853 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
8854 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
8855 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8856 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
8857 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8858 ; GFX7-NEXT: buffer_wbinvl1_vol
8859 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
8860 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
8861 ; GFX7-NEXT: flat_store_dword v[0:1], v2
8862 ; GFX7-NEXT: s_endpgm
8864 ; GFX10-WGP-LABEL: global_system_monotonic_seq_cst_ret_cmpxchg:
8865 ; GFX10-WGP: ; %bb.0: ; %entry
8866 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
8867 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
8868 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
8869 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
8870 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
8871 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8872 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
8873 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
8874 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
8875 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
8876 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8877 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8878 ; GFX10-WGP-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
8879 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
8880 ; GFX10-WGP-NEXT: buffer_gl1_inv
8881 ; GFX10-WGP-NEXT: buffer_gl0_inv
8882 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
8883 ; GFX10-WGP-NEXT: s_endpgm
8885 ; GFX10-CU-LABEL: global_system_monotonic_seq_cst_ret_cmpxchg:
8886 ; GFX10-CU: ; %bb.0: ; %entry
8887 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
8888 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
8889 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
8890 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
8891 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
8892 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8893 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
8894 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
8895 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
8896 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
8897 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8898 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
8899 ; GFX10-CU-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
8900 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
8901 ; GFX10-CU-NEXT: buffer_gl1_inv
8902 ; GFX10-CU-NEXT: buffer_gl0_inv
8903 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
8904 ; GFX10-CU-NEXT: s_endpgm
8906 ; SKIP-CACHE-INV-LABEL: global_system_monotonic_seq_cst_ret_cmpxchg:
8907 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8908 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
8909 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
8910 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
8911 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8912 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
8913 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
8914 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
8915 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
8916 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
8917 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
8918 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
8919 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
8920 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
8921 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
8922 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
8923 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
8924 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8925 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16 glc
8926 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8927 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
8928 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8929 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
8930 ; SKIP-CACHE-INV-NEXT: s_endpgm
8932 ; GFX90A-NOTTGSPLIT-LABEL: global_system_monotonic_seq_cst_ret_cmpxchg:
8933 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8934 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
8935 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8936 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
8937 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
8938 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
8939 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8940 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
8941 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
8942 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
8943 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
8944 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
8945 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8946 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
8947 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8948 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
8949 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
8950 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
8951 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8953 ; GFX90A-TGSPLIT-LABEL: global_system_monotonic_seq_cst_ret_cmpxchg:
8954 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8955 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
8956 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8957 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
8958 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
8959 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
8960 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8961 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
8962 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
8963 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
8964 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
8965 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
8966 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8967 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
8968 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8969 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
8970 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
8971 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
8972 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8974 ; GFX940-NOTTGSPLIT-LABEL: global_system_monotonic_seq_cst_ret_cmpxchg:
8975 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8976 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
8977 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8978 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8979 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
8980 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
8981 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8982 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
8983 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8984 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
8985 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
8986 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8987 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8988 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
8989 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8990 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
8991 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
8992 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8994 ; GFX940-TGSPLIT-LABEL: global_system_monotonic_seq_cst_ret_cmpxchg:
8995 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8996 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
8997 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8998 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8999 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
9000 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
9001 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9002 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
9003 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9004 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
9005 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
9006 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
9007 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9008 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
9009 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9010 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
9011 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
9012 ; GFX940-TGSPLIT-NEXT: s_endpgm
9014 ; GFX11-WGP-LABEL: global_system_monotonic_seq_cst_ret_cmpxchg:
9015 ; GFX11-WGP: ; %bb.0: ; %entry
9016 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
9017 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
9018 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
9019 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
9020 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
9021 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9022 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
9023 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
9024 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
9025 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
9026 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9027 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9028 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
9029 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
9030 ; GFX11-WGP-NEXT: buffer_gl1_inv
9031 ; GFX11-WGP-NEXT: buffer_gl0_inv
9032 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
9033 ; GFX11-WGP-NEXT: s_endpgm
9035 ; GFX11-CU-LABEL: global_system_monotonic_seq_cst_ret_cmpxchg:
9036 ; GFX11-CU: ; %bb.0: ; %entry
9037 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
9038 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
9039 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
9040 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
9041 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
9042 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9043 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
9044 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
9045 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
9046 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
9047 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9048 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
9049 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
9050 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
9051 ; GFX11-CU-NEXT: buffer_gl1_inv
9052 ; GFX11-CU-NEXT: buffer_gl0_inv
9053 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
9054 ; GFX11-CU-NEXT: s_endpgm
9056 ; GFX12-WGP-LABEL: global_system_monotonic_seq_cst_ret_cmpxchg:
9057 ; GFX12-WGP: ; %bb.0: ; %entry
9058 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
9059 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
9060 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
9061 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
9062 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
9063 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
9064 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
9065 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
9066 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
9067 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
9068 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
9069 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
9070 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
9071 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
9072 ; GFX12-WGP-NEXT: s_wait_loadcnt_dscnt 0x0
9073 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
9074 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
9075 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
9076 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
9077 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
9078 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
9079 ; GFX12-WGP-NEXT: s_endpgm
9081 ; GFX12-CU-LABEL: global_system_monotonic_seq_cst_ret_cmpxchg:
9082 ; GFX12-CU: ; %bb.0: ; %entry
9083 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
9084 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
9085 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
9086 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
9087 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
9088 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
9089 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
9090 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
9091 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
9092 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
9093 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
9094 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
9095 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
9096 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
9097 ; GFX12-CU-NEXT: s_wait_loadcnt_dscnt 0x0
9098 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
9099 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
9100 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
9101 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
9102 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
9103 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
9104 ; GFX12-CU-NEXT: s_endpgm
9105 ptr addrspace(1) %out, i32 %in, i32 %old) {
9107 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
9108 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in monotonic seq_cst
9109 %val0 = extractvalue { i32, i1 } %val, 0
9110 store i32 %val0, ptr addrspace(1) %out, align 4
9114 define amdgpu_kernel void @global_system_acquire_seq_cst_ret_cmpxchg(
9115 ; GFX6-LABEL: global_system_acquire_seq_cst_ret_cmpxchg:
9116 ; GFX6: ; %bb.0: ; %entry
9117 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
9118 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
9119 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
9120 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9121 ; GFX6-NEXT: s_mov_b32 s12, s5
9122 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
9123 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
9124 ; GFX6-NEXT: s_mov_b32 s11, -1
9125 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
9126 ; GFX6-NEXT: s_mov_b32 s5, s12
9127 ; GFX6-NEXT: s_mov_b32 s6, s11
9128 ; GFX6-NEXT: s_mov_b32 s7, s10
9129 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
9130 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
9131 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
9132 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
9133 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9134 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
9135 ; GFX6-NEXT: s_waitcnt vmcnt(0)
9136 ; GFX6-NEXT: buffer_wbinvl1
9137 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
9138 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
9139 ; GFX6-NEXT: s_endpgm
9141 ; GFX7-LABEL: global_system_acquire_seq_cst_ret_cmpxchg:
9142 ; GFX7: ; %bb.0: ; %entry
9143 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
9144 ; GFX7-NEXT: s_load_dword s9, s[6:7], 0x2
9145 ; GFX7-NEXT: s_load_dword s8, s[6:7], 0x3
9146 ; GFX7-NEXT: s_mov_b64 s[12:13], 16
9147 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9148 ; GFX7-NEXT: s_mov_b32 s6, s4
9149 ; GFX7-NEXT: s_mov_b32 s7, s5
9150 ; GFX7-NEXT: s_mov_b32 s11, s12
9151 ; GFX7-NEXT: s_mov_b32 s10, s13
9152 ; GFX7-NEXT: s_add_u32 s6, s6, s11
9153 ; GFX7-NEXT: s_addc_u32 s10, s7, s10
9154 ; GFX7-NEXT: ; kill: def $sgpr6 killed $sgpr6 def $sgpr6_sgpr7
9155 ; GFX7-NEXT: s_mov_b32 s7, s10
9156 ; GFX7-NEXT: v_mov_b32_e32 v2, s9
9157 ; GFX7-NEXT: v_mov_b32_e32 v0, s8
9158 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
9159 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
9160 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
9161 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
9162 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9163 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
9164 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9165 ; GFX7-NEXT: buffer_wbinvl1_vol
9166 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
9167 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
9168 ; GFX7-NEXT: flat_store_dword v[0:1], v2
9169 ; GFX7-NEXT: s_endpgm
9171 ; GFX10-WGP-LABEL: global_system_acquire_seq_cst_ret_cmpxchg:
9172 ; GFX10-WGP: ; %bb.0: ; %entry
9173 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
9174 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
9175 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
9176 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
9177 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
9178 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9179 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
9180 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
9181 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
9182 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
9183 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9184 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9185 ; GFX10-WGP-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
9186 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
9187 ; GFX10-WGP-NEXT: buffer_gl1_inv
9188 ; GFX10-WGP-NEXT: buffer_gl0_inv
9189 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
9190 ; GFX10-WGP-NEXT: s_endpgm
9192 ; GFX10-CU-LABEL: global_system_acquire_seq_cst_ret_cmpxchg:
9193 ; GFX10-CU: ; %bb.0: ; %entry
9194 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
9195 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
9196 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
9197 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
9198 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
9199 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9200 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
9201 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
9202 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
9203 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
9204 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9205 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
9206 ; GFX10-CU-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
9207 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
9208 ; GFX10-CU-NEXT: buffer_gl1_inv
9209 ; GFX10-CU-NEXT: buffer_gl0_inv
9210 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
9211 ; GFX10-CU-NEXT: s_endpgm
9213 ; SKIP-CACHE-INV-LABEL: global_system_acquire_seq_cst_ret_cmpxchg:
9214 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9215 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
9216 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
9217 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
9218 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9219 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
9220 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
9221 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
9222 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
9223 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
9224 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
9225 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
9226 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
9227 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
9228 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
9229 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
9230 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
9231 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9232 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16 glc
9233 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
9234 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
9235 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
9236 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
9237 ; SKIP-CACHE-INV-NEXT: s_endpgm
9239 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acquire_seq_cst_ret_cmpxchg:
9240 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9241 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
9242 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
9243 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
9244 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
9245 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
9246 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9247 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
9248 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
9249 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
9250 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
9251 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
9252 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9253 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
9254 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9255 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
9256 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
9257 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
9258 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9260 ; GFX90A-TGSPLIT-LABEL: global_system_acquire_seq_cst_ret_cmpxchg:
9261 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9262 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
9263 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
9264 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
9265 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
9266 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
9267 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9268 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
9269 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
9270 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
9271 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
9272 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
9273 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9274 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
9275 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9276 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
9277 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
9278 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
9279 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9281 ; GFX940-NOTTGSPLIT-LABEL: global_system_acquire_seq_cst_ret_cmpxchg:
9282 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9283 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
9284 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
9285 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
9286 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
9287 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
9288 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9289 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
9290 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9291 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
9292 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
9293 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
9294 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9295 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
9296 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9297 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
9298 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
9299 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9301 ; GFX940-TGSPLIT-LABEL: global_system_acquire_seq_cst_ret_cmpxchg:
9302 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9303 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
9304 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
9305 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
9306 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
9307 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
9308 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9309 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
9310 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9311 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
9312 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
9313 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
9314 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9315 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
9316 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9317 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
9318 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
9319 ; GFX940-TGSPLIT-NEXT: s_endpgm
9321 ; GFX11-WGP-LABEL: global_system_acquire_seq_cst_ret_cmpxchg:
9322 ; GFX11-WGP: ; %bb.0: ; %entry
9323 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
9324 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
9325 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
9326 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
9327 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
9328 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9329 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
9330 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
9331 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
9332 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
9333 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9334 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9335 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
9336 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
9337 ; GFX11-WGP-NEXT: buffer_gl1_inv
9338 ; GFX11-WGP-NEXT: buffer_gl0_inv
9339 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
9340 ; GFX11-WGP-NEXT: s_endpgm
9342 ; GFX11-CU-LABEL: global_system_acquire_seq_cst_ret_cmpxchg:
9343 ; GFX11-CU: ; %bb.0: ; %entry
9344 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
9345 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
9346 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
9347 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
9348 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
9349 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9350 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
9351 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
9352 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
9353 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
9354 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9355 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
9356 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
9357 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
9358 ; GFX11-CU-NEXT: buffer_gl1_inv
9359 ; GFX11-CU-NEXT: buffer_gl0_inv
9360 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
9361 ; GFX11-CU-NEXT: s_endpgm
9363 ; GFX12-WGP-LABEL: global_system_acquire_seq_cst_ret_cmpxchg:
9364 ; GFX12-WGP: ; %bb.0: ; %entry
9365 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
9366 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
9367 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
9368 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
9369 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
9370 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
9371 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
9372 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
9373 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
9374 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
9375 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
9376 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
9377 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
9378 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
9379 ; GFX12-WGP-NEXT: s_wait_loadcnt_dscnt 0x0
9380 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
9381 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
9382 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
9383 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
9384 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
9385 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
9386 ; GFX12-WGP-NEXT: s_endpgm
9388 ; GFX12-CU-LABEL: global_system_acquire_seq_cst_ret_cmpxchg:
9389 ; GFX12-CU: ; %bb.0: ; %entry
9390 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
9391 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
9392 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
9393 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
9394 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
9395 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
9396 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
9397 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
9398 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
9399 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
9400 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
9401 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
9402 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
9403 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
9404 ; GFX12-CU-NEXT: s_wait_loadcnt_dscnt 0x0
9405 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
9406 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
9407 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
9408 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
9409 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
9410 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
9411 ; GFX12-CU-NEXT: s_endpgm
9412 ptr addrspace(1) %out, i32 %in, i32 %old) {
9414 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
9415 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in acquire seq_cst
9416 %val0 = extractvalue { i32, i1 } %val, 0
9417 store i32 %val0, ptr addrspace(1) %out, align 4
9421 define amdgpu_kernel void @global_system_relese_seq_cst_ret_cmpxchg(
9422 ; GFX6-LABEL: global_system_relese_seq_cst_ret_cmpxchg:
9423 ; GFX6: ; %bb.0: ; %entry
9424 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
9425 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
9426 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
9427 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9428 ; GFX6-NEXT: s_mov_b32 s12, s5
9429 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
9430 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
9431 ; GFX6-NEXT: s_mov_b32 s11, -1
9432 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
9433 ; GFX6-NEXT: s_mov_b32 s5, s12
9434 ; GFX6-NEXT: s_mov_b32 s6, s11
9435 ; GFX6-NEXT: s_mov_b32 s7, s10
9436 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
9437 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
9438 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
9439 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
9440 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9441 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
9442 ; GFX6-NEXT: s_waitcnt vmcnt(0)
9443 ; GFX6-NEXT: buffer_wbinvl1
9444 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
9445 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
9446 ; GFX6-NEXT: s_endpgm
9448 ; GFX7-LABEL: global_system_relese_seq_cst_ret_cmpxchg:
9449 ; GFX7: ; %bb.0: ; %entry
9450 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
9451 ; GFX7-NEXT: s_load_dword s9, s[6:7], 0x2
9452 ; GFX7-NEXT: s_load_dword s8, s[6:7], 0x3
9453 ; GFX7-NEXT: s_mov_b64 s[12:13], 16
9454 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9455 ; GFX7-NEXT: s_mov_b32 s6, s4
9456 ; GFX7-NEXT: s_mov_b32 s7, s5
9457 ; GFX7-NEXT: s_mov_b32 s11, s12
9458 ; GFX7-NEXT: s_mov_b32 s10, s13
9459 ; GFX7-NEXT: s_add_u32 s6, s6, s11
9460 ; GFX7-NEXT: s_addc_u32 s10, s7, s10
9461 ; GFX7-NEXT: ; kill: def $sgpr6 killed $sgpr6 def $sgpr6_sgpr7
9462 ; GFX7-NEXT: s_mov_b32 s7, s10
9463 ; GFX7-NEXT: v_mov_b32_e32 v2, s9
9464 ; GFX7-NEXT: v_mov_b32_e32 v0, s8
9465 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
9466 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
9467 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
9468 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
9469 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9470 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
9471 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9472 ; GFX7-NEXT: buffer_wbinvl1_vol
9473 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
9474 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
9475 ; GFX7-NEXT: flat_store_dword v[0:1], v2
9476 ; GFX7-NEXT: s_endpgm
9478 ; GFX10-WGP-LABEL: global_system_relese_seq_cst_ret_cmpxchg:
9479 ; GFX10-WGP: ; %bb.0: ; %entry
9480 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
9481 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
9482 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
9483 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
9484 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
9485 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9486 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
9487 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
9488 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
9489 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
9490 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9491 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9492 ; GFX10-WGP-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
9493 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
9494 ; GFX10-WGP-NEXT: buffer_gl1_inv
9495 ; GFX10-WGP-NEXT: buffer_gl0_inv
9496 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
9497 ; GFX10-WGP-NEXT: s_endpgm
9499 ; GFX10-CU-LABEL: global_system_relese_seq_cst_ret_cmpxchg:
9500 ; GFX10-CU: ; %bb.0: ; %entry
9501 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
9502 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
9503 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
9504 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
9505 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
9506 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9507 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
9508 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
9509 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
9510 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
9511 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9512 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
9513 ; GFX10-CU-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
9514 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
9515 ; GFX10-CU-NEXT: buffer_gl1_inv
9516 ; GFX10-CU-NEXT: buffer_gl0_inv
9517 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
9518 ; GFX10-CU-NEXT: s_endpgm
9520 ; SKIP-CACHE-INV-LABEL: global_system_relese_seq_cst_ret_cmpxchg:
9521 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9522 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
9523 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
9524 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
9525 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9526 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
9527 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
9528 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
9529 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
9530 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
9531 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
9532 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
9533 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
9534 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
9535 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
9536 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
9537 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
9538 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9539 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16 glc
9540 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
9541 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
9542 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
9543 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
9544 ; SKIP-CACHE-INV-NEXT: s_endpgm
9546 ; GFX90A-NOTTGSPLIT-LABEL: global_system_relese_seq_cst_ret_cmpxchg:
9547 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9548 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
9549 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
9550 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
9551 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
9552 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
9553 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9554 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
9555 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
9556 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
9557 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
9558 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
9559 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9560 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
9561 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9562 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
9563 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
9564 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
9565 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9567 ; GFX90A-TGSPLIT-LABEL: global_system_relese_seq_cst_ret_cmpxchg:
9568 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9569 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
9570 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
9571 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
9572 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
9573 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
9574 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9575 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
9576 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
9577 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
9578 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
9579 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
9580 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9581 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
9582 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9583 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
9584 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
9585 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
9586 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9588 ; GFX940-NOTTGSPLIT-LABEL: global_system_relese_seq_cst_ret_cmpxchg:
9589 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9590 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
9591 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
9592 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
9593 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
9594 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
9595 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9596 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
9597 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9598 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
9599 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
9600 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
9601 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9602 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
9603 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9604 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
9605 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
9606 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9608 ; GFX940-TGSPLIT-LABEL: global_system_relese_seq_cst_ret_cmpxchg:
9609 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9610 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
9611 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
9612 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
9613 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
9614 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
9615 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9616 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
9617 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9618 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
9619 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
9620 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
9621 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9622 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
9623 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9624 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
9625 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
9626 ; GFX940-TGSPLIT-NEXT: s_endpgm
9628 ; GFX11-WGP-LABEL: global_system_relese_seq_cst_ret_cmpxchg:
9629 ; GFX11-WGP: ; %bb.0: ; %entry
9630 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
9631 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
9632 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
9633 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
9634 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
9635 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9636 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
9637 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
9638 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
9639 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
9640 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9641 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9642 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
9643 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
9644 ; GFX11-WGP-NEXT: buffer_gl1_inv
9645 ; GFX11-WGP-NEXT: buffer_gl0_inv
9646 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
9647 ; GFX11-WGP-NEXT: s_endpgm
9649 ; GFX11-CU-LABEL: global_system_relese_seq_cst_ret_cmpxchg:
9650 ; GFX11-CU: ; %bb.0: ; %entry
9651 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
9652 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
9653 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
9654 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
9655 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
9656 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9657 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
9658 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
9659 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
9660 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
9661 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9662 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
9663 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
9664 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
9665 ; GFX11-CU-NEXT: buffer_gl1_inv
9666 ; GFX11-CU-NEXT: buffer_gl0_inv
9667 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
9668 ; GFX11-CU-NEXT: s_endpgm
9670 ; GFX12-WGP-LABEL: global_system_relese_seq_cst_ret_cmpxchg:
9671 ; GFX12-WGP: ; %bb.0: ; %entry
9672 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
9673 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
9674 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
9675 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
9676 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
9677 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
9678 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
9679 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
9680 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
9681 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
9682 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
9683 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
9684 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
9685 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
9686 ; GFX12-WGP-NEXT: s_wait_loadcnt_dscnt 0x0
9687 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
9688 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
9689 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
9690 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
9691 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
9692 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
9693 ; GFX12-WGP-NEXT: s_endpgm
9695 ; GFX12-CU-LABEL: global_system_relese_seq_cst_ret_cmpxchg:
9696 ; GFX12-CU: ; %bb.0: ; %entry
9697 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
9698 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
9699 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
9700 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
9701 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
9702 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
9703 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
9704 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
9705 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
9706 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
9707 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
9708 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
9709 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
9710 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
9711 ; GFX12-CU-NEXT: s_wait_loadcnt_dscnt 0x0
9712 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
9713 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
9714 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
9715 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
9716 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
9717 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
9718 ; GFX12-CU-NEXT: s_endpgm
9719 ptr addrspace(1) %out, i32 %in, i32 %old) {
9721 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
9722 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in release seq_cst
9723 %val0 = extractvalue { i32, i1 } %val, 0
9724 store i32 %val0, ptr addrspace(1) %out, align 4
9728 define amdgpu_kernel void @global_system_acq_rel_seq_cst_ret_cmpxchg(
9729 ; GFX6-LABEL: global_system_acq_rel_seq_cst_ret_cmpxchg:
9730 ; GFX6: ; %bb.0: ; %entry
9731 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
9732 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
9733 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
9734 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9735 ; GFX6-NEXT: s_mov_b32 s12, s5
9736 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
9737 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
9738 ; GFX6-NEXT: s_mov_b32 s11, -1
9739 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
9740 ; GFX6-NEXT: s_mov_b32 s5, s12
9741 ; GFX6-NEXT: s_mov_b32 s6, s11
9742 ; GFX6-NEXT: s_mov_b32 s7, s10
9743 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
9744 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
9745 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
9746 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
9747 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9748 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
9749 ; GFX6-NEXT: s_waitcnt vmcnt(0)
9750 ; GFX6-NEXT: buffer_wbinvl1
9751 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
9752 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
9753 ; GFX6-NEXT: s_endpgm
9755 ; GFX7-LABEL: global_system_acq_rel_seq_cst_ret_cmpxchg:
9756 ; GFX7: ; %bb.0: ; %entry
9757 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
9758 ; GFX7-NEXT: s_load_dword s9, s[6:7], 0x2
9759 ; GFX7-NEXT: s_load_dword s8, s[6:7], 0x3
9760 ; GFX7-NEXT: s_mov_b64 s[12:13], 16
9761 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9762 ; GFX7-NEXT: s_mov_b32 s6, s4
9763 ; GFX7-NEXT: s_mov_b32 s7, s5
9764 ; GFX7-NEXT: s_mov_b32 s11, s12
9765 ; GFX7-NEXT: s_mov_b32 s10, s13
9766 ; GFX7-NEXT: s_add_u32 s6, s6, s11
9767 ; GFX7-NEXT: s_addc_u32 s10, s7, s10
9768 ; GFX7-NEXT: ; kill: def $sgpr6 killed $sgpr6 def $sgpr6_sgpr7
9769 ; GFX7-NEXT: s_mov_b32 s7, s10
9770 ; GFX7-NEXT: v_mov_b32_e32 v2, s9
9771 ; GFX7-NEXT: v_mov_b32_e32 v0, s8
9772 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
9773 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
9774 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
9775 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
9776 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9777 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
9778 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9779 ; GFX7-NEXT: buffer_wbinvl1_vol
9780 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
9781 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
9782 ; GFX7-NEXT: flat_store_dword v[0:1], v2
9783 ; GFX7-NEXT: s_endpgm
9785 ; GFX10-WGP-LABEL: global_system_acq_rel_seq_cst_ret_cmpxchg:
9786 ; GFX10-WGP: ; %bb.0: ; %entry
9787 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
9788 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
9789 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
9790 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
9791 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
9792 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9793 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
9794 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
9795 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
9796 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
9797 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9798 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9799 ; GFX10-WGP-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
9800 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
9801 ; GFX10-WGP-NEXT: buffer_gl1_inv
9802 ; GFX10-WGP-NEXT: buffer_gl0_inv
9803 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
9804 ; GFX10-WGP-NEXT: s_endpgm
9806 ; GFX10-CU-LABEL: global_system_acq_rel_seq_cst_ret_cmpxchg:
9807 ; GFX10-CU: ; %bb.0: ; %entry
9808 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
9809 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
9810 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
9811 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
9812 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
9813 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9814 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
9815 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
9816 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
9817 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
9818 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9819 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
9820 ; GFX10-CU-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
9821 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
9822 ; GFX10-CU-NEXT: buffer_gl1_inv
9823 ; GFX10-CU-NEXT: buffer_gl0_inv
9824 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
9825 ; GFX10-CU-NEXT: s_endpgm
9827 ; SKIP-CACHE-INV-LABEL: global_system_acq_rel_seq_cst_ret_cmpxchg:
9828 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9829 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
9830 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
9831 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
9832 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9833 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
9834 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
9835 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
9836 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
9837 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
9838 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
9839 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
9840 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
9841 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
9842 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
9843 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
9844 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
9845 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9846 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16 glc
9847 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
9848 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
9849 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
9850 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
9851 ; SKIP-CACHE-INV-NEXT: s_endpgm
9853 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acq_rel_seq_cst_ret_cmpxchg:
9854 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9855 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
9856 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
9857 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
9858 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
9859 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
9860 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9861 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
9862 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
9863 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
9864 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
9865 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
9866 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9867 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
9868 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9869 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
9870 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
9871 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
9872 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9874 ; GFX90A-TGSPLIT-LABEL: global_system_acq_rel_seq_cst_ret_cmpxchg:
9875 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9876 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
9877 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
9878 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
9879 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
9880 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
9881 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9882 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
9883 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
9884 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
9885 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
9886 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
9887 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9888 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
9889 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9890 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
9891 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
9892 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
9893 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9895 ; GFX940-NOTTGSPLIT-LABEL: global_system_acq_rel_seq_cst_ret_cmpxchg:
9896 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9897 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
9898 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
9899 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
9900 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
9901 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
9902 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9903 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
9904 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9905 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
9906 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
9907 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
9908 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9909 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
9910 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9911 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
9912 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
9913 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9915 ; GFX940-TGSPLIT-LABEL: global_system_acq_rel_seq_cst_ret_cmpxchg:
9916 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9917 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
9918 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
9919 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
9920 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
9921 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
9922 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9923 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
9924 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9925 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
9926 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
9927 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
9928 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9929 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
9930 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9931 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
9932 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
9933 ; GFX940-TGSPLIT-NEXT: s_endpgm
9935 ; GFX11-WGP-LABEL: global_system_acq_rel_seq_cst_ret_cmpxchg:
9936 ; GFX11-WGP: ; %bb.0: ; %entry
9937 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
9938 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
9939 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
9940 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
9941 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
9942 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9943 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
9944 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
9945 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
9946 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
9947 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9948 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9949 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
9950 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
9951 ; GFX11-WGP-NEXT: buffer_gl1_inv
9952 ; GFX11-WGP-NEXT: buffer_gl0_inv
9953 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
9954 ; GFX11-WGP-NEXT: s_endpgm
9956 ; GFX11-CU-LABEL: global_system_acq_rel_seq_cst_ret_cmpxchg:
9957 ; GFX11-CU: ; %bb.0: ; %entry
9958 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
9959 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
9960 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
9961 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
9962 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
9963 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9964 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
9965 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
9966 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
9967 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
9968 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9969 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
9970 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
9971 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
9972 ; GFX11-CU-NEXT: buffer_gl1_inv
9973 ; GFX11-CU-NEXT: buffer_gl0_inv
9974 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
9975 ; GFX11-CU-NEXT: s_endpgm
9977 ; GFX12-WGP-LABEL: global_system_acq_rel_seq_cst_ret_cmpxchg:
9978 ; GFX12-WGP: ; %bb.0: ; %entry
9979 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
9980 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
9981 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
9982 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
9983 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
9984 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
9985 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
9986 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
9987 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
9988 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
9989 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
9990 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
9991 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
9992 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
9993 ; GFX12-WGP-NEXT: s_wait_loadcnt_dscnt 0x0
9994 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
9995 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
9996 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
9997 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
9998 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
9999 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
10000 ; GFX12-WGP-NEXT: s_endpgm
10002 ; GFX12-CU-LABEL: global_system_acq_rel_seq_cst_ret_cmpxchg:
10003 ; GFX12-CU: ; %bb.0: ; %entry
10004 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
10005 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
10006 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
10007 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
10008 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
10009 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
10010 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
10011 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
10012 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
10013 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
10014 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
10015 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
10016 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
10017 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
10018 ; GFX12-CU-NEXT: s_wait_loadcnt_dscnt 0x0
10019 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
10020 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
10021 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
10022 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
10023 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
10024 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
10025 ; GFX12-CU-NEXT: s_endpgm
10026 ptr addrspace(1) %out, i32 %in, i32 %old) {
10028 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
10029 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in acq_rel seq_cst
10030 %val0 = extractvalue { i32, i1 } %val, 0
10031 store i32 %val0, ptr addrspace(1) %out, align 4
10035 define amdgpu_kernel void @global_system_seq_cst_seq_cst_ret_cmpxchg(
10036 ; GFX6-LABEL: global_system_seq_cst_seq_cst_ret_cmpxchg:
10037 ; GFX6: ; %bb.0: ; %entry
10038 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
10039 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
10040 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
10041 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10042 ; GFX6-NEXT: s_mov_b32 s12, s5
10043 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
10044 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
10045 ; GFX6-NEXT: s_mov_b32 s11, -1
10046 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
10047 ; GFX6-NEXT: s_mov_b32 s5, s12
10048 ; GFX6-NEXT: s_mov_b32 s6, s11
10049 ; GFX6-NEXT: s_mov_b32 s7, s10
10050 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
10051 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
10052 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
10053 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
10054 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10055 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
10056 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10057 ; GFX6-NEXT: buffer_wbinvl1
10058 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
10059 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
10060 ; GFX6-NEXT: s_endpgm
10062 ; GFX7-LABEL: global_system_seq_cst_seq_cst_ret_cmpxchg:
10063 ; GFX7: ; %bb.0: ; %entry
10064 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
10065 ; GFX7-NEXT: s_load_dword s9, s[6:7], 0x2
10066 ; GFX7-NEXT: s_load_dword s8, s[6:7], 0x3
10067 ; GFX7-NEXT: s_mov_b64 s[12:13], 16
10068 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10069 ; GFX7-NEXT: s_mov_b32 s6, s4
10070 ; GFX7-NEXT: s_mov_b32 s7, s5
10071 ; GFX7-NEXT: s_mov_b32 s11, s12
10072 ; GFX7-NEXT: s_mov_b32 s10, s13
10073 ; GFX7-NEXT: s_add_u32 s6, s6, s11
10074 ; GFX7-NEXT: s_addc_u32 s10, s7, s10
10075 ; GFX7-NEXT: ; kill: def $sgpr6 killed $sgpr6 def $sgpr6_sgpr7
10076 ; GFX7-NEXT: s_mov_b32 s7, s10
10077 ; GFX7-NEXT: v_mov_b32_e32 v2, s9
10078 ; GFX7-NEXT: v_mov_b32_e32 v0, s8
10079 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
10080 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
10081 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
10082 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
10083 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10084 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
10085 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10086 ; GFX7-NEXT: buffer_wbinvl1_vol
10087 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
10088 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
10089 ; GFX7-NEXT: flat_store_dword v[0:1], v2
10090 ; GFX7-NEXT: s_endpgm
10092 ; GFX10-WGP-LABEL: global_system_seq_cst_seq_cst_ret_cmpxchg:
10093 ; GFX10-WGP: ; %bb.0: ; %entry
10094 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
10095 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
10096 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
10097 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
10098 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
10099 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10100 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
10101 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
10102 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
10103 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
10104 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10105 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10106 ; GFX10-WGP-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
10107 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
10108 ; GFX10-WGP-NEXT: buffer_gl1_inv
10109 ; GFX10-WGP-NEXT: buffer_gl0_inv
10110 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
10111 ; GFX10-WGP-NEXT: s_endpgm
10113 ; GFX10-CU-LABEL: global_system_seq_cst_seq_cst_ret_cmpxchg:
10114 ; GFX10-CU: ; %bb.0: ; %entry
10115 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
10116 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
10117 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
10118 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
10119 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
10120 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10121 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
10122 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
10123 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
10124 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
10125 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10126 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10127 ; GFX10-CU-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
10128 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
10129 ; GFX10-CU-NEXT: buffer_gl1_inv
10130 ; GFX10-CU-NEXT: buffer_gl0_inv
10131 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
10132 ; GFX10-CU-NEXT: s_endpgm
10134 ; SKIP-CACHE-INV-LABEL: global_system_seq_cst_seq_cst_ret_cmpxchg:
10135 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10136 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
10137 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
10138 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
10139 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10140 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
10141 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
10142 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
10143 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
10144 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
10145 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
10146 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
10147 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
10148 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
10149 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
10150 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
10151 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
10152 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10153 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16 glc
10154 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10155 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
10156 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10157 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
10158 ; SKIP-CACHE-INV-NEXT: s_endpgm
10160 ; GFX90A-NOTTGSPLIT-LABEL: global_system_seq_cst_seq_cst_ret_cmpxchg:
10161 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10162 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
10163 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
10164 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
10165 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
10166 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
10167 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10168 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
10169 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
10170 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
10171 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
10172 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
10173 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10174 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
10175 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10176 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
10177 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
10178 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
10179 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10181 ; GFX90A-TGSPLIT-LABEL: global_system_seq_cst_seq_cst_ret_cmpxchg:
10182 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10183 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
10184 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
10185 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
10186 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
10187 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
10188 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10189 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
10190 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
10191 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
10192 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
10193 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
10194 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10195 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
10196 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10197 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
10198 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
10199 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
10200 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10202 ; GFX940-NOTTGSPLIT-LABEL: global_system_seq_cst_seq_cst_ret_cmpxchg:
10203 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10204 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
10205 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
10206 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
10207 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
10208 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
10209 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10210 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
10211 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10212 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
10213 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
10214 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10215 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10216 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
10217 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10218 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
10219 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
10220 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10222 ; GFX940-TGSPLIT-LABEL: global_system_seq_cst_seq_cst_ret_cmpxchg:
10223 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10224 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
10225 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
10226 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
10227 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
10228 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
10229 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10230 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
10231 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10232 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
10233 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
10234 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10235 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10236 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
10237 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10238 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
10239 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
10240 ; GFX940-TGSPLIT-NEXT: s_endpgm
10242 ; GFX11-WGP-LABEL: global_system_seq_cst_seq_cst_ret_cmpxchg:
10243 ; GFX11-WGP: ; %bb.0: ; %entry
10244 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
10245 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
10246 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
10247 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
10248 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
10249 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10250 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
10251 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
10252 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
10253 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
10254 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10255 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10256 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
10257 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
10258 ; GFX11-WGP-NEXT: buffer_gl1_inv
10259 ; GFX11-WGP-NEXT: buffer_gl0_inv
10260 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
10261 ; GFX11-WGP-NEXT: s_endpgm
10263 ; GFX11-CU-LABEL: global_system_seq_cst_seq_cst_ret_cmpxchg:
10264 ; GFX11-CU: ; %bb.0: ; %entry
10265 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
10266 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
10267 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
10268 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
10269 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
10270 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10271 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
10272 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
10273 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
10274 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
10275 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10276 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10277 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
10278 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
10279 ; GFX11-CU-NEXT: buffer_gl1_inv
10280 ; GFX11-CU-NEXT: buffer_gl0_inv
10281 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
10282 ; GFX11-CU-NEXT: s_endpgm
10284 ; GFX12-WGP-LABEL: global_system_seq_cst_seq_cst_ret_cmpxchg:
10285 ; GFX12-WGP: ; %bb.0: ; %entry
10286 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
10287 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
10288 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
10289 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
10290 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
10291 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
10292 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
10293 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
10294 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
10295 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
10296 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
10297 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
10298 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
10299 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
10300 ; GFX12-WGP-NEXT: s_wait_loadcnt_dscnt 0x0
10301 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
10302 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
10303 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
10304 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
10305 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
10306 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
10307 ; GFX12-WGP-NEXT: s_endpgm
10309 ; GFX12-CU-LABEL: global_system_seq_cst_seq_cst_ret_cmpxchg:
10310 ; GFX12-CU: ; %bb.0: ; %entry
10311 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
10312 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
10313 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
10314 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
10315 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
10316 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
10317 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
10318 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
10319 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
10320 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
10321 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
10322 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
10323 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
10324 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
10325 ; GFX12-CU-NEXT: s_wait_loadcnt_dscnt 0x0
10326 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
10327 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
10328 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
10329 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
10330 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
10331 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
10332 ; GFX12-CU-NEXT: s_endpgm
10333 ptr addrspace(1) %out, i32 %in, i32 %old) {
10335 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
10336 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in seq_cst seq_cst
10337 %val0 = extractvalue { i32, i1 } %val, 0
10338 store i32 %val0, ptr addrspace(1) %out, align 4
10342 define amdgpu_kernel void @global_system_one_as_unordered_load(
10343 ; GFX6-LABEL: global_system_one_as_unordered_load:
10344 ; GFX6: ; %bb.0: ; %entry
10345 ; GFX6-NEXT: s_load_dwordx2 s[8:9], s[6:7], 0x0
10346 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x2
10347 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10348 ; GFX6-NEXT: s_mov_b32 s6, s9
10349 ; GFX6-NEXT: ; kill: def $sgpr8 killed $sgpr8 killed $sgpr8_sgpr9
10350 ; GFX6-NEXT: s_mov_b32 s12, 0x100f000
10351 ; GFX6-NEXT: s_mov_b32 s13, -1
10352 ; GFX6-NEXT: ; kill: def $sgpr8 killed $sgpr8 def $sgpr8_sgpr9_sgpr10_sgpr11
10353 ; GFX6-NEXT: s_mov_b32 s9, s6
10354 ; GFX6-NEXT: s_mov_b32 s10, s13
10355 ; GFX6-NEXT: s_mov_b32 s11, s12
10356 ; GFX6-NEXT: s_mov_b32 s14, s5
10357 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
10358 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
10359 ; GFX6-NEXT: s_mov_b32 s5, s14
10360 ; GFX6-NEXT: s_mov_b32 s6, s13
10361 ; GFX6-NEXT: s_mov_b32 s7, s12
10362 ; GFX6-NEXT: buffer_load_dword v0, off, s[8:11], 0
10363 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10364 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
10365 ; GFX6-NEXT: s_endpgm
10367 ; GFX7-LABEL: global_system_one_as_unordered_load:
10368 ; GFX7: ; %bb.0: ; %entry
10369 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
10370 ; GFX7-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
10371 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x2
10372 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10373 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
10374 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
10375 ; GFX7-NEXT: flat_load_dword v2, v[0:1]
10376 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
10377 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
10378 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10379 ; GFX7-NEXT: flat_store_dword v[0:1], v2
10380 ; GFX7-NEXT: s_endpgm
10382 ; GFX10-WGP-LABEL: global_system_one_as_unordered_load:
10383 ; GFX10-WGP: ; %bb.0: ; %entry
10384 ; GFX10-WGP-NEXT: s_mov_b64 s[4:5], s[6:7]
10385 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
10386 ; GFX10-WGP-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
10387 ; GFX10-WGP-NEXT: s_nop 0
10388 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
10389 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10390 ; GFX10-WGP-NEXT: global_load_dword v1, v0, s[6:7]
10391 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
10392 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
10393 ; GFX10-WGP-NEXT: s_endpgm
10395 ; GFX10-CU-LABEL: global_system_one_as_unordered_load:
10396 ; GFX10-CU: ; %bb.0: ; %entry
10397 ; GFX10-CU-NEXT: s_mov_b64 s[4:5], s[6:7]
10398 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
10399 ; GFX10-CU-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
10400 ; GFX10-CU-NEXT: s_nop 0
10401 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
10402 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10403 ; GFX10-CU-NEXT: global_load_dword v1, v0, s[6:7]
10404 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
10405 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
10406 ; GFX10-CU-NEXT: s_endpgm
10408 ; SKIP-CACHE-INV-LABEL: global_system_one_as_unordered_load:
10409 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10410 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[4:5], s[2:3], 0x0
10411 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x2
10412 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10413 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s5
10414 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
10415 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, 0xf000
10416 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s9, -1
10417 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
10418 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s2
10419 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, s9
10420 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s8
10421 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s10, s1
10422 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
10423 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
10424 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s10
10425 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s9
10426 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s8
10427 ; SKIP-CACHE-INV-NEXT: buffer_load_dword v0, off, s[4:7], 0
10428 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10429 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
10430 ; SKIP-CACHE-INV-NEXT: s_endpgm
10432 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_unordered_load:
10433 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10434 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
10435 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
10436 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
10437 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
10438 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
10439 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10440 ; GFX90A-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[6:7]
10441 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10442 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
10443 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10445 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_unordered_load:
10446 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10447 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
10448 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
10449 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
10450 ; GFX90A-TGSPLIT-NEXT: s_nop 0
10451 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
10452 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10453 ; GFX90A-TGSPLIT-NEXT: global_load_dword v1, v0, s[6:7]
10454 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10455 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
10456 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10458 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_unordered_load:
10459 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10460 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
10461 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
10462 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
10463 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
10464 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
10465 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10466 ; GFX940-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[2:3]
10467 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10468 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
10469 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10471 ; GFX940-TGSPLIT-LABEL: global_system_one_as_unordered_load:
10472 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10473 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
10474 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
10475 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
10476 ; GFX940-TGSPLIT-NEXT: s_nop 0
10477 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
10478 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10479 ; GFX940-TGSPLIT-NEXT: global_load_dword v1, v0, s[2:3]
10480 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10481 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
10482 ; GFX940-TGSPLIT-NEXT: s_endpgm
10484 ; GFX11-WGP-LABEL: global_system_one_as_unordered_load:
10485 ; GFX11-WGP: ; %bb.0: ; %entry
10486 ; GFX11-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
10487 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
10488 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
10489 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
10490 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10491 ; GFX11-WGP-NEXT: global_load_b32 v1, v0, s[2:3]
10492 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
10493 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
10494 ; GFX11-WGP-NEXT: s_endpgm
10496 ; GFX11-CU-LABEL: global_system_one_as_unordered_load:
10497 ; GFX11-CU: ; %bb.0: ; %entry
10498 ; GFX11-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
10499 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
10500 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
10501 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
10502 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10503 ; GFX11-CU-NEXT: global_load_b32 v1, v0, s[2:3]
10504 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
10505 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
10506 ; GFX11-CU-NEXT: s_endpgm
10508 ; GFX12-WGP-LABEL: global_system_one_as_unordered_load:
10509 ; GFX12-WGP: ; %bb.0: ; %entry
10510 ; GFX12-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
10511 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
10512 ; GFX12-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
10513 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
10514 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
10515 ; GFX12-WGP-NEXT: global_load_b32 v1, v0, s[2:3]
10516 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
10517 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
10518 ; GFX12-WGP-NEXT: s_endpgm
10520 ; GFX12-CU-LABEL: global_system_one_as_unordered_load:
10521 ; GFX12-CU: ; %bb.0: ; %entry
10522 ; GFX12-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
10523 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
10524 ; GFX12-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
10525 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
10526 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
10527 ; GFX12-CU-NEXT: global_load_b32 v1, v0, s[2:3]
10528 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
10529 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
10530 ; GFX12-CU-NEXT: s_endpgm
10531 ptr addrspace(1) %in, ptr addrspace(1) %out) {
10533 %val = load atomic i32, ptr addrspace(1) %in syncscope("one-as") unordered, align 4
10534 store i32 %val, ptr addrspace(1) %out
10538 define amdgpu_kernel void @global_system_one_as_monotonic_load(
10539 ; GFX6-LABEL: global_system_one_as_monotonic_load:
10540 ; GFX6: ; %bb.0: ; %entry
10541 ; GFX6-NEXT: s_load_dwordx2 s[8:9], s[6:7], 0x0
10542 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x2
10543 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10544 ; GFX6-NEXT: s_mov_b32 s6, s9
10545 ; GFX6-NEXT: ; kill: def $sgpr8 killed $sgpr8 killed $sgpr8_sgpr9
10546 ; GFX6-NEXT: s_mov_b32 s12, 0x100f000
10547 ; GFX6-NEXT: s_mov_b32 s13, -1
10548 ; GFX6-NEXT: ; kill: def $sgpr8 killed $sgpr8 def $sgpr8_sgpr9_sgpr10_sgpr11
10549 ; GFX6-NEXT: s_mov_b32 s9, s6
10550 ; GFX6-NEXT: s_mov_b32 s10, s13
10551 ; GFX6-NEXT: s_mov_b32 s11, s12
10552 ; GFX6-NEXT: s_mov_b32 s14, s5
10553 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
10554 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
10555 ; GFX6-NEXT: s_mov_b32 s5, s14
10556 ; GFX6-NEXT: s_mov_b32 s6, s13
10557 ; GFX6-NEXT: s_mov_b32 s7, s12
10558 ; GFX6-NEXT: buffer_load_dword v0, off, s[8:11], 0 glc
10559 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10560 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
10561 ; GFX6-NEXT: s_endpgm
10563 ; GFX7-LABEL: global_system_one_as_monotonic_load:
10564 ; GFX7: ; %bb.0: ; %entry
10565 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
10566 ; GFX7-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
10567 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x2
10568 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10569 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
10570 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
10571 ; GFX7-NEXT: flat_load_dword v2, v[0:1] glc
10572 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
10573 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
10574 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10575 ; GFX7-NEXT: flat_store_dword v[0:1], v2
10576 ; GFX7-NEXT: s_endpgm
10578 ; GFX10-WGP-LABEL: global_system_one_as_monotonic_load:
10579 ; GFX10-WGP: ; %bb.0: ; %entry
10580 ; GFX10-WGP-NEXT: s_mov_b64 s[4:5], s[6:7]
10581 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
10582 ; GFX10-WGP-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
10583 ; GFX10-WGP-NEXT: s_nop 0
10584 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
10585 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10586 ; GFX10-WGP-NEXT: global_load_dword v1, v0, s[6:7] glc dlc
10587 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
10588 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
10589 ; GFX10-WGP-NEXT: s_endpgm
10591 ; GFX10-CU-LABEL: global_system_one_as_monotonic_load:
10592 ; GFX10-CU: ; %bb.0: ; %entry
10593 ; GFX10-CU-NEXT: s_mov_b64 s[4:5], s[6:7]
10594 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
10595 ; GFX10-CU-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
10596 ; GFX10-CU-NEXT: s_nop 0
10597 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
10598 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10599 ; GFX10-CU-NEXT: global_load_dword v1, v0, s[6:7] glc dlc
10600 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
10601 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
10602 ; GFX10-CU-NEXT: s_endpgm
10604 ; SKIP-CACHE-INV-LABEL: global_system_one_as_monotonic_load:
10605 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10606 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[4:5], s[2:3], 0x0
10607 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x2
10608 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10609 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s5
10610 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
10611 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, 0xf000
10612 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s9, -1
10613 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
10614 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s2
10615 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, s9
10616 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s8
10617 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s10, s1
10618 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
10619 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
10620 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s10
10621 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s9
10622 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s8
10623 ; SKIP-CACHE-INV-NEXT: buffer_load_dword v0, off, s[4:7], 0 glc
10624 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10625 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
10626 ; SKIP-CACHE-INV-NEXT: s_endpgm
10628 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_load:
10629 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10630 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
10631 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
10632 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
10633 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
10634 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
10635 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10636 ; GFX90A-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[6:7] glc
10637 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10638 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
10639 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10641 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_monotonic_load:
10642 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10643 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
10644 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
10645 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
10646 ; GFX90A-TGSPLIT-NEXT: s_nop 0
10647 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
10648 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10649 ; GFX90A-TGSPLIT-NEXT: global_load_dword v1, v0, s[6:7] glc
10650 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10651 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
10652 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10654 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_load:
10655 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10656 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
10657 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
10658 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
10659 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
10660 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
10661 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10662 ; GFX940-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[2:3] sc0 sc1
10663 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10664 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
10665 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10667 ; GFX940-TGSPLIT-LABEL: global_system_one_as_monotonic_load:
10668 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10669 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
10670 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
10671 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
10672 ; GFX940-TGSPLIT-NEXT: s_nop 0
10673 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
10674 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10675 ; GFX940-TGSPLIT-NEXT: global_load_dword v1, v0, s[2:3] sc0 sc1
10676 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10677 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
10678 ; GFX940-TGSPLIT-NEXT: s_endpgm
10680 ; GFX11-WGP-LABEL: global_system_one_as_monotonic_load:
10681 ; GFX11-WGP: ; %bb.0: ; %entry
10682 ; GFX11-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
10683 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
10684 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
10685 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
10686 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10687 ; GFX11-WGP-NEXT: global_load_b32 v1, v0, s[2:3] glc
10688 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
10689 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
10690 ; GFX11-WGP-NEXT: s_endpgm
10692 ; GFX11-CU-LABEL: global_system_one_as_monotonic_load:
10693 ; GFX11-CU: ; %bb.0: ; %entry
10694 ; GFX11-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
10695 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
10696 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
10697 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
10698 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10699 ; GFX11-CU-NEXT: global_load_b32 v1, v0, s[2:3] glc
10700 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
10701 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
10702 ; GFX11-CU-NEXT: s_endpgm
10704 ; GFX12-WGP-LABEL: global_system_one_as_monotonic_load:
10705 ; GFX12-WGP: ; %bb.0: ; %entry
10706 ; GFX12-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
10707 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
10708 ; GFX12-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
10709 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
10710 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
10711 ; GFX12-WGP-NEXT: global_load_b32 v1, v0, s[2:3] scope:SCOPE_SYS
10712 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
10713 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
10714 ; GFX12-WGP-NEXT: s_endpgm
10716 ; GFX12-CU-LABEL: global_system_one_as_monotonic_load:
10717 ; GFX12-CU: ; %bb.0: ; %entry
10718 ; GFX12-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
10719 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
10720 ; GFX12-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
10721 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
10722 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
10723 ; GFX12-CU-NEXT: global_load_b32 v1, v0, s[2:3] scope:SCOPE_SYS
10724 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
10725 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
10726 ; GFX12-CU-NEXT: s_endpgm
10727 ptr addrspace(1) %in, ptr addrspace(1) %out) {
10729 %val = load atomic i32, ptr addrspace(1) %in syncscope("one-as") monotonic, align 4
10730 store i32 %val, ptr addrspace(1) %out
10734 define amdgpu_kernel void @global_system_one_as_acquire_load(
10735 ; GFX6-LABEL: global_system_one_as_acquire_load:
10736 ; GFX6: ; %bb.0: ; %entry
10737 ; GFX6-NEXT: s_load_dwordx2 s[8:9], s[6:7], 0x0
10738 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x2
10739 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10740 ; GFX6-NEXT: s_mov_b32 s6, s9
10741 ; GFX6-NEXT: ; kill: def $sgpr8 killed $sgpr8 killed $sgpr8_sgpr9
10742 ; GFX6-NEXT: s_mov_b32 s12, 0x100f000
10743 ; GFX6-NEXT: s_mov_b32 s13, -1
10744 ; GFX6-NEXT: ; kill: def $sgpr8 killed $sgpr8 def $sgpr8_sgpr9_sgpr10_sgpr11
10745 ; GFX6-NEXT: s_mov_b32 s9, s6
10746 ; GFX6-NEXT: s_mov_b32 s10, s13
10747 ; GFX6-NEXT: s_mov_b32 s11, s12
10748 ; GFX6-NEXT: s_mov_b32 s14, s5
10749 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
10750 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
10751 ; GFX6-NEXT: s_mov_b32 s5, s14
10752 ; GFX6-NEXT: s_mov_b32 s6, s13
10753 ; GFX6-NEXT: s_mov_b32 s7, s12
10754 ; GFX6-NEXT: buffer_load_dword v0, off, s[8:11], 0 glc
10755 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10756 ; GFX6-NEXT: buffer_wbinvl1
10757 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
10758 ; GFX6-NEXT: s_endpgm
10760 ; GFX7-LABEL: global_system_one_as_acquire_load:
10761 ; GFX7: ; %bb.0: ; %entry
10762 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
10763 ; GFX7-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
10764 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x2
10765 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10766 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
10767 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
10768 ; GFX7-NEXT: flat_load_dword v2, v[0:1] glc
10769 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10770 ; GFX7-NEXT: buffer_wbinvl1_vol
10771 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
10772 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
10773 ; GFX7-NEXT: flat_store_dword v[0:1], v2
10774 ; GFX7-NEXT: s_endpgm
10776 ; GFX10-WGP-LABEL: global_system_one_as_acquire_load:
10777 ; GFX10-WGP: ; %bb.0: ; %entry
10778 ; GFX10-WGP-NEXT: s_mov_b64 s[4:5], s[6:7]
10779 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
10780 ; GFX10-WGP-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
10781 ; GFX10-WGP-NEXT: s_nop 0
10782 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
10783 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10784 ; GFX10-WGP-NEXT: global_load_dword v1, v0, s[6:7] glc dlc
10785 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
10786 ; GFX10-WGP-NEXT: buffer_gl1_inv
10787 ; GFX10-WGP-NEXT: buffer_gl0_inv
10788 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
10789 ; GFX10-WGP-NEXT: s_endpgm
10791 ; GFX10-CU-LABEL: global_system_one_as_acquire_load:
10792 ; GFX10-CU: ; %bb.0: ; %entry
10793 ; GFX10-CU-NEXT: s_mov_b64 s[4:5], s[6:7]
10794 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
10795 ; GFX10-CU-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
10796 ; GFX10-CU-NEXT: s_nop 0
10797 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
10798 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10799 ; GFX10-CU-NEXT: global_load_dword v1, v0, s[6:7] glc dlc
10800 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
10801 ; GFX10-CU-NEXT: buffer_gl1_inv
10802 ; GFX10-CU-NEXT: buffer_gl0_inv
10803 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
10804 ; GFX10-CU-NEXT: s_endpgm
10806 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acquire_load:
10807 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10808 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[4:5], s[2:3], 0x0
10809 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x2
10810 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10811 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s5
10812 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
10813 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, 0xf000
10814 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s9, -1
10815 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
10816 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s2
10817 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, s9
10818 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s8
10819 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s10, s1
10820 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
10821 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
10822 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s10
10823 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s9
10824 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s8
10825 ; SKIP-CACHE-INV-NEXT: buffer_load_dword v0, off, s[4:7], 0 glc
10826 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10827 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
10828 ; SKIP-CACHE-INV-NEXT: s_endpgm
10830 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acquire_load:
10831 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10832 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
10833 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
10834 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
10835 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
10836 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
10837 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10838 ; GFX90A-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[6:7] glc
10839 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10840 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
10841 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
10842 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
10843 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10845 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acquire_load:
10846 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10847 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
10848 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
10849 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
10850 ; GFX90A-TGSPLIT-NEXT: s_nop 0
10851 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
10852 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10853 ; GFX90A-TGSPLIT-NEXT: global_load_dword v1, v0, s[6:7] glc
10854 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10855 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
10856 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
10857 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
10858 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10860 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acquire_load:
10861 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10862 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
10863 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
10864 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
10865 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
10866 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
10867 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10868 ; GFX940-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[2:3] sc0 sc1
10869 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10870 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
10871 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
10872 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10874 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acquire_load:
10875 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10876 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
10877 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
10878 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
10879 ; GFX940-TGSPLIT-NEXT: s_nop 0
10880 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
10881 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10882 ; GFX940-TGSPLIT-NEXT: global_load_dword v1, v0, s[2:3] sc0 sc1
10883 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10884 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
10885 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
10886 ; GFX940-TGSPLIT-NEXT: s_endpgm
10888 ; GFX11-WGP-LABEL: global_system_one_as_acquire_load:
10889 ; GFX11-WGP: ; %bb.0: ; %entry
10890 ; GFX11-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
10891 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
10892 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
10893 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
10894 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10895 ; GFX11-WGP-NEXT: global_load_b32 v1, v0, s[2:3] glc
10896 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
10897 ; GFX11-WGP-NEXT: buffer_gl1_inv
10898 ; GFX11-WGP-NEXT: buffer_gl0_inv
10899 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
10900 ; GFX11-WGP-NEXT: s_endpgm
10902 ; GFX11-CU-LABEL: global_system_one_as_acquire_load:
10903 ; GFX11-CU: ; %bb.0: ; %entry
10904 ; GFX11-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
10905 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
10906 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
10907 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
10908 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10909 ; GFX11-CU-NEXT: global_load_b32 v1, v0, s[2:3] glc
10910 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
10911 ; GFX11-CU-NEXT: buffer_gl1_inv
10912 ; GFX11-CU-NEXT: buffer_gl0_inv
10913 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
10914 ; GFX11-CU-NEXT: s_endpgm
10916 ; GFX12-WGP-LABEL: global_system_one_as_acquire_load:
10917 ; GFX12-WGP: ; %bb.0: ; %entry
10918 ; GFX12-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
10919 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
10920 ; GFX12-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
10921 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
10922 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
10923 ; GFX12-WGP-NEXT: global_load_b32 v1, v0, s[2:3] scope:SCOPE_SYS
10924 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
10925 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
10926 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
10927 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
10928 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
10929 ; GFX12-WGP-NEXT: s_endpgm
10931 ; GFX12-CU-LABEL: global_system_one_as_acquire_load:
10932 ; GFX12-CU: ; %bb.0: ; %entry
10933 ; GFX12-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
10934 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
10935 ; GFX12-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
10936 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
10937 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
10938 ; GFX12-CU-NEXT: global_load_b32 v1, v0, s[2:3] scope:SCOPE_SYS
10939 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
10940 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
10941 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
10942 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
10943 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
10944 ; GFX12-CU-NEXT: s_endpgm
10945 ptr addrspace(1) %in, ptr addrspace(1) %out) {
10947 %val = load atomic i32, ptr addrspace(1) %in syncscope("one-as") acquire, align 4
10948 store i32 %val, ptr addrspace(1) %out
10952 define amdgpu_kernel void @global_system_one_as_seq_cst_load(
10953 ; GFX6-LABEL: global_system_one_as_seq_cst_load:
10954 ; GFX6: ; %bb.0: ; %entry
10955 ; GFX6-NEXT: s_load_dwordx2 s[8:9], s[6:7], 0x0
10956 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x2
10957 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10958 ; GFX6-NEXT: s_mov_b32 s6, s9
10959 ; GFX6-NEXT: ; kill: def $sgpr8 killed $sgpr8 killed $sgpr8_sgpr9
10960 ; GFX6-NEXT: s_mov_b32 s12, 0x100f000
10961 ; GFX6-NEXT: s_mov_b32 s13, -1
10962 ; GFX6-NEXT: ; kill: def $sgpr8 killed $sgpr8 def $sgpr8_sgpr9_sgpr10_sgpr11
10963 ; GFX6-NEXT: s_mov_b32 s9, s6
10964 ; GFX6-NEXT: s_mov_b32 s10, s13
10965 ; GFX6-NEXT: s_mov_b32 s11, s12
10966 ; GFX6-NEXT: s_mov_b32 s14, s5
10967 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
10968 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
10969 ; GFX6-NEXT: s_mov_b32 s5, s14
10970 ; GFX6-NEXT: s_mov_b32 s6, s13
10971 ; GFX6-NEXT: s_mov_b32 s7, s12
10972 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10973 ; GFX6-NEXT: buffer_load_dword v0, off, s[8:11], 0 glc
10974 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10975 ; GFX6-NEXT: buffer_wbinvl1
10976 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
10977 ; GFX6-NEXT: s_endpgm
10979 ; GFX7-LABEL: global_system_one_as_seq_cst_load:
10980 ; GFX7: ; %bb.0: ; %entry
10981 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
10982 ; GFX7-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
10983 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x2
10984 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10985 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
10986 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
10987 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10988 ; GFX7-NEXT: flat_load_dword v2, v[0:1] glc
10989 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10990 ; GFX7-NEXT: buffer_wbinvl1_vol
10991 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
10992 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
10993 ; GFX7-NEXT: flat_store_dword v[0:1], v2
10994 ; GFX7-NEXT: s_endpgm
10996 ; GFX10-WGP-LABEL: global_system_one_as_seq_cst_load:
10997 ; GFX10-WGP: ; %bb.0: ; %entry
10998 ; GFX10-WGP-NEXT: s_mov_b64 s[4:5], s[6:7]
10999 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
11000 ; GFX10-WGP-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
11001 ; GFX10-WGP-NEXT: s_nop 0
11002 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
11003 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11004 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11005 ; GFX10-WGP-NEXT: global_load_dword v1, v0, s[6:7] glc dlc
11006 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
11007 ; GFX10-WGP-NEXT: buffer_gl1_inv
11008 ; GFX10-WGP-NEXT: buffer_gl0_inv
11009 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
11010 ; GFX10-WGP-NEXT: s_endpgm
11012 ; GFX10-CU-LABEL: global_system_one_as_seq_cst_load:
11013 ; GFX10-CU: ; %bb.0: ; %entry
11014 ; GFX10-CU-NEXT: s_mov_b64 s[4:5], s[6:7]
11015 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
11016 ; GFX10-CU-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
11017 ; GFX10-CU-NEXT: s_nop 0
11018 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
11019 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11020 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
11021 ; GFX10-CU-NEXT: global_load_dword v1, v0, s[6:7] glc dlc
11022 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
11023 ; GFX10-CU-NEXT: buffer_gl1_inv
11024 ; GFX10-CU-NEXT: buffer_gl0_inv
11025 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
11026 ; GFX10-CU-NEXT: s_endpgm
11028 ; SKIP-CACHE-INV-LABEL: global_system_one_as_seq_cst_load:
11029 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11030 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[4:5], s[2:3], 0x0
11031 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x2
11032 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11033 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s5
11034 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
11035 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, 0xf000
11036 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s9, -1
11037 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
11038 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s2
11039 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, s9
11040 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s8
11041 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s10, s1
11042 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
11043 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
11044 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s10
11045 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s9
11046 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s8
11047 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11048 ; SKIP-CACHE-INV-NEXT: buffer_load_dword v0, off, s[4:7], 0 glc
11049 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11050 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
11051 ; SKIP-CACHE-INV-NEXT: s_endpgm
11053 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_load:
11054 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11055 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
11056 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
11057 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
11058 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
11059 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
11060 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11061 ; GFX90A-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[6:7] glc
11062 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11063 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
11064 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
11065 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
11066 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11068 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_seq_cst_load:
11069 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11070 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
11071 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
11072 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
11073 ; GFX90A-TGSPLIT-NEXT: s_nop 0
11074 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
11075 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11076 ; GFX90A-TGSPLIT-NEXT: global_load_dword v1, v0, s[6:7] glc
11077 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11078 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
11079 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
11080 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
11081 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11083 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_load:
11084 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11085 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
11086 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
11087 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
11088 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
11089 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
11090 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11091 ; GFX940-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[2:3] sc0 sc1
11092 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11093 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
11094 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
11095 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11097 ; GFX940-TGSPLIT-LABEL: global_system_one_as_seq_cst_load:
11098 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11099 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
11100 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
11101 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
11102 ; GFX940-TGSPLIT-NEXT: s_nop 0
11103 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
11104 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11105 ; GFX940-TGSPLIT-NEXT: global_load_dword v1, v0, s[2:3] sc0 sc1
11106 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11107 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
11108 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
11109 ; GFX940-TGSPLIT-NEXT: s_endpgm
11111 ; GFX11-WGP-LABEL: global_system_one_as_seq_cst_load:
11112 ; GFX11-WGP: ; %bb.0: ; %entry
11113 ; GFX11-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
11114 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
11115 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
11116 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
11117 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11118 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11119 ; GFX11-WGP-NEXT: global_load_b32 v1, v0, s[2:3] glc
11120 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
11121 ; GFX11-WGP-NEXT: buffer_gl1_inv
11122 ; GFX11-WGP-NEXT: buffer_gl0_inv
11123 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
11124 ; GFX11-WGP-NEXT: s_endpgm
11126 ; GFX11-CU-LABEL: global_system_one_as_seq_cst_load:
11127 ; GFX11-CU: ; %bb.0: ; %entry
11128 ; GFX11-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
11129 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
11130 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
11131 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
11132 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11133 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
11134 ; GFX11-CU-NEXT: global_load_b32 v1, v0, s[2:3] glc
11135 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
11136 ; GFX11-CU-NEXT: buffer_gl1_inv
11137 ; GFX11-CU-NEXT: buffer_gl0_inv
11138 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
11139 ; GFX11-CU-NEXT: s_endpgm
11141 ; GFX12-WGP-LABEL: global_system_one_as_seq_cst_load:
11142 ; GFX12-WGP: ; %bb.0: ; %entry
11143 ; GFX12-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
11144 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
11145 ; GFX12-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
11146 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
11147 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
11148 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
11149 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
11150 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
11151 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
11152 ; GFX12-WGP-NEXT: global_load_b32 v1, v0, s[2:3] scope:SCOPE_SYS
11153 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
11154 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
11155 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
11156 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
11157 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
11158 ; GFX12-WGP-NEXT: s_endpgm
11160 ; GFX12-CU-LABEL: global_system_one_as_seq_cst_load:
11161 ; GFX12-CU: ; %bb.0: ; %entry
11162 ; GFX12-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
11163 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
11164 ; GFX12-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
11165 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
11166 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
11167 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
11168 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
11169 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
11170 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
11171 ; GFX12-CU-NEXT: global_load_b32 v1, v0, s[2:3] scope:SCOPE_SYS
11172 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
11173 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
11174 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
11175 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
11176 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
11177 ; GFX12-CU-NEXT: s_endpgm
11178 ptr addrspace(1) %in, ptr addrspace(1) %out) {
11180 %val = load atomic i32, ptr addrspace(1) %in syncscope("one-as") seq_cst, align 4
11181 store i32 %val, ptr addrspace(1) %out
11185 define amdgpu_kernel void @global_system_one_as_unordered_store(
11186 ; GFX6-LABEL: global_system_one_as_unordered_store:
11187 ; GFX6: ; %bb.0: ; %entry
11188 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x0
11189 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x2
11190 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11191 ; GFX6-NEXT: s_mov_b32 s11, s5
11192 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
11193 ; GFX6-NEXT: s_mov_b32 s9, 0x100f000
11194 ; GFX6-NEXT: s_mov_b32 s10, -1
11195 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
11196 ; GFX6-NEXT: s_mov_b32 s5, s11
11197 ; GFX6-NEXT: s_mov_b32 s6, s10
11198 ; GFX6-NEXT: s_mov_b32 s7, s9
11199 ; GFX6-NEXT: v_mov_b32_e32 v0, s8
11200 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
11201 ; GFX6-NEXT: s_endpgm
11203 ; GFX7-LABEL: global_system_one_as_unordered_store:
11204 ; GFX7: ; %bb.0: ; %entry
11205 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
11206 ; GFX7-NEXT: s_load_dwordx2 s[6:7], s[6:7], 0x2
11207 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11208 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
11209 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
11210 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
11211 ; GFX7-NEXT: flat_store_dword v[0:1], v2
11212 ; GFX7-NEXT: s_endpgm
11214 ; GFX10-WGP-LABEL: global_system_one_as_unordered_store:
11215 ; GFX10-WGP: ; %bb.0: ; %entry
11216 ; GFX10-WGP-NEXT: s_mov_b64 s[4:5], s[6:7]
11217 ; GFX10-WGP-NEXT: s_load_dword s6, s[4:5], 0x0
11218 ; GFX10-WGP-NEXT: s_nop 0
11219 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
11220 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
11221 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11222 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
11223 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
11224 ; GFX10-WGP-NEXT: s_endpgm
11226 ; GFX10-CU-LABEL: global_system_one_as_unordered_store:
11227 ; GFX10-CU: ; %bb.0: ; %entry
11228 ; GFX10-CU-NEXT: s_mov_b64 s[4:5], s[6:7]
11229 ; GFX10-CU-NEXT: s_load_dword s6, s[4:5], 0x0
11230 ; GFX10-CU-NEXT: s_nop 0
11231 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
11232 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
11233 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11234 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
11235 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
11236 ; GFX10-CU-NEXT: s_endpgm
11238 ; SKIP-CACHE-INV-LABEL: global_system_one_as_unordered_store:
11239 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11240 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x0
11241 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x2
11242 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11243 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s1
11244 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
11245 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, 0xf000
11246 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
11247 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
11248 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s7
11249 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s6
11250 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s5
11251 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
11252 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
11253 ; SKIP-CACHE-INV-NEXT: s_endpgm
11255 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_unordered_store:
11256 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11257 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
11258 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[4:5], 0x0
11259 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
11260 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
11261 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
11262 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11263 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
11264 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
11265 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11267 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_unordered_store:
11268 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11269 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
11270 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[4:5], 0x0
11271 ; GFX90A-TGSPLIT-NEXT: s_nop 0
11272 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
11273 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
11274 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11275 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
11276 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
11277 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11279 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_unordered_store:
11280 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11281 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
11282 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[0:1], 0x0
11283 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
11284 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
11285 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
11286 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11287 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
11288 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
11289 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11291 ; GFX940-TGSPLIT-LABEL: global_system_one_as_unordered_store:
11292 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11293 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
11294 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[0:1], 0x0
11295 ; GFX940-TGSPLIT-NEXT: s_nop 0
11296 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
11297 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
11298 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11299 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
11300 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
11301 ; GFX940-TGSPLIT-NEXT: s_endpgm
11303 ; GFX11-WGP-LABEL: global_system_one_as_unordered_store:
11304 ; GFX11-WGP: ; %bb.0: ; %entry
11305 ; GFX11-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
11306 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
11307 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
11308 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
11309 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11310 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
11311 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
11312 ; GFX11-WGP-NEXT: s_endpgm
11314 ; GFX11-CU-LABEL: global_system_one_as_unordered_store:
11315 ; GFX11-CU: ; %bb.0: ; %entry
11316 ; GFX11-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
11317 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
11318 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
11319 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
11320 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11321 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
11322 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
11323 ; GFX11-CU-NEXT: s_endpgm
11325 ; GFX12-WGP-LABEL: global_system_one_as_unordered_store:
11326 ; GFX12-WGP: ; %bb.0: ; %entry
11327 ; GFX12-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
11328 ; GFX12-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
11329 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
11330 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
11331 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
11332 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
11333 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
11334 ; GFX12-WGP-NEXT: s_endpgm
11336 ; GFX12-CU-LABEL: global_system_one_as_unordered_store:
11337 ; GFX12-CU: ; %bb.0: ; %entry
11338 ; GFX12-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
11339 ; GFX12-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
11340 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
11341 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
11342 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
11343 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
11344 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
11345 ; GFX12-CU-NEXT: s_endpgm
11346 i32 %in, ptr addrspace(1) %out) {
11348 store atomic i32 %in, ptr addrspace(1) %out syncscope("one-as") unordered, align 4
11352 define amdgpu_kernel void @global_system_one_as_monotonic_store(
11353 ; GFX6-LABEL: global_system_one_as_monotonic_store:
11354 ; GFX6: ; %bb.0: ; %entry
11355 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x0
11356 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x2
11357 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11358 ; GFX6-NEXT: s_mov_b32 s11, s5
11359 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
11360 ; GFX6-NEXT: s_mov_b32 s9, 0x100f000
11361 ; GFX6-NEXT: s_mov_b32 s10, -1
11362 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
11363 ; GFX6-NEXT: s_mov_b32 s5, s11
11364 ; GFX6-NEXT: s_mov_b32 s6, s10
11365 ; GFX6-NEXT: s_mov_b32 s7, s9
11366 ; GFX6-NEXT: v_mov_b32_e32 v0, s8
11367 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
11368 ; GFX6-NEXT: s_endpgm
11370 ; GFX7-LABEL: global_system_one_as_monotonic_store:
11371 ; GFX7: ; %bb.0: ; %entry
11372 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
11373 ; GFX7-NEXT: s_load_dwordx2 s[6:7], s[6:7], 0x2
11374 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11375 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
11376 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
11377 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
11378 ; GFX7-NEXT: flat_store_dword v[0:1], v2
11379 ; GFX7-NEXT: s_endpgm
11381 ; GFX10-WGP-LABEL: global_system_one_as_monotonic_store:
11382 ; GFX10-WGP: ; %bb.0: ; %entry
11383 ; GFX10-WGP-NEXT: s_mov_b64 s[4:5], s[6:7]
11384 ; GFX10-WGP-NEXT: s_load_dword s6, s[4:5], 0x0
11385 ; GFX10-WGP-NEXT: s_nop 0
11386 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
11387 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
11388 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11389 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
11390 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
11391 ; GFX10-WGP-NEXT: s_endpgm
11393 ; GFX10-CU-LABEL: global_system_one_as_monotonic_store:
11394 ; GFX10-CU: ; %bb.0: ; %entry
11395 ; GFX10-CU-NEXT: s_mov_b64 s[4:5], s[6:7]
11396 ; GFX10-CU-NEXT: s_load_dword s6, s[4:5], 0x0
11397 ; GFX10-CU-NEXT: s_nop 0
11398 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
11399 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
11400 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11401 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
11402 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
11403 ; GFX10-CU-NEXT: s_endpgm
11405 ; SKIP-CACHE-INV-LABEL: global_system_one_as_monotonic_store:
11406 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11407 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x0
11408 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x2
11409 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11410 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s1
11411 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
11412 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, 0xf000
11413 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
11414 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
11415 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s7
11416 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s6
11417 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s5
11418 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
11419 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
11420 ; SKIP-CACHE-INV-NEXT: s_endpgm
11422 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_store:
11423 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11424 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
11425 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[4:5], 0x0
11426 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
11427 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
11428 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
11429 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11430 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
11431 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
11432 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11434 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_monotonic_store:
11435 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11436 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
11437 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[4:5], 0x0
11438 ; GFX90A-TGSPLIT-NEXT: s_nop 0
11439 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
11440 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
11441 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11442 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
11443 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
11444 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11446 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_store:
11447 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11448 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
11449 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[0:1], 0x0
11450 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
11451 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
11452 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
11453 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11454 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
11455 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
11456 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11458 ; GFX940-TGSPLIT-LABEL: global_system_one_as_monotonic_store:
11459 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11460 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
11461 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[0:1], 0x0
11462 ; GFX940-TGSPLIT-NEXT: s_nop 0
11463 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
11464 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
11465 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11466 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
11467 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
11468 ; GFX940-TGSPLIT-NEXT: s_endpgm
11470 ; GFX11-WGP-LABEL: global_system_one_as_monotonic_store:
11471 ; GFX11-WGP: ; %bb.0: ; %entry
11472 ; GFX11-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
11473 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
11474 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
11475 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
11476 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11477 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
11478 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
11479 ; GFX11-WGP-NEXT: s_endpgm
11481 ; GFX11-CU-LABEL: global_system_one_as_monotonic_store:
11482 ; GFX11-CU: ; %bb.0: ; %entry
11483 ; GFX11-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
11484 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
11485 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
11486 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
11487 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11488 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
11489 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
11490 ; GFX11-CU-NEXT: s_endpgm
11492 ; GFX12-WGP-LABEL: global_system_one_as_monotonic_store:
11493 ; GFX12-WGP: ; %bb.0: ; %entry
11494 ; GFX12-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
11495 ; GFX12-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
11496 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
11497 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
11498 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
11499 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
11500 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1] scope:SCOPE_SYS
11501 ; GFX12-WGP-NEXT: s_endpgm
11503 ; GFX12-CU-LABEL: global_system_one_as_monotonic_store:
11504 ; GFX12-CU: ; %bb.0: ; %entry
11505 ; GFX12-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
11506 ; GFX12-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
11507 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
11508 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
11509 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
11510 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
11511 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1] scope:SCOPE_SYS
11512 ; GFX12-CU-NEXT: s_endpgm
11513 i32 %in, ptr addrspace(1) %out) {
11515 store atomic i32 %in, ptr addrspace(1) %out syncscope("one-as") monotonic, align 4
11519 define amdgpu_kernel void @global_system_one_as_release_store(
11520 ; GFX6-LABEL: global_system_one_as_release_store:
11521 ; GFX6: ; %bb.0: ; %entry
11522 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x0
11523 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x2
11524 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11525 ; GFX6-NEXT: s_mov_b32 s11, s5
11526 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
11527 ; GFX6-NEXT: s_mov_b32 s9, 0x100f000
11528 ; GFX6-NEXT: s_mov_b32 s10, -1
11529 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
11530 ; GFX6-NEXT: s_mov_b32 s5, s11
11531 ; GFX6-NEXT: s_mov_b32 s6, s10
11532 ; GFX6-NEXT: s_mov_b32 s7, s9
11533 ; GFX6-NEXT: v_mov_b32_e32 v0, s8
11534 ; GFX6-NEXT: s_waitcnt vmcnt(0)
11535 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
11536 ; GFX6-NEXT: s_endpgm
11538 ; GFX7-LABEL: global_system_one_as_release_store:
11539 ; GFX7: ; %bb.0: ; %entry
11540 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
11541 ; GFX7-NEXT: s_load_dwordx2 s[6:7], s[6:7], 0x2
11542 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11543 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
11544 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
11545 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
11546 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11547 ; GFX7-NEXT: flat_store_dword v[0:1], v2
11548 ; GFX7-NEXT: s_endpgm
11550 ; GFX10-WGP-LABEL: global_system_one_as_release_store:
11551 ; GFX10-WGP: ; %bb.0: ; %entry
11552 ; GFX10-WGP-NEXT: s_mov_b64 s[4:5], s[6:7]
11553 ; GFX10-WGP-NEXT: s_load_dword s6, s[4:5], 0x0
11554 ; GFX10-WGP-NEXT: s_nop 0
11555 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
11556 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
11557 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11558 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
11559 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
11560 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11561 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
11562 ; GFX10-WGP-NEXT: s_endpgm
11564 ; GFX10-CU-LABEL: global_system_one_as_release_store:
11565 ; GFX10-CU: ; %bb.0: ; %entry
11566 ; GFX10-CU-NEXT: s_mov_b64 s[4:5], s[6:7]
11567 ; GFX10-CU-NEXT: s_load_dword s6, s[4:5], 0x0
11568 ; GFX10-CU-NEXT: s_nop 0
11569 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
11570 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
11571 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11572 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
11573 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
11574 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
11575 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
11576 ; GFX10-CU-NEXT: s_endpgm
11578 ; SKIP-CACHE-INV-LABEL: global_system_one_as_release_store:
11579 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11580 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x0
11581 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x2
11582 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11583 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s1
11584 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
11585 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, 0xf000
11586 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
11587 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
11588 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s7
11589 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s6
11590 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s5
11591 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
11592 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11593 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
11594 ; SKIP-CACHE-INV-NEXT: s_endpgm
11596 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_release_store:
11597 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11598 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
11599 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[4:5], 0x0
11600 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
11601 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
11602 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
11603 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11604 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
11605 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
11606 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11607 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
11608 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11610 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_release_store:
11611 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11612 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
11613 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[4:5], 0x0
11614 ; GFX90A-TGSPLIT-NEXT: s_nop 0
11615 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
11616 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
11617 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11618 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
11619 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
11620 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11621 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
11622 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11624 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_release_store:
11625 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11626 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
11627 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[0:1], 0x0
11628 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
11629 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
11630 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
11631 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11632 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
11633 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11634 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11635 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
11636 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11638 ; GFX940-TGSPLIT-LABEL: global_system_one_as_release_store:
11639 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11640 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
11641 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[0:1], 0x0
11642 ; GFX940-TGSPLIT-NEXT: s_nop 0
11643 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
11644 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
11645 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11646 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
11647 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11648 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11649 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
11650 ; GFX940-TGSPLIT-NEXT: s_endpgm
11652 ; GFX11-WGP-LABEL: global_system_one_as_release_store:
11653 ; GFX11-WGP: ; %bb.0: ; %entry
11654 ; GFX11-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
11655 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
11656 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
11657 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
11658 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11659 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
11660 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
11661 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11662 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
11663 ; GFX11-WGP-NEXT: s_endpgm
11665 ; GFX11-CU-LABEL: global_system_one_as_release_store:
11666 ; GFX11-CU: ; %bb.0: ; %entry
11667 ; GFX11-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
11668 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
11669 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
11670 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
11671 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11672 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
11673 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
11674 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
11675 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
11676 ; GFX11-CU-NEXT: s_endpgm
11678 ; GFX12-WGP-LABEL: global_system_one_as_release_store:
11679 ; GFX12-WGP: ; %bb.0: ; %entry
11680 ; GFX12-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
11681 ; GFX12-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
11682 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
11683 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
11684 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
11685 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
11686 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
11687 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
11688 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
11689 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
11690 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
11691 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1] scope:SCOPE_SYS
11692 ; GFX12-WGP-NEXT: s_endpgm
11694 ; GFX12-CU-LABEL: global_system_one_as_release_store:
11695 ; GFX12-CU: ; %bb.0: ; %entry
11696 ; GFX12-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
11697 ; GFX12-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
11698 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
11699 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
11700 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
11701 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
11702 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
11703 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
11704 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
11705 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
11706 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
11707 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1] scope:SCOPE_SYS
11708 ; GFX12-CU-NEXT: s_endpgm
11709 i32 %in, ptr addrspace(1) %out) {
11711 store atomic i32 %in, ptr addrspace(1) %out syncscope("one-as") release, align 4
11715 define amdgpu_kernel void @global_system_one_as_seq_cst_store(
11716 ; GFX6-LABEL: global_system_one_as_seq_cst_store:
11717 ; GFX6: ; %bb.0: ; %entry
11718 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x0
11719 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x2
11720 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11721 ; GFX6-NEXT: s_mov_b32 s11, s5
11722 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
11723 ; GFX6-NEXT: s_mov_b32 s9, 0x100f000
11724 ; GFX6-NEXT: s_mov_b32 s10, -1
11725 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
11726 ; GFX6-NEXT: s_mov_b32 s5, s11
11727 ; GFX6-NEXT: s_mov_b32 s6, s10
11728 ; GFX6-NEXT: s_mov_b32 s7, s9
11729 ; GFX6-NEXT: v_mov_b32_e32 v0, s8
11730 ; GFX6-NEXT: s_waitcnt vmcnt(0)
11731 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
11732 ; GFX6-NEXT: s_endpgm
11734 ; GFX7-LABEL: global_system_one_as_seq_cst_store:
11735 ; GFX7: ; %bb.0: ; %entry
11736 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
11737 ; GFX7-NEXT: s_load_dwordx2 s[6:7], s[6:7], 0x2
11738 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11739 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
11740 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
11741 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
11742 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11743 ; GFX7-NEXT: flat_store_dword v[0:1], v2
11744 ; GFX7-NEXT: s_endpgm
11746 ; GFX10-WGP-LABEL: global_system_one_as_seq_cst_store:
11747 ; GFX10-WGP: ; %bb.0: ; %entry
11748 ; GFX10-WGP-NEXT: s_mov_b64 s[4:5], s[6:7]
11749 ; GFX10-WGP-NEXT: s_load_dword s6, s[4:5], 0x0
11750 ; GFX10-WGP-NEXT: s_nop 0
11751 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
11752 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
11753 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11754 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
11755 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
11756 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11757 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
11758 ; GFX10-WGP-NEXT: s_endpgm
11760 ; GFX10-CU-LABEL: global_system_one_as_seq_cst_store:
11761 ; GFX10-CU: ; %bb.0: ; %entry
11762 ; GFX10-CU-NEXT: s_mov_b64 s[4:5], s[6:7]
11763 ; GFX10-CU-NEXT: s_load_dword s6, s[4:5], 0x0
11764 ; GFX10-CU-NEXT: s_nop 0
11765 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
11766 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
11767 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11768 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
11769 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
11770 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
11771 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
11772 ; GFX10-CU-NEXT: s_endpgm
11774 ; SKIP-CACHE-INV-LABEL: global_system_one_as_seq_cst_store:
11775 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11776 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x0
11777 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x2
11778 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11779 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s1
11780 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
11781 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, 0xf000
11782 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
11783 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
11784 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s7
11785 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s6
11786 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s5
11787 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
11788 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11789 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
11790 ; SKIP-CACHE-INV-NEXT: s_endpgm
11792 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_store:
11793 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11794 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
11795 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[4:5], 0x0
11796 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
11797 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
11798 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
11799 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11800 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
11801 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
11802 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11803 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
11804 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11806 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_seq_cst_store:
11807 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11808 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[6:7]
11809 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[4:5], 0x0
11810 ; GFX90A-TGSPLIT-NEXT: s_nop 0
11811 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x8
11812 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
11813 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11814 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
11815 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
11816 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11817 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
11818 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11820 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_store:
11821 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11822 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
11823 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[0:1], 0x0
11824 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
11825 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
11826 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
11827 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11828 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
11829 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11830 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11831 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
11832 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11834 ; GFX940-TGSPLIT-LABEL: global_system_one_as_seq_cst_store:
11835 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11836 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[0:1], s[2:3]
11837 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[0:1], 0x0
11838 ; GFX940-TGSPLIT-NEXT: s_nop 0
11839 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x8
11840 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
11841 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11842 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
11843 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11844 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11845 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
11846 ; GFX940-TGSPLIT-NEXT: s_endpgm
11848 ; GFX11-WGP-LABEL: global_system_one_as_seq_cst_store:
11849 ; GFX11-WGP: ; %bb.0: ; %entry
11850 ; GFX11-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
11851 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
11852 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
11853 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
11854 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11855 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
11856 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
11857 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11858 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
11859 ; GFX11-WGP-NEXT: s_endpgm
11861 ; GFX11-CU-LABEL: global_system_one_as_seq_cst_store:
11862 ; GFX11-CU: ; %bb.0: ; %entry
11863 ; GFX11-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
11864 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
11865 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
11866 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
11867 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11868 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
11869 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
11870 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
11871 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
11872 ; GFX11-CU-NEXT: s_endpgm
11874 ; GFX12-WGP-LABEL: global_system_one_as_seq_cst_store:
11875 ; GFX12-WGP: ; %bb.0: ; %entry
11876 ; GFX12-WGP-NEXT: s_mov_b64 s[0:1], s[2:3]
11877 ; GFX12-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
11878 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
11879 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
11880 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
11881 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
11882 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
11883 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
11884 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
11885 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
11886 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
11887 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1] scope:SCOPE_SYS
11888 ; GFX12-WGP-NEXT: s_endpgm
11890 ; GFX12-CU-LABEL: global_system_one_as_seq_cst_store:
11891 ; GFX12-CU: ; %bb.0: ; %entry
11892 ; GFX12-CU-NEXT: s_mov_b64 s[0:1], s[2:3]
11893 ; GFX12-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
11894 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
11895 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
11896 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
11897 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
11898 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
11899 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
11900 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
11901 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
11902 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
11903 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1] scope:SCOPE_SYS
11904 ; GFX12-CU-NEXT: s_endpgm
11905 i32 %in, ptr addrspace(1) %out) {
11907 store atomic i32 %in, ptr addrspace(1) %out syncscope("one-as") seq_cst, align 4
11911 define amdgpu_kernel void @global_system_one_as_monotonic_atomicrmw(
11912 ; GFX6-LABEL: global_system_one_as_monotonic_atomicrmw:
11913 ; GFX6: ; %bb.0: ; %entry
11914 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
11915 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x2
11916 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11917 ; GFX6-NEXT: s_mov_b32 s11, s5
11918 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
11919 ; GFX6-NEXT: s_mov_b32 s9, 0x100f000
11920 ; GFX6-NEXT: s_mov_b32 s10, -1
11921 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
11922 ; GFX6-NEXT: s_mov_b32 s5, s11
11923 ; GFX6-NEXT: s_mov_b32 s6, s10
11924 ; GFX6-NEXT: s_mov_b32 s7, s9
11925 ; GFX6-NEXT: v_mov_b32_e32 v0, s8
11926 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[4:7], 0
11927 ; GFX6-NEXT: s_endpgm
11929 ; GFX7-LABEL: global_system_one_as_monotonic_atomicrmw:
11930 ; GFX7: ; %bb.0: ; %entry
11931 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
11932 ; GFX7-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
11933 ; GFX7-NEXT: s_load_dword s4, s[4:5], 0x2
11934 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11935 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
11936 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
11937 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
11938 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
11939 ; GFX7-NEXT: s_endpgm
11941 ; GFX10-WGP-LABEL: global_system_one_as_monotonic_atomicrmw:
11942 ; GFX10-WGP: ; %bb.0: ; %entry
11943 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
11944 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
11945 ; GFX10-WGP-NEXT: s_nop 0
11946 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
11947 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11948 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
11949 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[4:5]
11950 ; GFX10-WGP-NEXT: s_endpgm
11952 ; GFX10-CU-LABEL: global_system_one_as_monotonic_atomicrmw:
11953 ; GFX10-CU: ; %bb.0: ; %entry
11954 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
11955 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
11956 ; GFX10-CU-NEXT: s_nop 0
11957 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
11958 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11959 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
11960 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[4:5]
11961 ; GFX10-CU-NEXT: s_endpgm
11963 ; SKIP-CACHE-INV-LABEL: global_system_one_as_monotonic_atomicrmw:
11964 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11965 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
11966 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x2
11967 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11968 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s1
11969 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
11970 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, 0xf000
11971 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
11972 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
11973 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s7
11974 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s6
11975 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s5
11976 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
11977 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
11978 ; SKIP-CACHE-INV-NEXT: s_endpgm
11980 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_atomicrmw:
11981 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11982 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
11983 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
11984 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
11985 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
11986 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11987 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
11988 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[4:5]
11989 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11991 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_monotonic_atomicrmw:
11992 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11993 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
11994 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
11995 ; GFX90A-TGSPLIT-NEXT: s_nop 0
11996 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
11997 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11998 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
11999 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[4:5]
12000 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12002 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_atomicrmw:
12003 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12004 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
12005 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
12006 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
12007 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
12008 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12009 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
12010 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1] sc1
12011 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12013 ; GFX940-TGSPLIT-LABEL: global_system_one_as_monotonic_atomicrmw:
12014 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12015 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
12016 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
12017 ; GFX940-TGSPLIT-NEXT: s_nop 0
12018 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
12019 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12020 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
12021 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1] sc1
12022 ; GFX940-TGSPLIT-NEXT: s_endpgm
12024 ; GFX11-WGP-LABEL: global_system_one_as_monotonic_atomicrmw:
12025 ; GFX11-WGP: ; %bb.0: ; %entry
12026 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
12027 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
12028 ; GFX11-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
12029 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12030 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
12031 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
12032 ; GFX11-WGP-NEXT: s_endpgm
12034 ; GFX11-CU-LABEL: global_system_one_as_monotonic_atomicrmw:
12035 ; GFX11-CU: ; %bb.0: ; %entry
12036 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
12037 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
12038 ; GFX11-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
12039 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12040 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
12041 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
12042 ; GFX11-CU-NEXT: s_endpgm
12044 ; GFX12-WGP-LABEL: global_system_one_as_monotonic_atomicrmw:
12045 ; GFX12-WGP: ; %bb.0: ; %entry
12046 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
12047 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
12048 ; GFX12-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
12049 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
12050 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
12051 ; GFX12-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1] scope:SCOPE_SYS
12052 ; GFX12-WGP-NEXT: s_endpgm
12054 ; GFX12-CU-LABEL: global_system_one_as_monotonic_atomicrmw:
12055 ; GFX12-CU: ; %bb.0: ; %entry
12056 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
12057 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
12058 ; GFX12-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
12059 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
12060 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
12061 ; GFX12-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1] scope:SCOPE_SYS
12062 ; GFX12-CU-NEXT: s_endpgm
12063 ptr addrspace(1) %out, i32 %in) {
12065 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in syncscope("one-as") monotonic
12069 define amdgpu_kernel void @global_system_one_as_acquire_atomicrmw(
12070 ; GFX6-LABEL: global_system_one_as_acquire_atomicrmw:
12071 ; GFX6: ; %bb.0: ; %entry
12072 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
12073 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x2
12074 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
12075 ; GFX6-NEXT: s_mov_b32 s11, s5
12076 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
12077 ; GFX6-NEXT: s_mov_b32 s9, 0x100f000
12078 ; GFX6-NEXT: s_mov_b32 s10, -1
12079 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
12080 ; GFX6-NEXT: s_mov_b32 s5, s11
12081 ; GFX6-NEXT: s_mov_b32 s6, s10
12082 ; GFX6-NEXT: s_mov_b32 s7, s9
12083 ; GFX6-NEXT: v_mov_b32_e32 v0, s8
12084 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[4:7], 0
12085 ; GFX6-NEXT: s_waitcnt vmcnt(0)
12086 ; GFX6-NEXT: buffer_wbinvl1
12087 ; GFX6-NEXT: s_endpgm
12089 ; GFX7-LABEL: global_system_one_as_acquire_atomicrmw:
12090 ; GFX7: ; %bb.0: ; %entry
12091 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
12092 ; GFX7-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
12093 ; GFX7-NEXT: s_load_dword s4, s[4:5], 0x2
12094 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12095 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
12096 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
12097 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
12098 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
12099 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12100 ; GFX7-NEXT: buffer_wbinvl1_vol
12101 ; GFX7-NEXT: s_endpgm
12103 ; GFX10-WGP-LABEL: global_system_one_as_acquire_atomicrmw:
12104 ; GFX10-WGP: ; %bb.0: ; %entry
12105 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
12106 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
12107 ; GFX10-WGP-NEXT: s_nop 0
12108 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
12109 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12110 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
12111 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[4:5]
12112 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12113 ; GFX10-WGP-NEXT: buffer_gl1_inv
12114 ; GFX10-WGP-NEXT: buffer_gl0_inv
12115 ; GFX10-WGP-NEXT: s_endpgm
12117 ; GFX10-CU-LABEL: global_system_one_as_acquire_atomicrmw:
12118 ; GFX10-CU: ; %bb.0: ; %entry
12119 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
12120 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
12121 ; GFX10-CU-NEXT: s_nop 0
12122 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
12123 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12124 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
12125 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[4:5]
12126 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
12127 ; GFX10-CU-NEXT: buffer_gl1_inv
12128 ; GFX10-CU-NEXT: buffer_gl0_inv
12129 ; GFX10-CU-NEXT: s_endpgm
12131 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acquire_atomicrmw:
12132 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12133 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
12134 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x2
12135 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12136 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s1
12137 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
12138 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, 0xf000
12139 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
12140 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
12141 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s7
12142 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s6
12143 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s5
12144 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
12145 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
12146 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12147 ; SKIP-CACHE-INV-NEXT: s_endpgm
12149 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acquire_atomicrmw:
12150 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12151 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
12152 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
12153 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
12154 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
12155 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12156 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
12157 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[4:5]
12158 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12159 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
12160 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
12161 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12163 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acquire_atomicrmw:
12164 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12165 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
12166 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
12167 ; GFX90A-TGSPLIT-NEXT: s_nop 0
12168 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
12169 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12170 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
12171 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[4:5]
12172 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12173 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
12174 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
12175 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12177 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acquire_atomicrmw:
12178 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12179 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
12180 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
12181 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
12182 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
12183 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12184 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
12185 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1] sc1
12186 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12187 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
12188 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12190 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acquire_atomicrmw:
12191 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12192 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
12193 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
12194 ; GFX940-TGSPLIT-NEXT: s_nop 0
12195 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
12196 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12197 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
12198 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1] sc1
12199 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12200 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
12201 ; GFX940-TGSPLIT-NEXT: s_endpgm
12203 ; GFX11-WGP-LABEL: global_system_one_as_acquire_atomicrmw:
12204 ; GFX11-WGP: ; %bb.0: ; %entry
12205 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
12206 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
12207 ; GFX11-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
12208 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12209 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
12210 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
12211 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12212 ; GFX11-WGP-NEXT: buffer_gl1_inv
12213 ; GFX11-WGP-NEXT: buffer_gl0_inv
12214 ; GFX11-WGP-NEXT: s_endpgm
12216 ; GFX11-CU-LABEL: global_system_one_as_acquire_atomicrmw:
12217 ; GFX11-CU: ; %bb.0: ; %entry
12218 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
12219 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
12220 ; GFX11-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
12221 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12222 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
12223 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
12224 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
12225 ; GFX11-CU-NEXT: buffer_gl1_inv
12226 ; GFX11-CU-NEXT: buffer_gl0_inv
12227 ; GFX11-CU-NEXT: s_endpgm
12229 ; GFX12-WGP-LABEL: global_system_one_as_acquire_atomicrmw:
12230 ; GFX12-WGP: ; %bb.0: ; %entry
12231 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
12232 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
12233 ; GFX12-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
12234 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
12235 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
12236 ; GFX12-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1] scope:SCOPE_SYS
12237 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
12238 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
12239 ; GFX12-WGP-NEXT: s_endpgm
12241 ; GFX12-CU-LABEL: global_system_one_as_acquire_atomicrmw:
12242 ; GFX12-CU: ; %bb.0: ; %entry
12243 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
12244 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
12245 ; GFX12-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
12246 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
12247 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
12248 ; GFX12-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1] scope:SCOPE_SYS
12249 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
12250 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
12251 ; GFX12-CU-NEXT: s_endpgm
12252 ptr addrspace(1) %out, i32 %in) {
12254 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in syncscope("one-as") acquire
12258 define amdgpu_kernel void @global_system_one_as_release_atomicrmw(
12259 ; GFX6-LABEL: global_system_one_as_release_atomicrmw:
12260 ; GFX6: ; %bb.0: ; %entry
12261 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
12262 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x2
12263 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
12264 ; GFX6-NEXT: s_mov_b32 s11, s5
12265 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
12266 ; GFX6-NEXT: s_mov_b32 s9, 0x100f000
12267 ; GFX6-NEXT: s_mov_b32 s10, -1
12268 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
12269 ; GFX6-NEXT: s_mov_b32 s5, s11
12270 ; GFX6-NEXT: s_mov_b32 s6, s10
12271 ; GFX6-NEXT: s_mov_b32 s7, s9
12272 ; GFX6-NEXT: v_mov_b32_e32 v0, s8
12273 ; GFX6-NEXT: s_waitcnt vmcnt(0)
12274 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[4:7], 0
12275 ; GFX6-NEXT: s_endpgm
12277 ; GFX7-LABEL: global_system_one_as_release_atomicrmw:
12278 ; GFX7: ; %bb.0: ; %entry
12279 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
12280 ; GFX7-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
12281 ; GFX7-NEXT: s_load_dword s4, s[4:5], 0x2
12282 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12283 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
12284 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
12285 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
12286 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12287 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
12288 ; GFX7-NEXT: s_endpgm
12290 ; GFX10-WGP-LABEL: global_system_one_as_release_atomicrmw:
12291 ; GFX10-WGP: ; %bb.0: ; %entry
12292 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
12293 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
12294 ; GFX10-WGP-NEXT: s_nop 0
12295 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
12296 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12297 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
12298 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12299 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12300 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[4:5]
12301 ; GFX10-WGP-NEXT: s_endpgm
12303 ; GFX10-CU-LABEL: global_system_one_as_release_atomicrmw:
12304 ; GFX10-CU: ; %bb.0: ; %entry
12305 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
12306 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
12307 ; GFX10-CU-NEXT: s_nop 0
12308 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
12309 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12310 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
12311 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12312 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
12313 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[4:5]
12314 ; GFX10-CU-NEXT: s_endpgm
12316 ; SKIP-CACHE-INV-LABEL: global_system_one_as_release_atomicrmw:
12317 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12318 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
12319 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x2
12320 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12321 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s1
12322 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
12323 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, 0xf000
12324 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
12325 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
12326 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s7
12327 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s6
12328 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s5
12329 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
12330 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12331 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
12332 ; SKIP-CACHE-INV-NEXT: s_endpgm
12334 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_release_atomicrmw:
12335 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12336 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
12337 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
12338 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
12339 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
12340 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12341 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
12342 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
12343 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12344 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[4:5]
12345 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12347 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_release_atomicrmw:
12348 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12349 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
12350 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
12351 ; GFX90A-TGSPLIT-NEXT: s_nop 0
12352 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
12353 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12354 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
12355 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
12356 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12357 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[4:5]
12358 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12360 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_release_atomicrmw:
12361 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12362 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
12363 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
12364 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
12365 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
12366 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12367 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
12368 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
12369 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12370 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1] sc1
12371 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12373 ; GFX940-TGSPLIT-LABEL: global_system_one_as_release_atomicrmw:
12374 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12375 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
12376 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
12377 ; GFX940-TGSPLIT-NEXT: s_nop 0
12378 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
12379 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12380 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
12381 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
12382 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12383 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1] sc1
12384 ; GFX940-TGSPLIT-NEXT: s_endpgm
12386 ; GFX11-WGP-LABEL: global_system_one_as_release_atomicrmw:
12387 ; GFX11-WGP: ; %bb.0: ; %entry
12388 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
12389 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
12390 ; GFX11-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
12391 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12392 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
12393 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12394 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12395 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
12396 ; GFX11-WGP-NEXT: s_endpgm
12398 ; GFX11-CU-LABEL: global_system_one_as_release_atomicrmw:
12399 ; GFX11-CU: ; %bb.0: ; %entry
12400 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
12401 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
12402 ; GFX11-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
12403 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12404 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
12405 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12406 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
12407 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
12408 ; GFX11-CU-NEXT: s_endpgm
12410 ; GFX12-WGP-LABEL: global_system_one_as_release_atomicrmw:
12411 ; GFX12-WGP: ; %bb.0: ; %entry
12412 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
12413 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
12414 ; GFX12-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
12415 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
12416 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
12417 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
12418 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
12419 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
12420 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
12421 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
12422 ; GFX12-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1] scope:SCOPE_SYS
12423 ; GFX12-WGP-NEXT: s_endpgm
12425 ; GFX12-CU-LABEL: global_system_one_as_release_atomicrmw:
12426 ; GFX12-CU: ; %bb.0: ; %entry
12427 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
12428 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
12429 ; GFX12-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
12430 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
12431 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
12432 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
12433 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
12434 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
12435 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
12436 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
12437 ; GFX12-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1] scope:SCOPE_SYS
12438 ; GFX12-CU-NEXT: s_endpgm
12439 ptr addrspace(1) %out, i32 %in) {
12441 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in syncscope("one-as") release
12445 define amdgpu_kernel void @global_system_one_as_acq_rel_atomicrmw(
12446 ; GFX6-LABEL: global_system_one_as_acq_rel_atomicrmw:
12447 ; GFX6: ; %bb.0: ; %entry
12448 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
12449 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x2
12450 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
12451 ; GFX6-NEXT: s_mov_b32 s11, s5
12452 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
12453 ; GFX6-NEXT: s_mov_b32 s9, 0x100f000
12454 ; GFX6-NEXT: s_mov_b32 s10, -1
12455 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
12456 ; GFX6-NEXT: s_mov_b32 s5, s11
12457 ; GFX6-NEXT: s_mov_b32 s6, s10
12458 ; GFX6-NEXT: s_mov_b32 s7, s9
12459 ; GFX6-NEXT: v_mov_b32_e32 v0, s8
12460 ; GFX6-NEXT: s_waitcnt vmcnt(0)
12461 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[4:7], 0
12462 ; GFX6-NEXT: s_waitcnt vmcnt(0)
12463 ; GFX6-NEXT: buffer_wbinvl1
12464 ; GFX6-NEXT: s_endpgm
12466 ; GFX7-LABEL: global_system_one_as_acq_rel_atomicrmw:
12467 ; GFX7: ; %bb.0: ; %entry
12468 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
12469 ; GFX7-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
12470 ; GFX7-NEXT: s_load_dword s4, s[4:5], 0x2
12471 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12472 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
12473 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
12474 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
12475 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12476 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
12477 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12478 ; GFX7-NEXT: buffer_wbinvl1_vol
12479 ; GFX7-NEXT: s_endpgm
12481 ; GFX10-WGP-LABEL: global_system_one_as_acq_rel_atomicrmw:
12482 ; GFX10-WGP: ; %bb.0: ; %entry
12483 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
12484 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
12485 ; GFX10-WGP-NEXT: s_nop 0
12486 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
12487 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12488 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
12489 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12490 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12491 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[4:5]
12492 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12493 ; GFX10-WGP-NEXT: buffer_gl1_inv
12494 ; GFX10-WGP-NEXT: buffer_gl0_inv
12495 ; GFX10-WGP-NEXT: s_endpgm
12497 ; GFX10-CU-LABEL: global_system_one_as_acq_rel_atomicrmw:
12498 ; GFX10-CU: ; %bb.0: ; %entry
12499 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
12500 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
12501 ; GFX10-CU-NEXT: s_nop 0
12502 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
12503 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12504 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
12505 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12506 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
12507 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[4:5]
12508 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
12509 ; GFX10-CU-NEXT: buffer_gl1_inv
12510 ; GFX10-CU-NEXT: buffer_gl0_inv
12511 ; GFX10-CU-NEXT: s_endpgm
12513 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acq_rel_atomicrmw:
12514 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12515 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
12516 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x2
12517 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12518 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s1
12519 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
12520 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, 0xf000
12521 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
12522 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
12523 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s7
12524 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s6
12525 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s5
12526 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
12527 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12528 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
12529 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12530 ; SKIP-CACHE-INV-NEXT: s_endpgm
12532 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_atomicrmw:
12533 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12534 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
12535 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
12536 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
12537 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
12538 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12539 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
12540 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
12541 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12542 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[4:5]
12543 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12544 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
12545 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
12546 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12548 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acq_rel_atomicrmw:
12549 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12550 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
12551 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
12552 ; GFX90A-TGSPLIT-NEXT: s_nop 0
12553 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
12554 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12555 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
12556 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
12557 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12558 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[4:5]
12559 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12560 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
12561 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
12562 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12564 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_atomicrmw:
12565 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12566 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
12567 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
12568 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
12569 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
12570 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12571 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
12572 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
12573 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12574 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1] sc1
12575 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12576 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
12577 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12579 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acq_rel_atomicrmw:
12580 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12581 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
12582 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
12583 ; GFX940-TGSPLIT-NEXT: s_nop 0
12584 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
12585 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12586 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
12587 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
12588 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12589 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1] sc1
12590 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12591 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
12592 ; GFX940-TGSPLIT-NEXT: s_endpgm
12594 ; GFX11-WGP-LABEL: global_system_one_as_acq_rel_atomicrmw:
12595 ; GFX11-WGP: ; %bb.0: ; %entry
12596 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
12597 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
12598 ; GFX11-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
12599 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12600 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
12601 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12602 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12603 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
12604 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12605 ; GFX11-WGP-NEXT: buffer_gl1_inv
12606 ; GFX11-WGP-NEXT: buffer_gl0_inv
12607 ; GFX11-WGP-NEXT: s_endpgm
12609 ; GFX11-CU-LABEL: global_system_one_as_acq_rel_atomicrmw:
12610 ; GFX11-CU: ; %bb.0: ; %entry
12611 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
12612 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
12613 ; GFX11-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
12614 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12615 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
12616 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12617 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
12618 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
12619 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
12620 ; GFX11-CU-NEXT: buffer_gl1_inv
12621 ; GFX11-CU-NEXT: buffer_gl0_inv
12622 ; GFX11-CU-NEXT: s_endpgm
12624 ; GFX12-WGP-LABEL: global_system_one_as_acq_rel_atomicrmw:
12625 ; GFX12-WGP: ; %bb.0: ; %entry
12626 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
12627 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
12628 ; GFX12-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
12629 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
12630 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
12631 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
12632 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
12633 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
12634 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
12635 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
12636 ; GFX12-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1] scope:SCOPE_SYS
12637 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
12638 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
12639 ; GFX12-WGP-NEXT: s_endpgm
12641 ; GFX12-CU-LABEL: global_system_one_as_acq_rel_atomicrmw:
12642 ; GFX12-CU: ; %bb.0: ; %entry
12643 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
12644 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
12645 ; GFX12-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
12646 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
12647 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
12648 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
12649 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
12650 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
12651 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
12652 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
12653 ; GFX12-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1] scope:SCOPE_SYS
12654 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
12655 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
12656 ; GFX12-CU-NEXT: s_endpgm
12657 ptr addrspace(1) %out, i32 %in) {
12659 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in syncscope("one-as") acq_rel
12663 define amdgpu_kernel void @global_system_one_as_seq_cst_atomicrmw(
12664 ; GFX6-LABEL: global_system_one_as_seq_cst_atomicrmw:
12665 ; GFX6: ; %bb.0: ; %entry
12666 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
12667 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x2
12668 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
12669 ; GFX6-NEXT: s_mov_b32 s11, s5
12670 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
12671 ; GFX6-NEXT: s_mov_b32 s9, 0x100f000
12672 ; GFX6-NEXT: s_mov_b32 s10, -1
12673 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
12674 ; GFX6-NEXT: s_mov_b32 s5, s11
12675 ; GFX6-NEXT: s_mov_b32 s6, s10
12676 ; GFX6-NEXT: s_mov_b32 s7, s9
12677 ; GFX6-NEXT: v_mov_b32_e32 v0, s8
12678 ; GFX6-NEXT: s_waitcnt vmcnt(0)
12679 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[4:7], 0
12680 ; GFX6-NEXT: s_waitcnt vmcnt(0)
12681 ; GFX6-NEXT: buffer_wbinvl1
12682 ; GFX6-NEXT: s_endpgm
12684 ; GFX7-LABEL: global_system_one_as_seq_cst_atomicrmw:
12685 ; GFX7: ; %bb.0: ; %entry
12686 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
12687 ; GFX7-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x0
12688 ; GFX7-NEXT: s_load_dword s4, s[4:5], 0x2
12689 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12690 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
12691 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
12692 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
12693 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12694 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
12695 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12696 ; GFX7-NEXT: buffer_wbinvl1_vol
12697 ; GFX7-NEXT: s_endpgm
12699 ; GFX10-WGP-LABEL: global_system_one_as_seq_cst_atomicrmw:
12700 ; GFX10-WGP: ; %bb.0: ; %entry
12701 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
12702 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
12703 ; GFX10-WGP-NEXT: s_nop 0
12704 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
12705 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12706 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
12707 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12708 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12709 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[4:5]
12710 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12711 ; GFX10-WGP-NEXT: buffer_gl1_inv
12712 ; GFX10-WGP-NEXT: buffer_gl0_inv
12713 ; GFX10-WGP-NEXT: s_endpgm
12715 ; GFX10-CU-LABEL: global_system_one_as_seq_cst_atomicrmw:
12716 ; GFX10-CU: ; %bb.0: ; %entry
12717 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
12718 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
12719 ; GFX10-CU-NEXT: s_nop 0
12720 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
12721 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12722 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
12723 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12724 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
12725 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[4:5]
12726 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
12727 ; GFX10-CU-NEXT: buffer_gl1_inv
12728 ; GFX10-CU-NEXT: buffer_gl0_inv
12729 ; GFX10-CU-NEXT: s_endpgm
12731 ; SKIP-CACHE-INV-LABEL: global_system_one_as_seq_cst_atomicrmw:
12732 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12733 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
12734 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x2
12735 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12736 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s1
12737 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
12738 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, 0xf000
12739 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
12740 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
12741 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s7
12742 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s6
12743 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s5
12744 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
12745 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12746 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
12747 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12748 ; SKIP-CACHE-INV-NEXT: s_endpgm
12750 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_atomicrmw:
12751 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12752 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
12753 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
12754 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
12755 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
12756 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12757 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
12758 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
12759 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12760 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[4:5]
12761 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12762 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
12763 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
12764 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12766 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_seq_cst_atomicrmw:
12767 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12768 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
12769 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
12770 ; GFX90A-TGSPLIT-NEXT: s_nop 0
12771 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
12772 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12773 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
12774 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
12775 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12776 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[4:5]
12777 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12778 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
12779 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
12780 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12782 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_atomicrmw:
12783 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12784 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
12785 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
12786 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
12787 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
12788 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12789 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
12790 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
12791 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12792 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1] sc1
12793 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12794 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
12795 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12797 ; GFX940-TGSPLIT-LABEL: global_system_one_as_seq_cst_atomicrmw:
12798 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12799 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
12800 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
12801 ; GFX940-TGSPLIT-NEXT: s_nop 0
12802 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
12803 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12804 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
12805 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
12806 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12807 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1] sc1
12808 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12809 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
12810 ; GFX940-TGSPLIT-NEXT: s_endpgm
12812 ; GFX11-WGP-LABEL: global_system_one_as_seq_cst_atomicrmw:
12813 ; GFX11-WGP: ; %bb.0: ; %entry
12814 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
12815 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
12816 ; GFX11-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
12817 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12818 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
12819 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12820 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12821 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
12822 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12823 ; GFX11-WGP-NEXT: buffer_gl1_inv
12824 ; GFX11-WGP-NEXT: buffer_gl0_inv
12825 ; GFX11-WGP-NEXT: s_endpgm
12827 ; GFX11-CU-LABEL: global_system_one_as_seq_cst_atomicrmw:
12828 ; GFX11-CU: ; %bb.0: ; %entry
12829 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
12830 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
12831 ; GFX11-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
12832 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12833 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
12834 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12835 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
12836 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
12837 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
12838 ; GFX11-CU-NEXT: buffer_gl1_inv
12839 ; GFX11-CU-NEXT: buffer_gl0_inv
12840 ; GFX11-CU-NEXT: s_endpgm
12842 ; GFX12-WGP-LABEL: global_system_one_as_seq_cst_atomicrmw:
12843 ; GFX12-WGP: ; %bb.0: ; %entry
12844 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
12845 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
12846 ; GFX12-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
12847 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
12848 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
12849 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
12850 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
12851 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
12852 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
12853 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
12854 ; GFX12-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1] scope:SCOPE_SYS
12855 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
12856 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
12857 ; GFX12-WGP-NEXT: s_endpgm
12859 ; GFX12-CU-LABEL: global_system_one_as_seq_cst_atomicrmw:
12860 ; GFX12-CU: ; %bb.0: ; %entry
12861 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
12862 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
12863 ; GFX12-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
12864 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
12865 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
12866 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
12867 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
12868 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
12869 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
12870 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
12871 ; GFX12-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1] scope:SCOPE_SYS
12872 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
12873 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
12874 ; GFX12-CU-NEXT: s_endpgm
12875 ptr addrspace(1) %out, i32 %in) {
12877 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in syncscope("one-as") seq_cst
12881 define amdgpu_kernel void @global_system_one_as_acquire_ret_atomicrmw(
12882 ; GFX6-LABEL: global_system_one_as_acquire_ret_atomicrmw:
12883 ; GFX6: ; %bb.0: ; %entry
12884 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
12885 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x2
12886 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
12887 ; GFX6-NEXT: s_mov_b32 s11, s5
12888 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
12889 ; GFX6-NEXT: s_mov_b32 s9, 0x100f000
12890 ; GFX6-NEXT: s_mov_b32 s10, -1
12891 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
12892 ; GFX6-NEXT: s_mov_b32 s5, s11
12893 ; GFX6-NEXT: s_mov_b32 s6, s10
12894 ; GFX6-NEXT: s_mov_b32 s7, s9
12895 ; GFX6-NEXT: v_mov_b32_e32 v0, s8
12896 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[4:7], 0 glc
12897 ; GFX6-NEXT: s_waitcnt vmcnt(0)
12898 ; GFX6-NEXT: buffer_wbinvl1
12899 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
12900 ; GFX6-NEXT: s_endpgm
12902 ; GFX7-LABEL: global_system_one_as_acquire_ret_atomicrmw:
12903 ; GFX7: ; %bb.0: ; %entry
12904 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
12905 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
12906 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12907 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
12908 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
12909 ; GFX7-NEXT: v_mov_b32_e32 v2, s6
12910 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
12911 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12912 ; GFX7-NEXT: buffer_wbinvl1_vol
12913 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
12914 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
12915 ; GFX7-NEXT: flat_store_dword v[0:1], v2
12916 ; GFX7-NEXT: s_endpgm
12918 ; GFX10-WGP-LABEL: global_system_one_as_acquire_ret_atomicrmw:
12919 ; GFX10-WGP: ; %bb.0: ; %entry
12920 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
12921 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
12922 ; GFX10-WGP-NEXT: s_nop 0
12923 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
12924 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12925 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
12926 ; GFX10-WGP-NEXT: global_atomic_swap v1, v0, v1, s[4:5] glc
12927 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12928 ; GFX10-WGP-NEXT: buffer_gl1_inv
12929 ; GFX10-WGP-NEXT: buffer_gl0_inv
12930 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
12931 ; GFX10-WGP-NEXT: s_endpgm
12933 ; GFX10-CU-LABEL: global_system_one_as_acquire_ret_atomicrmw:
12934 ; GFX10-CU: ; %bb.0: ; %entry
12935 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
12936 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
12937 ; GFX10-CU-NEXT: s_nop 0
12938 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
12939 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12940 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
12941 ; GFX10-CU-NEXT: global_atomic_swap v1, v0, v1, s[4:5] glc
12942 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12943 ; GFX10-CU-NEXT: buffer_gl1_inv
12944 ; GFX10-CU-NEXT: buffer_gl0_inv
12945 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
12946 ; GFX10-CU-NEXT: s_endpgm
12948 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acquire_ret_atomicrmw:
12949 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12950 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
12951 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x2
12952 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12953 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s1
12954 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
12955 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, 0xf000
12956 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
12957 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
12958 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s7
12959 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s6
12960 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s5
12961 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
12962 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
12963 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12964 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
12965 ; SKIP-CACHE-INV-NEXT: s_endpgm
12967 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acquire_ret_atomicrmw:
12968 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12969 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
12970 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
12971 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
12972 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
12973 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12974 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
12975 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[4:5] glc
12976 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12977 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
12978 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
12979 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
12980 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12982 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acquire_ret_atomicrmw:
12983 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12984 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
12985 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
12986 ; GFX90A-TGSPLIT-NEXT: s_nop 0
12987 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
12988 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12989 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
12990 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[4:5] glc
12991 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12992 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
12993 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
12994 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
12995 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12997 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acquire_ret_atomicrmw:
12998 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12999 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
13000 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
13001 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
13002 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
13003 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13004 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
13005 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] sc0 sc1
13006 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13007 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
13008 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
13009 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
13011 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acquire_ret_atomicrmw:
13012 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
13013 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
13014 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
13015 ; GFX940-TGSPLIT-NEXT: s_nop 0
13016 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
13017 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13018 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
13019 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] sc0 sc1
13020 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13021 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
13022 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
13023 ; GFX940-TGSPLIT-NEXT: s_endpgm
13025 ; GFX11-WGP-LABEL: global_system_one_as_acquire_ret_atomicrmw:
13026 ; GFX11-WGP: ; %bb.0: ; %entry
13027 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
13028 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
13029 ; GFX11-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
13030 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13031 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
13032 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
13033 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13034 ; GFX11-WGP-NEXT: buffer_gl1_inv
13035 ; GFX11-WGP-NEXT: buffer_gl0_inv
13036 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
13037 ; GFX11-WGP-NEXT: s_endpgm
13039 ; GFX11-CU-LABEL: global_system_one_as_acquire_ret_atomicrmw:
13040 ; GFX11-CU: ; %bb.0: ; %entry
13041 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
13042 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
13043 ; GFX11-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
13044 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13045 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
13046 ; GFX11-CU-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
13047 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13048 ; GFX11-CU-NEXT: buffer_gl1_inv
13049 ; GFX11-CU-NEXT: buffer_gl0_inv
13050 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
13051 ; GFX11-CU-NEXT: s_endpgm
13053 ; GFX12-WGP-LABEL: global_system_one_as_acquire_ret_atomicrmw:
13054 ; GFX12-WGP: ; %bb.0: ; %entry
13055 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
13056 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
13057 ; GFX12-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
13058 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
13059 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
13060 ; GFX12-WGP-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] th:TH_ATOMIC_RETURN scope:SCOPE_SYS
13061 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
13062 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
13063 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
13064 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
13065 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
13066 ; GFX12-WGP-NEXT: s_endpgm
13068 ; GFX12-CU-LABEL: global_system_one_as_acquire_ret_atomicrmw:
13069 ; GFX12-CU: ; %bb.0: ; %entry
13070 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
13071 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
13072 ; GFX12-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
13073 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
13074 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
13075 ; GFX12-CU-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] th:TH_ATOMIC_RETURN scope:SCOPE_SYS
13076 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
13077 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
13078 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
13079 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
13080 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
13081 ; GFX12-CU-NEXT: s_endpgm
13082 ptr addrspace(1) %out, i32 %in) {
13084 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in syncscope("one-as") acquire
13085 store i32 %val, ptr addrspace(1) %out, align 4
13089 define amdgpu_kernel void @global_system_one_as_acq_rel_ret_atomicrmw(
13090 ; GFX6-LABEL: global_system_one_as_acq_rel_ret_atomicrmw:
13091 ; GFX6: ; %bb.0: ; %entry
13092 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
13093 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x2
13094 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
13095 ; GFX6-NEXT: s_mov_b32 s11, s5
13096 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
13097 ; GFX6-NEXT: s_mov_b32 s9, 0x100f000
13098 ; GFX6-NEXT: s_mov_b32 s10, -1
13099 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
13100 ; GFX6-NEXT: s_mov_b32 s5, s11
13101 ; GFX6-NEXT: s_mov_b32 s6, s10
13102 ; GFX6-NEXT: s_mov_b32 s7, s9
13103 ; GFX6-NEXT: v_mov_b32_e32 v0, s8
13104 ; GFX6-NEXT: s_waitcnt vmcnt(0)
13105 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[4:7], 0 glc
13106 ; GFX6-NEXT: s_waitcnt vmcnt(0)
13107 ; GFX6-NEXT: buffer_wbinvl1
13108 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
13109 ; GFX6-NEXT: s_endpgm
13111 ; GFX7-LABEL: global_system_one_as_acq_rel_ret_atomicrmw:
13112 ; GFX7: ; %bb.0: ; %entry
13113 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
13114 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
13115 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13116 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
13117 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
13118 ; GFX7-NEXT: v_mov_b32_e32 v2, s6
13119 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13120 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
13121 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13122 ; GFX7-NEXT: buffer_wbinvl1_vol
13123 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
13124 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
13125 ; GFX7-NEXT: flat_store_dword v[0:1], v2
13126 ; GFX7-NEXT: s_endpgm
13128 ; GFX10-WGP-LABEL: global_system_one_as_acq_rel_ret_atomicrmw:
13129 ; GFX10-WGP: ; %bb.0: ; %entry
13130 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
13131 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
13132 ; GFX10-WGP-NEXT: s_nop 0
13133 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
13134 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13135 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
13136 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13137 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13138 ; GFX10-WGP-NEXT: global_atomic_swap v1, v0, v1, s[4:5] glc
13139 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13140 ; GFX10-WGP-NEXT: buffer_gl1_inv
13141 ; GFX10-WGP-NEXT: buffer_gl0_inv
13142 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
13143 ; GFX10-WGP-NEXT: s_endpgm
13145 ; GFX10-CU-LABEL: global_system_one_as_acq_rel_ret_atomicrmw:
13146 ; GFX10-CU: ; %bb.0: ; %entry
13147 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
13148 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
13149 ; GFX10-CU-NEXT: s_nop 0
13150 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
13151 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13152 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
13153 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13154 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
13155 ; GFX10-CU-NEXT: global_atomic_swap v1, v0, v1, s[4:5] glc
13156 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13157 ; GFX10-CU-NEXT: buffer_gl1_inv
13158 ; GFX10-CU-NEXT: buffer_gl0_inv
13159 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
13160 ; GFX10-CU-NEXT: s_endpgm
13162 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acq_rel_ret_atomicrmw:
13163 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
13164 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
13165 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x2
13166 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13167 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s1
13168 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
13169 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, 0xf000
13170 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
13171 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
13172 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s7
13173 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s6
13174 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s5
13175 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
13176 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13177 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
13178 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13179 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
13180 ; SKIP-CACHE-INV-NEXT: s_endpgm
13182 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_ret_atomicrmw:
13183 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
13184 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
13185 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
13186 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
13187 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
13188 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13189 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
13190 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
13191 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13192 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[4:5] glc
13193 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13194 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
13195 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
13196 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
13197 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
13199 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acq_rel_ret_atomicrmw:
13200 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
13201 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
13202 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
13203 ; GFX90A-TGSPLIT-NEXT: s_nop 0
13204 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
13205 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13206 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
13207 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
13208 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13209 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[4:5] glc
13210 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13211 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
13212 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
13213 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
13214 ; GFX90A-TGSPLIT-NEXT: s_endpgm
13216 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_ret_atomicrmw:
13217 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
13218 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
13219 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
13220 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
13221 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
13222 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13223 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
13224 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13225 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13226 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] sc0 sc1
13227 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13228 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
13229 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
13230 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
13232 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acq_rel_ret_atomicrmw:
13233 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
13234 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
13235 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
13236 ; GFX940-TGSPLIT-NEXT: s_nop 0
13237 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
13238 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13239 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
13240 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13241 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13242 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] sc0 sc1
13243 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13244 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
13245 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
13246 ; GFX940-TGSPLIT-NEXT: s_endpgm
13248 ; GFX11-WGP-LABEL: global_system_one_as_acq_rel_ret_atomicrmw:
13249 ; GFX11-WGP: ; %bb.0: ; %entry
13250 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
13251 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
13252 ; GFX11-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
13253 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13254 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
13255 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13256 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13257 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
13258 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13259 ; GFX11-WGP-NEXT: buffer_gl1_inv
13260 ; GFX11-WGP-NEXT: buffer_gl0_inv
13261 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
13262 ; GFX11-WGP-NEXT: s_endpgm
13264 ; GFX11-CU-LABEL: global_system_one_as_acq_rel_ret_atomicrmw:
13265 ; GFX11-CU: ; %bb.0: ; %entry
13266 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
13267 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
13268 ; GFX11-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
13269 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13270 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
13271 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13272 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
13273 ; GFX11-CU-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
13274 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13275 ; GFX11-CU-NEXT: buffer_gl1_inv
13276 ; GFX11-CU-NEXT: buffer_gl0_inv
13277 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
13278 ; GFX11-CU-NEXT: s_endpgm
13280 ; GFX12-WGP-LABEL: global_system_one_as_acq_rel_ret_atomicrmw:
13281 ; GFX12-WGP: ; %bb.0: ; %entry
13282 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
13283 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
13284 ; GFX12-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
13285 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
13286 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
13287 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
13288 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
13289 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
13290 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
13291 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
13292 ; GFX12-WGP-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] th:TH_ATOMIC_RETURN scope:SCOPE_SYS
13293 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
13294 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
13295 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
13296 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
13297 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
13298 ; GFX12-WGP-NEXT: s_endpgm
13300 ; GFX12-CU-LABEL: global_system_one_as_acq_rel_ret_atomicrmw:
13301 ; GFX12-CU: ; %bb.0: ; %entry
13302 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
13303 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
13304 ; GFX12-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
13305 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
13306 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
13307 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
13308 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
13309 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
13310 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
13311 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
13312 ; GFX12-CU-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] th:TH_ATOMIC_RETURN scope:SCOPE_SYS
13313 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
13314 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
13315 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
13316 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
13317 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
13318 ; GFX12-CU-NEXT: s_endpgm
13319 ptr addrspace(1) %out, i32 %in) {
13321 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in syncscope("one-as") acq_rel
13322 store i32 %val, ptr addrspace(1) %out, align 4
13326 define amdgpu_kernel void @global_system_one_as_seq_cst_ret_atomicrmw(
13327 ; GFX6-LABEL: global_system_one_as_seq_cst_ret_atomicrmw:
13328 ; GFX6: ; %bb.0: ; %entry
13329 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
13330 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x2
13331 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
13332 ; GFX6-NEXT: s_mov_b32 s11, s5
13333 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
13334 ; GFX6-NEXT: s_mov_b32 s9, 0x100f000
13335 ; GFX6-NEXT: s_mov_b32 s10, -1
13336 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
13337 ; GFX6-NEXT: s_mov_b32 s5, s11
13338 ; GFX6-NEXT: s_mov_b32 s6, s10
13339 ; GFX6-NEXT: s_mov_b32 s7, s9
13340 ; GFX6-NEXT: v_mov_b32_e32 v0, s8
13341 ; GFX6-NEXT: s_waitcnt vmcnt(0)
13342 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[4:7], 0 glc
13343 ; GFX6-NEXT: s_waitcnt vmcnt(0)
13344 ; GFX6-NEXT: buffer_wbinvl1
13345 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
13346 ; GFX6-NEXT: s_endpgm
13348 ; GFX7-LABEL: global_system_one_as_seq_cst_ret_atomicrmw:
13349 ; GFX7: ; %bb.0: ; %entry
13350 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
13351 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
13352 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13353 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
13354 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
13355 ; GFX7-NEXT: v_mov_b32_e32 v2, s6
13356 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13357 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
13358 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13359 ; GFX7-NEXT: buffer_wbinvl1_vol
13360 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
13361 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
13362 ; GFX7-NEXT: flat_store_dword v[0:1], v2
13363 ; GFX7-NEXT: s_endpgm
13365 ; GFX10-WGP-LABEL: global_system_one_as_seq_cst_ret_atomicrmw:
13366 ; GFX10-WGP: ; %bb.0: ; %entry
13367 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
13368 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
13369 ; GFX10-WGP-NEXT: s_nop 0
13370 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
13371 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13372 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
13373 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13374 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13375 ; GFX10-WGP-NEXT: global_atomic_swap v1, v0, v1, s[4:5] glc
13376 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13377 ; GFX10-WGP-NEXT: buffer_gl1_inv
13378 ; GFX10-WGP-NEXT: buffer_gl0_inv
13379 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
13380 ; GFX10-WGP-NEXT: s_endpgm
13382 ; GFX10-CU-LABEL: global_system_one_as_seq_cst_ret_atomicrmw:
13383 ; GFX10-CU: ; %bb.0: ; %entry
13384 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
13385 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
13386 ; GFX10-CU-NEXT: s_nop 0
13387 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
13388 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13389 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
13390 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13391 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
13392 ; GFX10-CU-NEXT: global_atomic_swap v1, v0, v1, s[4:5] glc
13393 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13394 ; GFX10-CU-NEXT: buffer_gl1_inv
13395 ; GFX10-CU-NEXT: buffer_gl0_inv
13396 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
13397 ; GFX10-CU-NEXT: s_endpgm
13399 ; SKIP-CACHE-INV-LABEL: global_system_one_as_seq_cst_ret_atomicrmw:
13400 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
13401 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
13402 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x2
13403 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13404 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, s1
13405 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
13406 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, 0xf000
13407 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
13408 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
13409 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s7
13410 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s6
13411 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s5
13412 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
13413 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13414 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
13415 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13416 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
13417 ; SKIP-CACHE-INV-NEXT: s_endpgm
13419 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_ret_atomicrmw:
13420 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
13421 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
13422 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
13423 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
13424 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
13425 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13426 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
13427 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
13428 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13429 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[4:5] glc
13430 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13431 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
13432 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
13433 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
13434 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
13436 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_seq_cst_ret_atomicrmw:
13437 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
13438 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
13439 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
13440 ; GFX90A-TGSPLIT-NEXT: s_nop 0
13441 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
13442 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13443 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
13444 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
13445 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13446 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[4:5] glc
13447 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13448 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
13449 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
13450 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
13451 ; GFX90A-TGSPLIT-NEXT: s_endpgm
13453 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_ret_atomicrmw:
13454 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
13455 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
13456 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
13457 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
13458 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
13459 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13460 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
13461 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13462 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13463 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] sc0 sc1
13464 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13465 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
13466 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
13467 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
13469 ; GFX940-TGSPLIT-LABEL: global_system_one_as_seq_cst_ret_atomicrmw:
13470 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
13471 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
13472 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
13473 ; GFX940-TGSPLIT-NEXT: s_nop 0
13474 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
13475 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13476 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
13477 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13478 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13479 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] sc0 sc1
13480 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13481 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
13482 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
13483 ; GFX940-TGSPLIT-NEXT: s_endpgm
13485 ; GFX11-WGP-LABEL: global_system_one_as_seq_cst_ret_atomicrmw:
13486 ; GFX11-WGP: ; %bb.0: ; %entry
13487 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
13488 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
13489 ; GFX11-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
13490 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13491 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
13492 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13493 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13494 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
13495 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13496 ; GFX11-WGP-NEXT: buffer_gl1_inv
13497 ; GFX11-WGP-NEXT: buffer_gl0_inv
13498 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
13499 ; GFX11-WGP-NEXT: s_endpgm
13501 ; GFX11-CU-LABEL: global_system_one_as_seq_cst_ret_atomicrmw:
13502 ; GFX11-CU: ; %bb.0: ; %entry
13503 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
13504 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
13505 ; GFX11-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
13506 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13507 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
13508 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13509 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
13510 ; GFX11-CU-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
13511 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13512 ; GFX11-CU-NEXT: buffer_gl1_inv
13513 ; GFX11-CU-NEXT: buffer_gl0_inv
13514 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
13515 ; GFX11-CU-NEXT: s_endpgm
13517 ; GFX12-WGP-LABEL: global_system_one_as_seq_cst_ret_atomicrmw:
13518 ; GFX12-WGP: ; %bb.0: ; %entry
13519 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
13520 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
13521 ; GFX12-WGP-NEXT: s_load_b32 s2, s[2:3], 0x8
13522 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
13523 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
13524 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
13525 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
13526 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
13527 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
13528 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
13529 ; GFX12-WGP-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] th:TH_ATOMIC_RETURN scope:SCOPE_SYS
13530 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
13531 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
13532 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
13533 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
13534 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
13535 ; GFX12-WGP-NEXT: s_endpgm
13537 ; GFX12-CU-LABEL: global_system_one_as_seq_cst_ret_atomicrmw:
13538 ; GFX12-CU: ; %bb.0: ; %entry
13539 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
13540 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[2:3], 0x0
13541 ; GFX12-CU-NEXT: s_load_b32 s2, s[2:3], 0x8
13542 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
13543 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
13544 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
13545 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
13546 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
13547 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
13548 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
13549 ; GFX12-CU-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] th:TH_ATOMIC_RETURN scope:SCOPE_SYS
13550 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
13551 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
13552 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
13553 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
13554 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
13555 ; GFX12-CU-NEXT: s_endpgm
13556 ptr addrspace(1) %out, i32 %in) {
13558 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in syncscope("one-as") seq_cst
13559 store i32 %val, ptr addrspace(1) %out, align 4
13563 define amdgpu_kernel void @global_system_one_as_monotonic_monotonic_cmpxchg(
13564 ; GFX6-LABEL: global_system_one_as_monotonic_monotonic_cmpxchg:
13565 ; GFX6: ; %bb.0: ; %entry
13566 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
13567 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
13568 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
13569 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
13570 ; GFX6-NEXT: s_mov_b32 s12, s5
13571 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
13572 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
13573 ; GFX6-NEXT: s_mov_b32 s11, -1
13574 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
13575 ; GFX6-NEXT: s_mov_b32 s5, s12
13576 ; GFX6-NEXT: s_mov_b32 s6, s11
13577 ; GFX6-NEXT: s_mov_b32 s7, s10
13578 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
13579 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
13580 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
13581 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
13582 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
13583 ; GFX6-NEXT: s_endpgm
13585 ; GFX7-LABEL: global_system_one_as_monotonic_monotonic_cmpxchg:
13586 ; GFX7: ; %bb.0: ; %entry
13587 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
13588 ; GFX7-NEXT: s_load_dwordx2 s[8:9], s[4:5], 0x0
13589 ; GFX7-NEXT: s_load_dword s7, s[4:5], 0x2
13590 ; GFX7-NEXT: s_load_dword s6, s[4:5], 0x3
13591 ; GFX7-NEXT: s_mov_b64 s[10:11], 16
13592 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13593 ; GFX7-NEXT: s_mov_b32 s4, s8
13594 ; GFX7-NEXT: s_mov_b32 s5, s9
13595 ; GFX7-NEXT: s_mov_b32 s9, s10
13596 ; GFX7-NEXT: s_mov_b32 s8, s11
13597 ; GFX7-NEXT: s_add_u32 s4, s4, s9
13598 ; GFX7-NEXT: s_addc_u32 s8, s5, s8
13599 ; GFX7-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5
13600 ; GFX7-NEXT: s_mov_b32 s5, s8
13601 ; GFX7-NEXT: v_mov_b32_e32 v2, s7
13602 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
13603 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
13604 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
13605 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
13606 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
13607 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
13608 ; GFX7-NEXT: s_endpgm
13610 ; GFX10-WGP-LABEL: global_system_one_as_monotonic_monotonic_cmpxchg:
13611 ; GFX10-WGP: ; %bb.0: ; %entry
13612 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
13613 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
13614 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
13615 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
13616 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
13617 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13618 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
13619 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
13620 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
13621 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
13622 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
13623 ; GFX10-WGP-NEXT: s_endpgm
13625 ; GFX10-CU-LABEL: global_system_one_as_monotonic_monotonic_cmpxchg:
13626 ; GFX10-CU: ; %bb.0: ; %entry
13627 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
13628 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
13629 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
13630 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
13631 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
13632 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13633 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
13634 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
13635 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
13636 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
13637 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
13638 ; GFX10-CU-NEXT: s_endpgm
13640 ; SKIP-CACHE-INV-LABEL: global_system_one_as_monotonic_monotonic_cmpxchg:
13641 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
13642 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
13643 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
13644 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
13645 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13646 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
13647 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
13648 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
13649 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
13650 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
13651 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
13652 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
13653 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
13654 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
13655 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
13656 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
13657 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
13658 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16
13659 ; SKIP-CACHE-INV-NEXT: s_endpgm
13661 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_monotonic_cmpxchg:
13662 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
13663 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
13664 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
13665 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
13666 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
13667 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
13668 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13669 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
13670 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
13671 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
13672 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
13673 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
13674 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
13676 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_monotonic_monotonic_cmpxchg:
13677 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
13678 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
13679 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
13680 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
13681 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
13682 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
13683 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13684 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
13685 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
13686 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
13687 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
13688 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
13689 ; GFX90A-TGSPLIT-NEXT: s_endpgm
13691 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_monotonic_cmpxchg:
13692 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
13693 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
13694 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
13695 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
13696 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
13697 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
13698 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13699 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
13700 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
13701 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
13702 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
13703 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
13704 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
13706 ; GFX940-TGSPLIT-LABEL: global_system_one_as_monotonic_monotonic_cmpxchg:
13707 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
13708 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
13709 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
13710 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
13711 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
13712 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
13713 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13714 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
13715 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
13716 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
13717 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
13718 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
13719 ; GFX940-TGSPLIT-NEXT: s_endpgm
13721 ; GFX11-WGP-LABEL: global_system_one_as_monotonic_monotonic_cmpxchg:
13722 ; GFX11-WGP: ; %bb.0: ; %entry
13723 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
13724 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
13725 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
13726 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
13727 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
13728 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13729 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
13730 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
13731 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
13732 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
13733 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
13734 ; GFX11-WGP-NEXT: s_endpgm
13736 ; GFX11-CU-LABEL: global_system_one_as_monotonic_monotonic_cmpxchg:
13737 ; GFX11-CU: ; %bb.0: ; %entry
13738 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
13739 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
13740 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
13741 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
13742 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
13743 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13744 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
13745 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
13746 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
13747 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
13748 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
13749 ; GFX11-CU-NEXT: s_endpgm
13751 ; GFX12-WGP-LABEL: global_system_one_as_monotonic_monotonic_cmpxchg:
13752 ; GFX12-WGP: ; %bb.0: ; %entry
13753 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
13754 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
13755 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
13756 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
13757 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
13758 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
13759 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
13760 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
13761 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
13762 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
13763 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
13764 ; GFX12-WGP-NEXT: s_endpgm
13766 ; GFX12-CU-LABEL: global_system_one_as_monotonic_monotonic_cmpxchg:
13767 ; GFX12-CU: ; %bb.0: ; %entry
13768 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
13769 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
13770 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
13771 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
13772 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
13773 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
13774 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
13775 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
13776 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
13777 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
13778 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
13779 ; GFX12-CU-NEXT: s_endpgm
13780 ptr addrspace(1) %out, i32 %in, i32 %old) {
13782 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
13783 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") monotonic monotonic
13787 define amdgpu_kernel void @global_system_one_as_acquire_monotonic_cmpxchg(
13788 ; GFX6-LABEL: global_system_one_as_acquire_monotonic_cmpxchg:
13789 ; GFX6: ; %bb.0: ; %entry
13790 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
13791 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
13792 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
13793 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
13794 ; GFX6-NEXT: s_mov_b32 s12, s5
13795 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
13796 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
13797 ; GFX6-NEXT: s_mov_b32 s11, -1
13798 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
13799 ; GFX6-NEXT: s_mov_b32 s5, s12
13800 ; GFX6-NEXT: s_mov_b32 s6, s11
13801 ; GFX6-NEXT: s_mov_b32 s7, s10
13802 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
13803 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
13804 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
13805 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
13806 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
13807 ; GFX6-NEXT: s_waitcnt vmcnt(0)
13808 ; GFX6-NEXT: buffer_wbinvl1
13809 ; GFX6-NEXT: s_endpgm
13811 ; GFX7-LABEL: global_system_one_as_acquire_monotonic_cmpxchg:
13812 ; GFX7: ; %bb.0: ; %entry
13813 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
13814 ; GFX7-NEXT: s_load_dwordx2 s[8:9], s[4:5], 0x0
13815 ; GFX7-NEXT: s_load_dword s7, s[4:5], 0x2
13816 ; GFX7-NEXT: s_load_dword s6, s[4:5], 0x3
13817 ; GFX7-NEXT: s_mov_b64 s[10:11], 16
13818 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13819 ; GFX7-NEXT: s_mov_b32 s4, s8
13820 ; GFX7-NEXT: s_mov_b32 s5, s9
13821 ; GFX7-NEXT: s_mov_b32 s9, s10
13822 ; GFX7-NEXT: s_mov_b32 s8, s11
13823 ; GFX7-NEXT: s_add_u32 s4, s4, s9
13824 ; GFX7-NEXT: s_addc_u32 s8, s5, s8
13825 ; GFX7-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5
13826 ; GFX7-NEXT: s_mov_b32 s5, s8
13827 ; GFX7-NEXT: v_mov_b32_e32 v2, s7
13828 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
13829 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
13830 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
13831 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
13832 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
13833 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
13834 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13835 ; GFX7-NEXT: buffer_wbinvl1_vol
13836 ; GFX7-NEXT: s_endpgm
13838 ; GFX10-WGP-LABEL: global_system_one_as_acquire_monotonic_cmpxchg:
13839 ; GFX10-WGP: ; %bb.0: ; %entry
13840 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
13841 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
13842 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
13843 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
13844 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
13845 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13846 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
13847 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
13848 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
13849 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
13850 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
13851 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13852 ; GFX10-WGP-NEXT: buffer_gl1_inv
13853 ; GFX10-WGP-NEXT: buffer_gl0_inv
13854 ; GFX10-WGP-NEXT: s_endpgm
13856 ; GFX10-CU-LABEL: global_system_one_as_acquire_monotonic_cmpxchg:
13857 ; GFX10-CU: ; %bb.0: ; %entry
13858 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
13859 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
13860 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
13861 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
13862 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
13863 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13864 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
13865 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
13866 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
13867 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
13868 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
13869 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
13870 ; GFX10-CU-NEXT: buffer_gl1_inv
13871 ; GFX10-CU-NEXT: buffer_gl0_inv
13872 ; GFX10-CU-NEXT: s_endpgm
13874 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acquire_monotonic_cmpxchg:
13875 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
13876 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
13877 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
13878 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
13879 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13880 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
13881 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
13882 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
13883 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
13884 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
13885 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
13886 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
13887 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
13888 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
13889 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
13890 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
13891 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
13892 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16
13893 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13894 ; SKIP-CACHE-INV-NEXT: s_endpgm
13896 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acquire_monotonic_cmpxchg:
13897 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
13898 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
13899 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
13900 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
13901 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
13902 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
13903 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13904 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
13905 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
13906 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
13907 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
13908 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
13909 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13910 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
13911 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
13912 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
13914 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acquire_monotonic_cmpxchg:
13915 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
13916 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
13917 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
13918 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
13919 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
13920 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
13921 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13922 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
13923 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
13924 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
13925 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
13926 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
13927 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13928 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
13929 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
13930 ; GFX90A-TGSPLIT-NEXT: s_endpgm
13932 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acquire_monotonic_cmpxchg:
13933 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
13934 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
13935 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
13936 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
13937 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
13938 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
13939 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13940 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
13941 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
13942 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
13943 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
13944 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
13945 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13946 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
13947 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
13949 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acquire_monotonic_cmpxchg:
13950 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
13951 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
13952 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
13953 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
13954 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
13955 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
13956 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13957 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
13958 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
13959 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
13960 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
13961 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
13962 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13963 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
13964 ; GFX940-TGSPLIT-NEXT: s_endpgm
13966 ; GFX11-WGP-LABEL: global_system_one_as_acquire_monotonic_cmpxchg:
13967 ; GFX11-WGP: ; %bb.0: ; %entry
13968 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
13969 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
13970 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
13971 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
13972 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
13973 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13974 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
13975 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
13976 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
13977 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
13978 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
13979 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13980 ; GFX11-WGP-NEXT: buffer_gl1_inv
13981 ; GFX11-WGP-NEXT: buffer_gl0_inv
13982 ; GFX11-WGP-NEXT: s_endpgm
13984 ; GFX11-CU-LABEL: global_system_one_as_acquire_monotonic_cmpxchg:
13985 ; GFX11-CU: ; %bb.0: ; %entry
13986 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
13987 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
13988 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
13989 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
13990 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
13991 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13992 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
13993 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
13994 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
13995 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
13996 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
13997 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
13998 ; GFX11-CU-NEXT: buffer_gl1_inv
13999 ; GFX11-CU-NEXT: buffer_gl0_inv
14000 ; GFX11-CU-NEXT: s_endpgm
14002 ; GFX12-WGP-LABEL: global_system_one_as_acquire_monotonic_cmpxchg:
14003 ; GFX12-WGP: ; %bb.0: ; %entry
14004 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
14005 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
14006 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
14007 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
14008 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
14009 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
14010 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
14011 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
14012 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
14013 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
14014 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
14015 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
14016 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
14017 ; GFX12-WGP-NEXT: s_endpgm
14019 ; GFX12-CU-LABEL: global_system_one_as_acquire_monotonic_cmpxchg:
14020 ; GFX12-CU: ; %bb.0: ; %entry
14021 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
14022 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
14023 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
14024 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
14025 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
14026 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
14027 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
14028 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
14029 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
14030 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
14031 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
14032 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
14033 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
14034 ; GFX12-CU-NEXT: s_endpgm
14035 ptr addrspace(1) %out, i32 %in, i32 %old) {
14037 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
14038 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") acquire monotonic
14042 define amdgpu_kernel void @global_system_one_as_release_monotonic_cmpxchg(
14043 ; GFX6-LABEL: global_system_one_as_release_monotonic_cmpxchg:
14044 ; GFX6: ; %bb.0: ; %entry
14045 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
14046 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
14047 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
14048 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
14049 ; GFX6-NEXT: s_mov_b32 s12, s5
14050 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
14051 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
14052 ; GFX6-NEXT: s_mov_b32 s11, -1
14053 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
14054 ; GFX6-NEXT: s_mov_b32 s5, s12
14055 ; GFX6-NEXT: s_mov_b32 s6, s11
14056 ; GFX6-NEXT: s_mov_b32 s7, s10
14057 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
14058 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
14059 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
14060 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
14061 ; GFX6-NEXT: s_waitcnt vmcnt(0)
14062 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
14063 ; GFX6-NEXT: s_endpgm
14065 ; GFX7-LABEL: global_system_one_as_release_monotonic_cmpxchg:
14066 ; GFX7: ; %bb.0: ; %entry
14067 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
14068 ; GFX7-NEXT: s_load_dwordx2 s[8:9], s[4:5], 0x0
14069 ; GFX7-NEXT: s_load_dword s7, s[4:5], 0x2
14070 ; GFX7-NEXT: s_load_dword s6, s[4:5], 0x3
14071 ; GFX7-NEXT: s_mov_b64 s[10:11], 16
14072 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
14073 ; GFX7-NEXT: s_mov_b32 s4, s8
14074 ; GFX7-NEXT: s_mov_b32 s5, s9
14075 ; GFX7-NEXT: s_mov_b32 s9, s10
14076 ; GFX7-NEXT: s_mov_b32 s8, s11
14077 ; GFX7-NEXT: s_add_u32 s4, s4, s9
14078 ; GFX7-NEXT: s_addc_u32 s8, s5, s8
14079 ; GFX7-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5
14080 ; GFX7-NEXT: s_mov_b32 s5, s8
14081 ; GFX7-NEXT: v_mov_b32_e32 v2, s7
14082 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
14083 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
14084 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
14085 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
14086 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
14087 ; GFX7-NEXT: s_waitcnt vmcnt(0)
14088 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
14089 ; GFX7-NEXT: s_endpgm
14091 ; GFX10-WGP-LABEL: global_system_one_as_release_monotonic_cmpxchg:
14092 ; GFX10-WGP: ; %bb.0: ; %entry
14093 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
14094 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
14095 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
14096 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
14097 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
14098 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
14099 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
14100 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
14101 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
14102 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
14103 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
14104 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
14105 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
14106 ; GFX10-WGP-NEXT: s_endpgm
14108 ; GFX10-CU-LABEL: global_system_one_as_release_monotonic_cmpxchg:
14109 ; GFX10-CU: ; %bb.0: ; %entry
14110 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
14111 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
14112 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
14113 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
14114 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
14115 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
14116 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
14117 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
14118 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
14119 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
14120 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
14121 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
14122 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
14123 ; GFX10-CU-NEXT: s_endpgm
14125 ; SKIP-CACHE-INV-LABEL: global_system_one_as_release_monotonic_cmpxchg:
14126 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
14127 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
14128 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
14129 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
14130 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
14131 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
14132 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
14133 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
14134 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
14135 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
14136 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
14137 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
14138 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
14139 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
14140 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
14141 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
14142 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
14143 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
14144 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16
14145 ; SKIP-CACHE-INV-NEXT: s_endpgm
14147 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_release_monotonic_cmpxchg:
14148 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
14149 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
14150 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
14151 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
14152 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
14153 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
14154 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14155 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
14156 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
14157 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
14158 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
14159 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
14160 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
14161 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
14162 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
14164 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_release_monotonic_cmpxchg:
14165 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
14166 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
14167 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
14168 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
14169 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
14170 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
14171 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14172 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
14173 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
14174 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
14175 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
14176 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
14177 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
14178 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
14179 ; GFX90A-TGSPLIT-NEXT: s_endpgm
14181 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_release_monotonic_cmpxchg:
14182 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
14183 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
14184 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
14185 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
14186 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
14187 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
14188 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14189 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
14190 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
14191 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
14192 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
14193 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
14194 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
14195 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
14196 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
14198 ; GFX940-TGSPLIT-LABEL: global_system_one_as_release_monotonic_cmpxchg:
14199 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
14200 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
14201 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
14202 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
14203 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
14204 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
14205 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14206 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
14207 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
14208 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
14209 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
14210 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
14211 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
14212 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
14213 ; GFX940-TGSPLIT-NEXT: s_endpgm
14215 ; GFX11-WGP-LABEL: global_system_one_as_release_monotonic_cmpxchg:
14216 ; GFX11-WGP: ; %bb.0: ; %entry
14217 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
14218 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
14219 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
14220 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
14221 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
14222 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
14223 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
14224 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
14225 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
14226 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
14227 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
14228 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
14229 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
14230 ; GFX11-WGP-NEXT: s_endpgm
14232 ; GFX11-CU-LABEL: global_system_one_as_release_monotonic_cmpxchg:
14233 ; GFX11-CU: ; %bb.0: ; %entry
14234 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
14235 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
14236 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
14237 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
14238 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
14239 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
14240 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
14241 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
14242 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
14243 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
14244 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
14245 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
14246 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
14247 ; GFX11-CU-NEXT: s_endpgm
14249 ; GFX12-WGP-LABEL: global_system_one_as_release_monotonic_cmpxchg:
14250 ; GFX12-WGP: ; %bb.0: ; %entry
14251 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
14252 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
14253 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
14254 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
14255 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
14256 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
14257 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
14258 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
14259 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
14260 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
14261 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
14262 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
14263 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
14264 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
14265 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
14266 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
14267 ; GFX12-WGP-NEXT: s_endpgm
14269 ; GFX12-CU-LABEL: global_system_one_as_release_monotonic_cmpxchg:
14270 ; GFX12-CU: ; %bb.0: ; %entry
14271 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
14272 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
14273 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
14274 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
14275 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
14276 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
14277 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
14278 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
14279 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
14280 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
14281 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
14282 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
14283 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
14284 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
14285 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
14286 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
14287 ; GFX12-CU-NEXT: s_endpgm
14288 ptr addrspace(1) %out, i32 %in, i32 %old) {
14290 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
14291 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") release monotonic
14295 define amdgpu_kernel void @global_system_one_as_acq_rel_monotonic_cmpxchg(
14296 ; GFX6-LABEL: global_system_one_as_acq_rel_monotonic_cmpxchg:
14297 ; GFX6: ; %bb.0: ; %entry
14298 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
14299 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
14300 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
14301 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
14302 ; GFX6-NEXT: s_mov_b32 s12, s5
14303 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
14304 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
14305 ; GFX6-NEXT: s_mov_b32 s11, -1
14306 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
14307 ; GFX6-NEXT: s_mov_b32 s5, s12
14308 ; GFX6-NEXT: s_mov_b32 s6, s11
14309 ; GFX6-NEXT: s_mov_b32 s7, s10
14310 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
14311 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
14312 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
14313 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
14314 ; GFX6-NEXT: s_waitcnt vmcnt(0)
14315 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
14316 ; GFX6-NEXT: s_waitcnt vmcnt(0)
14317 ; GFX6-NEXT: buffer_wbinvl1
14318 ; GFX6-NEXT: s_endpgm
14320 ; GFX7-LABEL: global_system_one_as_acq_rel_monotonic_cmpxchg:
14321 ; GFX7: ; %bb.0: ; %entry
14322 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
14323 ; GFX7-NEXT: s_load_dwordx2 s[8:9], s[4:5], 0x0
14324 ; GFX7-NEXT: s_load_dword s7, s[4:5], 0x2
14325 ; GFX7-NEXT: s_load_dword s6, s[4:5], 0x3
14326 ; GFX7-NEXT: s_mov_b64 s[10:11], 16
14327 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
14328 ; GFX7-NEXT: s_mov_b32 s4, s8
14329 ; GFX7-NEXT: s_mov_b32 s5, s9
14330 ; GFX7-NEXT: s_mov_b32 s9, s10
14331 ; GFX7-NEXT: s_mov_b32 s8, s11
14332 ; GFX7-NEXT: s_add_u32 s4, s4, s9
14333 ; GFX7-NEXT: s_addc_u32 s8, s5, s8
14334 ; GFX7-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5
14335 ; GFX7-NEXT: s_mov_b32 s5, s8
14336 ; GFX7-NEXT: v_mov_b32_e32 v2, s7
14337 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
14338 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
14339 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
14340 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
14341 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
14342 ; GFX7-NEXT: s_waitcnt vmcnt(0)
14343 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
14344 ; GFX7-NEXT: s_waitcnt vmcnt(0)
14345 ; GFX7-NEXT: buffer_wbinvl1_vol
14346 ; GFX7-NEXT: s_endpgm
14348 ; GFX10-WGP-LABEL: global_system_one_as_acq_rel_monotonic_cmpxchg:
14349 ; GFX10-WGP: ; %bb.0: ; %entry
14350 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
14351 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
14352 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
14353 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
14354 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
14355 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
14356 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
14357 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
14358 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
14359 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
14360 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
14361 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
14362 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
14363 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
14364 ; GFX10-WGP-NEXT: buffer_gl1_inv
14365 ; GFX10-WGP-NEXT: buffer_gl0_inv
14366 ; GFX10-WGP-NEXT: s_endpgm
14368 ; GFX10-CU-LABEL: global_system_one_as_acq_rel_monotonic_cmpxchg:
14369 ; GFX10-CU: ; %bb.0: ; %entry
14370 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
14371 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
14372 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
14373 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
14374 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
14375 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
14376 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
14377 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
14378 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
14379 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
14380 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
14381 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
14382 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
14383 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
14384 ; GFX10-CU-NEXT: buffer_gl1_inv
14385 ; GFX10-CU-NEXT: buffer_gl0_inv
14386 ; GFX10-CU-NEXT: s_endpgm
14388 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acq_rel_monotonic_cmpxchg:
14389 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
14390 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
14391 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
14392 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
14393 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
14394 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
14395 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
14396 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
14397 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
14398 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
14399 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
14400 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
14401 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
14402 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
14403 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
14404 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
14405 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
14406 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
14407 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16
14408 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
14409 ; SKIP-CACHE-INV-NEXT: s_endpgm
14411 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_monotonic_cmpxchg:
14412 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
14413 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
14414 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
14415 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
14416 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
14417 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
14418 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14419 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
14420 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
14421 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
14422 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
14423 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
14424 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
14425 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
14426 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
14427 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
14428 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
14429 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
14431 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acq_rel_monotonic_cmpxchg:
14432 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
14433 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
14434 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
14435 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
14436 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
14437 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
14438 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14439 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
14440 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
14441 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
14442 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
14443 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
14444 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
14445 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
14446 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
14447 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
14448 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
14449 ; GFX90A-TGSPLIT-NEXT: s_endpgm
14451 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_monotonic_cmpxchg:
14452 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
14453 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
14454 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
14455 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
14456 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
14457 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
14458 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14459 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
14460 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
14461 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
14462 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
14463 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
14464 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
14465 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
14466 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
14467 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
14468 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
14470 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acq_rel_monotonic_cmpxchg:
14471 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
14472 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
14473 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
14474 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
14475 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
14476 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
14477 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14478 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
14479 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
14480 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
14481 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
14482 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
14483 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
14484 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
14485 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
14486 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
14487 ; GFX940-TGSPLIT-NEXT: s_endpgm
14489 ; GFX11-WGP-LABEL: global_system_one_as_acq_rel_monotonic_cmpxchg:
14490 ; GFX11-WGP: ; %bb.0: ; %entry
14491 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
14492 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
14493 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
14494 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
14495 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
14496 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
14497 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
14498 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
14499 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
14500 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
14501 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
14502 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
14503 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
14504 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
14505 ; GFX11-WGP-NEXT: buffer_gl1_inv
14506 ; GFX11-WGP-NEXT: buffer_gl0_inv
14507 ; GFX11-WGP-NEXT: s_endpgm
14509 ; GFX11-CU-LABEL: global_system_one_as_acq_rel_monotonic_cmpxchg:
14510 ; GFX11-CU: ; %bb.0: ; %entry
14511 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
14512 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
14513 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
14514 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
14515 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
14516 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
14517 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
14518 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
14519 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
14520 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
14521 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
14522 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
14523 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
14524 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
14525 ; GFX11-CU-NEXT: buffer_gl1_inv
14526 ; GFX11-CU-NEXT: buffer_gl0_inv
14527 ; GFX11-CU-NEXT: s_endpgm
14529 ; GFX12-WGP-LABEL: global_system_one_as_acq_rel_monotonic_cmpxchg:
14530 ; GFX12-WGP: ; %bb.0: ; %entry
14531 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
14532 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
14533 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
14534 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
14535 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
14536 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
14537 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
14538 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
14539 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
14540 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
14541 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
14542 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
14543 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
14544 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
14545 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
14546 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
14547 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
14548 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
14549 ; GFX12-WGP-NEXT: s_endpgm
14551 ; GFX12-CU-LABEL: global_system_one_as_acq_rel_monotonic_cmpxchg:
14552 ; GFX12-CU: ; %bb.0: ; %entry
14553 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
14554 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
14555 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
14556 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
14557 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
14558 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
14559 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
14560 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
14561 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
14562 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
14563 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
14564 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
14565 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
14566 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
14567 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
14568 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
14569 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
14570 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
14571 ; GFX12-CU-NEXT: s_endpgm
14572 ptr addrspace(1) %out, i32 %in, i32 %old) {
14574 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
14575 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") acq_rel monotonic
14579 define amdgpu_kernel void @global_system_one_as_seq_cst_monotonic_cmpxchg(
14580 ; GFX6-LABEL: global_system_one_as_seq_cst_monotonic_cmpxchg:
14581 ; GFX6: ; %bb.0: ; %entry
14582 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
14583 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
14584 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
14585 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
14586 ; GFX6-NEXT: s_mov_b32 s12, s5
14587 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
14588 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
14589 ; GFX6-NEXT: s_mov_b32 s11, -1
14590 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
14591 ; GFX6-NEXT: s_mov_b32 s5, s12
14592 ; GFX6-NEXT: s_mov_b32 s6, s11
14593 ; GFX6-NEXT: s_mov_b32 s7, s10
14594 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
14595 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
14596 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
14597 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
14598 ; GFX6-NEXT: s_waitcnt vmcnt(0)
14599 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
14600 ; GFX6-NEXT: s_waitcnt vmcnt(0)
14601 ; GFX6-NEXT: buffer_wbinvl1
14602 ; GFX6-NEXT: s_endpgm
14604 ; GFX7-LABEL: global_system_one_as_seq_cst_monotonic_cmpxchg:
14605 ; GFX7: ; %bb.0: ; %entry
14606 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
14607 ; GFX7-NEXT: s_load_dwordx2 s[8:9], s[4:5], 0x0
14608 ; GFX7-NEXT: s_load_dword s7, s[4:5], 0x2
14609 ; GFX7-NEXT: s_load_dword s6, s[4:5], 0x3
14610 ; GFX7-NEXT: s_mov_b64 s[10:11], 16
14611 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
14612 ; GFX7-NEXT: s_mov_b32 s4, s8
14613 ; GFX7-NEXT: s_mov_b32 s5, s9
14614 ; GFX7-NEXT: s_mov_b32 s9, s10
14615 ; GFX7-NEXT: s_mov_b32 s8, s11
14616 ; GFX7-NEXT: s_add_u32 s4, s4, s9
14617 ; GFX7-NEXT: s_addc_u32 s8, s5, s8
14618 ; GFX7-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5
14619 ; GFX7-NEXT: s_mov_b32 s5, s8
14620 ; GFX7-NEXT: v_mov_b32_e32 v2, s7
14621 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
14622 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
14623 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
14624 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
14625 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
14626 ; GFX7-NEXT: s_waitcnt vmcnt(0)
14627 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
14628 ; GFX7-NEXT: s_waitcnt vmcnt(0)
14629 ; GFX7-NEXT: buffer_wbinvl1_vol
14630 ; GFX7-NEXT: s_endpgm
14632 ; GFX10-WGP-LABEL: global_system_one_as_seq_cst_monotonic_cmpxchg:
14633 ; GFX10-WGP: ; %bb.0: ; %entry
14634 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
14635 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
14636 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
14637 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
14638 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
14639 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
14640 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
14641 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
14642 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
14643 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
14644 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
14645 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
14646 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
14647 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
14648 ; GFX10-WGP-NEXT: buffer_gl1_inv
14649 ; GFX10-WGP-NEXT: buffer_gl0_inv
14650 ; GFX10-WGP-NEXT: s_endpgm
14652 ; GFX10-CU-LABEL: global_system_one_as_seq_cst_monotonic_cmpxchg:
14653 ; GFX10-CU: ; %bb.0: ; %entry
14654 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
14655 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
14656 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
14657 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
14658 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
14659 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
14660 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
14661 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
14662 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
14663 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
14664 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
14665 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
14666 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
14667 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
14668 ; GFX10-CU-NEXT: buffer_gl1_inv
14669 ; GFX10-CU-NEXT: buffer_gl0_inv
14670 ; GFX10-CU-NEXT: s_endpgm
14672 ; SKIP-CACHE-INV-LABEL: global_system_one_as_seq_cst_monotonic_cmpxchg:
14673 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
14674 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
14675 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
14676 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
14677 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
14678 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
14679 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
14680 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
14681 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
14682 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
14683 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
14684 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
14685 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
14686 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
14687 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
14688 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
14689 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
14690 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
14691 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16
14692 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
14693 ; SKIP-CACHE-INV-NEXT: s_endpgm
14695 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_monotonic_cmpxchg:
14696 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
14697 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
14698 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
14699 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
14700 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
14701 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
14702 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14703 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
14704 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
14705 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
14706 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
14707 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
14708 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
14709 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
14710 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
14711 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
14712 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
14713 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
14715 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_seq_cst_monotonic_cmpxchg:
14716 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
14717 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
14718 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
14719 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
14720 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
14721 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
14722 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14723 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
14724 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
14725 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
14726 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
14727 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
14728 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
14729 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
14730 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
14731 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
14732 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
14733 ; GFX90A-TGSPLIT-NEXT: s_endpgm
14735 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_monotonic_cmpxchg:
14736 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
14737 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
14738 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
14739 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
14740 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
14741 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
14742 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14743 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
14744 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
14745 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
14746 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
14747 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
14748 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
14749 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
14750 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
14751 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
14752 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
14754 ; GFX940-TGSPLIT-LABEL: global_system_one_as_seq_cst_monotonic_cmpxchg:
14755 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
14756 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
14757 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
14758 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
14759 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
14760 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
14761 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14762 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
14763 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
14764 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
14765 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
14766 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
14767 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
14768 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
14769 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
14770 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
14771 ; GFX940-TGSPLIT-NEXT: s_endpgm
14773 ; GFX11-WGP-LABEL: global_system_one_as_seq_cst_monotonic_cmpxchg:
14774 ; GFX11-WGP: ; %bb.0: ; %entry
14775 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
14776 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
14777 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
14778 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
14779 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
14780 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
14781 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
14782 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
14783 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
14784 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
14785 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
14786 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
14787 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
14788 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
14789 ; GFX11-WGP-NEXT: buffer_gl1_inv
14790 ; GFX11-WGP-NEXT: buffer_gl0_inv
14791 ; GFX11-WGP-NEXT: s_endpgm
14793 ; GFX11-CU-LABEL: global_system_one_as_seq_cst_monotonic_cmpxchg:
14794 ; GFX11-CU: ; %bb.0: ; %entry
14795 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
14796 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
14797 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
14798 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
14799 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
14800 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
14801 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
14802 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
14803 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
14804 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
14805 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
14806 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
14807 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
14808 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
14809 ; GFX11-CU-NEXT: buffer_gl1_inv
14810 ; GFX11-CU-NEXT: buffer_gl0_inv
14811 ; GFX11-CU-NEXT: s_endpgm
14813 ; GFX12-WGP-LABEL: global_system_one_as_seq_cst_monotonic_cmpxchg:
14814 ; GFX12-WGP: ; %bb.0: ; %entry
14815 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
14816 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
14817 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
14818 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
14819 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
14820 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
14821 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
14822 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
14823 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
14824 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
14825 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
14826 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
14827 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
14828 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
14829 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
14830 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
14831 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
14832 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
14833 ; GFX12-WGP-NEXT: s_endpgm
14835 ; GFX12-CU-LABEL: global_system_one_as_seq_cst_monotonic_cmpxchg:
14836 ; GFX12-CU: ; %bb.0: ; %entry
14837 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
14838 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
14839 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
14840 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
14841 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
14842 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
14843 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
14844 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
14845 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
14846 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
14847 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
14848 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
14849 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
14850 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
14851 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
14852 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
14853 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
14854 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
14855 ; GFX12-CU-NEXT: s_endpgm
14856 ptr addrspace(1) %out, i32 %in, i32 %old) {
14858 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
14859 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") seq_cst monotonic
14863 define amdgpu_kernel void @global_system_one_as_monotonic_acquire_cmpxchg(
14864 ; GFX6-LABEL: global_system_one_as_monotonic_acquire_cmpxchg:
14865 ; GFX6: ; %bb.0: ; %entry
14866 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
14867 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
14868 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
14869 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
14870 ; GFX6-NEXT: s_mov_b32 s12, s5
14871 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
14872 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
14873 ; GFX6-NEXT: s_mov_b32 s11, -1
14874 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
14875 ; GFX6-NEXT: s_mov_b32 s5, s12
14876 ; GFX6-NEXT: s_mov_b32 s6, s11
14877 ; GFX6-NEXT: s_mov_b32 s7, s10
14878 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
14879 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
14880 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
14881 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
14882 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
14883 ; GFX6-NEXT: s_waitcnt vmcnt(0)
14884 ; GFX6-NEXT: buffer_wbinvl1
14885 ; GFX6-NEXT: s_endpgm
14887 ; GFX7-LABEL: global_system_one_as_monotonic_acquire_cmpxchg:
14888 ; GFX7: ; %bb.0: ; %entry
14889 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
14890 ; GFX7-NEXT: s_load_dwordx2 s[8:9], s[4:5], 0x0
14891 ; GFX7-NEXT: s_load_dword s7, s[4:5], 0x2
14892 ; GFX7-NEXT: s_load_dword s6, s[4:5], 0x3
14893 ; GFX7-NEXT: s_mov_b64 s[10:11], 16
14894 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
14895 ; GFX7-NEXT: s_mov_b32 s4, s8
14896 ; GFX7-NEXT: s_mov_b32 s5, s9
14897 ; GFX7-NEXT: s_mov_b32 s9, s10
14898 ; GFX7-NEXT: s_mov_b32 s8, s11
14899 ; GFX7-NEXT: s_add_u32 s4, s4, s9
14900 ; GFX7-NEXT: s_addc_u32 s8, s5, s8
14901 ; GFX7-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5
14902 ; GFX7-NEXT: s_mov_b32 s5, s8
14903 ; GFX7-NEXT: v_mov_b32_e32 v2, s7
14904 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
14905 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
14906 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
14907 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
14908 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
14909 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
14910 ; GFX7-NEXT: s_waitcnt vmcnt(0)
14911 ; GFX7-NEXT: buffer_wbinvl1_vol
14912 ; GFX7-NEXT: s_endpgm
14914 ; GFX10-WGP-LABEL: global_system_one_as_monotonic_acquire_cmpxchg:
14915 ; GFX10-WGP: ; %bb.0: ; %entry
14916 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
14917 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
14918 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
14919 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
14920 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
14921 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
14922 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
14923 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
14924 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
14925 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
14926 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
14927 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
14928 ; GFX10-WGP-NEXT: buffer_gl1_inv
14929 ; GFX10-WGP-NEXT: buffer_gl0_inv
14930 ; GFX10-WGP-NEXT: s_endpgm
14932 ; GFX10-CU-LABEL: global_system_one_as_monotonic_acquire_cmpxchg:
14933 ; GFX10-CU: ; %bb.0: ; %entry
14934 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
14935 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
14936 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
14937 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
14938 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
14939 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
14940 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
14941 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
14942 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
14943 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
14944 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
14945 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
14946 ; GFX10-CU-NEXT: buffer_gl1_inv
14947 ; GFX10-CU-NEXT: buffer_gl0_inv
14948 ; GFX10-CU-NEXT: s_endpgm
14950 ; SKIP-CACHE-INV-LABEL: global_system_one_as_monotonic_acquire_cmpxchg:
14951 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
14952 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
14953 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
14954 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
14955 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
14956 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
14957 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
14958 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
14959 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
14960 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
14961 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
14962 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
14963 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
14964 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
14965 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
14966 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
14967 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
14968 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16
14969 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
14970 ; SKIP-CACHE-INV-NEXT: s_endpgm
14972 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_acquire_cmpxchg:
14973 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
14974 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
14975 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
14976 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
14977 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
14978 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
14979 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14980 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
14981 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
14982 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
14983 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
14984 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
14985 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
14986 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
14987 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
14988 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
14990 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_monotonic_acquire_cmpxchg:
14991 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
14992 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
14993 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
14994 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
14995 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
14996 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
14997 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14998 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
14999 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
15000 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
15001 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
15002 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
15003 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
15004 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
15005 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
15006 ; GFX90A-TGSPLIT-NEXT: s_endpgm
15008 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_acquire_cmpxchg:
15009 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
15010 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
15011 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
15012 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
15013 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
15014 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
15015 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15016 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
15017 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
15018 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
15019 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
15020 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
15021 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
15022 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
15023 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
15025 ; GFX940-TGSPLIT-LABEL: global_system_one_as_monotonic_acquire_cmpxchg:
15026 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
15027 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
15028 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
15029 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
15030 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
15031 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
15032 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15033 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
15034 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
15035 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
15036 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
15037 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
15038 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
15039 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
15040 ; GFX940-TGSPLIT-NEXT: s_endpgm
15042 ; GFX11-WGP-LABEL: global_system_one_as_monotonic_acquire_cmpxchg:
15043 ; GFX11-WGP: ; %bb.0: ; %entry
15044 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
15045 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
15046 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
15047 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
15048 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
15049 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
15050 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
15051 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
15052 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
15053 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
15054 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
15055 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
15056 ; GFX11-WGP-NEXT: buffer_gl1_inv
15057 ; GFX11-WGP-NEXT: buffer_gl0_inv
15058 ; GFX11-WGP-NEXT: s_endpgm
15060 ; GFX11-CU-LABEL: global_system_one_as_monotonic_acquire_cmpxchg:
15061 ; GFX11-CU: ; %bb.0: ; %entry
15062 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
15063 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
15064 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
15065 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
15066 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
15067 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
15068 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
15069 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
15070 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
15071 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
15072 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
15073 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
15074 ; GFX11-CU-NEXT: buffer_gl1_inv
15075 ; GFX11-CU-NEXT: buffer_gl0_inv
15076 ; GFX11-CU-NEXT: s_endpgm
15078 ; GFX12-WGP-LABEL: global_system_one_as_monotonic_acquire_cmpxchg:
15079 ; GFX12-WGP: ; %bb.0: ; %entry
15080 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
15081 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
15082 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
15083 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
15084 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
15085 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
15086 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
15087 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
15088 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
15089 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
15090 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
15091 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
15092 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
15093 ; GFX12-WGP-NEXT: s_endpgm
15095 ; GFX12-CU-LABEL: global_system_one_as_monotonic_acquire_cmpxchg:
15096 ; GFX12-CU: ; %bb.0: ; %entry
15097 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
15098 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
15099 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
15100 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
15101 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
15102 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
15103 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
15104 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
15105 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
15106 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
15107 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
15108 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
15109 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
15110 ; GFX12-CU-NEXT: s_endpgm
15111 ptr addrspace(1) %out, i32 %in, i32 %old) {
15113 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
15114 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") monotonic acquire
15118 define amdgpu_kernel void @global_system_one_as_acquire_acquire_cmpxchg(
15119 ; GFX6-LABEL: global_system_one_as_acquire_acquire_cmpxchg:
15120 ; GFX6: ; %bb.0: ; %entry
15121 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
15122 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
15123 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
15124 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
15125 ; GFX6-NEXT: s_mov_b32 s12, s5
15126 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
15127 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
15128 ; GFX6-NEXT: s_mov_b32 s11, -1
15129 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
15130 ; GFX6-NEXT: s_mov_b32 s5, s12
15131 ; GFX6-NEXT: s_mov_b32 s6, s11
15132 ; GFX6-NEXT: s_mov_b32 s7, s10
15133 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
15134 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
15135 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
15136 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
15137 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
15138 ; GFX6-NEXT: s_waitcnt vmcnt(0)
15139 ; GFX6-NEXT: buffer_wbinvl1
15140 ; GFX6-NEXT: s_endpgm
15142 ; GFX7-LABEL: global_system_one_as_acquire_acquire_cmpxchg:
15143 ; GFX7: ; %bb.0: ; %entry
15144 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
15145 ; GFX7-NEXT: s_load_dwordx2 s[8:9], s[4:5], 0x0
15146 ; GFX7-NEXT: s_load_dword s7, s[4:5], 0x2
15147 ; GFX7-NEXT: s_load_dword s6, s[4:5], 0x3
15148 ; GFX7-NEXT: s_mov_b64 s[10:11], 16
15149 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
15150 ; GFX7-NEXT: s_mov_b32 s4, s8
15151 ; GFX7-NEXT: s_mov_b32 s5, s9
15152 ; GFX7-NEXT: s_mov_b32 s9, s10
15153 ; GFX7-NEXT: s_mov_b32 s8, s11
15154 ; GFX7-NEXT: s_add_u32 s4, s4, s9
15155 ; GFX7-NEXT: s_addc_u32 s8, s5, s8
15156 ; GFX7-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5
15157 ; GFX7-NEXT: s_mov_b32 s5, s8
15158 ; GFX7-NEXT: v_mov_b32_e32 v2, s7
15159 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
15160 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
15161 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
15162 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
15163 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
15164 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
15165 ; GFX7-NEXT: s_waitcnt vmcnt(0)
15166 ; GFX7-NEXT: buffer_wbinvl1_vol
15167 ; GFX7-NEXT: s_endpgm
15169 ; GFX10-WGP-LABEL: global_system_one_as_acquire_acquire_cmpxchg:
15170 ; GFX10-WGP: ; %bb.0: ; %entry
15171 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
15172 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
15173 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
15174 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
15175 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
15176 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
15177 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
15178 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
15179 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
15180 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
15181 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
15182 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
15183 ; GFX10-WGP-NEXT: buffer_gl1_inv
15184 ; GFX10-WGP-NEXT: buffer_gl0_inv
15185 ; GFX10-WGP-NEXT: s_endpgm
15187 ; GFX10-CU-LABEL: global_system_one_as_acquire_acquire_cmpxchg:
15188 ; GFX10-CU: ; %bb.0: ; %entry
15189 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
15190 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
15191 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
15192 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
15193 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
15194 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
15195 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
15196 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
15197 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
15198 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
15199 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
15200 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
15201 ; GFX10-CU-NEXT: buffer_gl1_inv
15202 ; GFX10-CU-NEXT: buffer_gl0_inv
15203 ; GFX10-CU-NEXT: s_endpgm
15205 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acquire_acquire_cmpxchg:
15206 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
15207 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
15208 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
15209 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
15210 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
15211 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
15212 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
15213 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
15214 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
15215 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
15216 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
15217 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
15218 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
15219 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
15220 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
15221 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
15222 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
15223 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16
15224 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
15225 ; SKIP-CACHE-INV-NEXT: s_endpgm
15227 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acquire_acquire_cmpxchg:
15228 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
15229 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
15230 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
15231 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
15232 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
15233 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
15234 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15235 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
15236 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
15237 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
15238 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
15239 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
15240 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
15241 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
15242 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
15243 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
15245 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acquire_acquire_cmpxchg:
15246 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
15247 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
15248 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
15249 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
15250 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
15251 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
15252 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15253 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
15254 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
15255 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
15256 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
15257 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
15258 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
15259 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
15260 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
15261 ; GFX90A-TGSPLIT-NEXT: s_endpgm
15263 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acquire_acquire_cmpxchg:
15264 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
15265 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
15266 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
15267 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
15268 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
15269 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
15270 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15271 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
15272 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
15273 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
15274 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
15275 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
15276 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
15277 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
15278 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
15280 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acquire_acquire_cmpxchg:
15281 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
15282 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
15283 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
15284 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
15285 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
15286 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
15287 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15288 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
15289 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
15290 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
15291 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
15292 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
15293 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
15294 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
15295 ; GFX940-TGSPLIT-NEXT: s_endpgm
15297 ; GFX11-WGP-LABEL: global_system_one_as_acquire_acquire_cmpxchg:
15298 ; GFX11-WGP: ; %bb.0: ; %entry
15299 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
15300 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
15301 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
15302 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
15303 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
15304 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
15305 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
15306 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
15307 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
15308 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
15309 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
15310 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
15311 ; GFX11-WGP-NEXT: buffer_gl1_inv
15312 ; GFX11-WGP-NEXT: buffer_gl0_inv
15313 ; GFX11-WGP-NEXT: s_endpgm
15315 ; GFX11-CU-LABEL: global_system_one_as_acquire_acquire_cmpxchg:
15316 ; GFX11-CU: ; %bb.0: ; %entry
15317 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
15318 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
15319 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
15320 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
15321 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
15322 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
15323 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
15324 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
15325 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
15326 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
15327 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
15328 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
15329 ; GFX11-CU-NEXT: buffer_gl1_inv
15330 ; GFX11-CU-NEXT: buffer_gl0_inv
15331 ; GFX11-CU-NEXT: s_endpgm
15333 ; GFX12-WGP-LABEL: global_system_one_as_acquire_acquire_cmpxchg:
15334 ; GFX12-WGP: ; %bb.0: ; %entry
15335 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
15336 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
15337 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
15338 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
15339 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
15340 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
15341 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
15342 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
15343 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
15344 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
15345 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
15346 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
15347 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
15348 ; GFX12-WGP-NEXT: s_endpgm
15350 ; GFX12-CU-LABEL: global_system_one_as_acquire_acquire_cmpxchg:
15351 ; GFX12-CU: ; %bb.0: ; %entry
15352 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
15353 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
15354 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
15355 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
15356 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
15357 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
15358 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
15359 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
15360 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
15361 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
15362 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
15363 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
15364 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
15365 ; GFX12-CU-NEXT: s_endpgm
15366 ptr addrspace(1) %out, i32 %in, i32 %old) {
15368 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
15369 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") acquire acquire
15373 define amdgpu_kernel void @global_system_one_as_release_acquire_cmpxchg(
15374 ; GFX6-LABEL: global_system_one_as_release_acquire_cmpxchg:
15375 ; GFX6: ; %bb.0: ; %entry
15376 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
15377 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
15378 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
15379 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
15380 ; GFX6-NEXT: s_mov_b32 s12, s5
15381 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
15382 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
15383 ; GFX6-NEXT: s_mov_b32 s11, -1
15384 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
15385 ; GFX6-NEXT: s_mov_b32 s5, s12
15386 ; GFX6-NEXT: s_mov_b32 s6, s11
15387 ; GFX6-NEXT: s_mov_b32 s7, s10
15388 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
15389 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
15390 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
15391 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
15392 ; GFX6-NEXT: s_waitcnt vmcnt(0)
15393 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
15394 ; GFX6-NEXT: s_waitcnt vmcnt(0)
15395 ; GFX6-NEXT: buffer_wbinvl1
15396 ; GFX6-NEXT: s_endpgm
15398 ; GFX7-LABEL: global_system_one_as_release_acquire_cmpxchg:
15399 ; GFX7: ; %bb.0: ; %entry
15400 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
15401 ; GFX7-NEXT: s_load_dwordx2 s[8:9], s[4:5], 0x0
15402 ; GFX7-NEXT: s_load_dword s7, s[4:5], 0x2
15403 ; GFX7-NEXT: s_load_dword s6, s[4:5], 0x3
15404 ; GFX7-NEXT: s_mov_b64 s[10:11], 16
15405 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
15406 ; GFX7-NEXT: s_mov_b32 s4, s8
15407 ; GFX7-NEXT: s_mov_b32 s5, s9
15408 ; GFX7-NEXT: s_mov_b32 s9, s10
15409 ; GFX7-NEXT: s_mov_b32 s8, s11
15410 ; GFX7-NEXT: s_add_u32 s4, s4, s9
15411 ; GFX7-NEXT: s_addc_u32 s8, s5, s8
15412 ; GFX7-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5
15413 ; GFX7-NEXT: s_mov_b32 s5, s8
15414 ; GFX7-NEXT: v_mov_b32_e32 v2, s7
15415 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
15416 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
15417 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
15418 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
15419 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
15420 ; GFX7-NEXT: s_waitcnt vmcnt(0)
15421 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
15422 ; GFX7-NEXT: s_waitcnt vmcnt(0)
15423 ; GFX7-NEXT: buffer_wbinvl1_vol
15424 ; GFX7-NEXT: s_endpgm
15426 ; GFX10-WGP-LABEL: global_system_one_as_release_acquire_cmpxchg:
15427 ; GFX10-WGP: ; %bb.0: ; %entry
15428 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
15429 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
15430 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
15431 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
15432 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
15433 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
15434 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
15435 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
15436 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
15437 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
15438 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
15439 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
15440 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
15441 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
15442 ; GFX10-WGP-NEXT: buffer_gl1_inv
15443 ; GFX10-WGP-NEXT: buffer_gl0_inv
15444 ; GFX10-WGP-NEXT: s_endpgm
15446 ; GFX10-CU-LABEL: global_system_one_as_release_acquire_cmpxchg:
15447 ; GFX10-CU: ; %bb.0: ; %entry
15448 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
15449 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
15450 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
15451 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
15452 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
15453 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
15454 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
15455 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
15456 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
15457 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
15458 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
15459 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
15460 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
15461 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
15462 ; GFX10-CU-NEXT: buffer_gl1_inv
15463 ; GFX10-CU-NEXT: buffer_gl0_inv
15464 ; GFX10-CU-NEXT: s_endpgm
15466 ; SKIP-CACHE-INV-LABEL: global_system_one_as_release_acquire_cmpxchg:
15467 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
15468 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
15469 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
15470 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
15471 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
15472 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
15473 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
15474 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
15475 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
15476 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
15477 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
15478 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
15479 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
15480 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
15481 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
15482 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
15483 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
15484 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
15485 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16
15486 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
15487 ; SKIP-CACHE-INV-NEXT: s_endpgm
15489 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_release_acquire_cmpxchg:
15490 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
15491 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
15492 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
15493 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
15494 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
15495 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
15496 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15497 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
15498 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
15499 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
15500 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
15501 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
15502 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
15503 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
15504 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
15505 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
15506 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
15507 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
15509 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_release_acquire_cmpxchg:
15510 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
15511 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
15512 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
15513 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
15514 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
15515 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
15516 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15517 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
15518 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
15519 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
15520 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
15521 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
15522 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
15523 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
15524 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
15525 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
15526 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
15527 ; GFX90A-TGSPLIT-NEXT: s_endpgm
15529 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_release_acquire_cmpxchg:
15530 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
15531 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
15532 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
15533 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
15534 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
15535 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
15536 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15537 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
15538 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
15539 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
15540 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
15541 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
15542 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
15543 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
15544 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
15545 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
15546 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
15548 ; GFX940-TGSPLIT-LABEL: global_system_one_as_release_acquire_cmpxchg:
15549 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
15550 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
15551 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
15552 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
15553 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
15554 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
15555 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15556 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
15557 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
15558 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
15559 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
15560 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
15561 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
15562 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
15563 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
15564 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
15565 ; GFX940-TGSPLIT-NEXT: s_endpgm
15567 ; GFX11-WGP-LABEL: global_system_one_as_release_acquire_cmpxchg:
15568 ; GFX11-WGP: ; %bb.0: ; %entry
15569 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
15570 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
15571 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
15572 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
15573 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
15574 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
15575 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
15576 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
15577 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
15578 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
15579 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
15580 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
15581 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
15582 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
15583 ; GFX11-WGP-NEXT: buffer_gl1_inv
15584 ; GFX11-WGP-NEXT: buffer_gl0_inv
15585 ; GFX11-WGP-NEXT: s_endpgm
15587 ; GFX11-CU-LABEL: global_system_one_as_release_acquire_cmpxchg:
15588 ; GFX11-CU: ; %bb.0: ; %entry
15589 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
15590 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
15591 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
15592 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
15593 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
15594 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
15595 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
15596 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
15597 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
15598 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
15599 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
15600 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
15601 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
15602 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
15603 ; GFX11-CU-NEXT: buffer_gl1_inv
15604 ; GFX11-CU-NEXT: buffer_gl0_inv
15605 ; GFX11-CU-NEXT: s_endpgm
15607 ; GFX12-WGP-LABEL: global_system_one_as_release_acquire_cmpxchg:
15608 ; GFX12-WGP: ; %bb.0: ; %entry
15609 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
15610 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
15611 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
15612 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
15613 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
15614 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
15615 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
15616 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
15617 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
15618 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
15619 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
15620 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
15621 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
15622 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
15623 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
15624 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
15625 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
15626 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
15627 ; GFX12-WGP-NEXT: s_endpgm
15629 ; GFX12-CU-LABEL: global_system_one_as_release_acquire_cmpxchg:
15630 ; GFX12-CU: ; %bb.0: ; %entry
15631 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
15632 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
15633 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
15634 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
15635 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
15636 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
15637 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
15638 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
15639 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
15640 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
15641 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
15642 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
15643 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
15644 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
15645 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
15646 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
15647 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
15648 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
15649 ; GFX12-CU-NEXT: s_endpgm
15650 ptr addrspace(1) %out, i32 %in, i32 %old) {
15652 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
15653 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") release acquire
15657 define amdgpu_kernel void @global_system_one_as_acq_rel_acquire_cmpxchg(
15658 ; GFX6-LABEL: global_system_one_as_acq_rel_acquire_cmpxchg:
15659 ; GFX6: ; %bb.0: ; %entry
15660 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
15661 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
15662 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
15663 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
15664 ; GFX6-NEXT: s_mov_b32 s12, s5
15665 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
15666 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
15667 ; GFX6-NEXT: s_mov_b32 s11, -1
15668 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
15669 ; GFX6-NEXT: s_mov_b32 s5, s12
15670 ; GFX6-NEXT: s_mov_b32 s6, s11
15671 ; GFX6-NEXT: s_mov_b32 s7, s10
15672 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
15673 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
15674 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
15675 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
15676 ; GFX6-NEXT: s_waitcnt vmcnt(0)
15677 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
15678 ; GFX6-NEXT: s_waitcnt vmcnt(0)
15679 ; GFX6-NEXT: buffer_wbinvl1
15680 ; GFX6-NEXT: s_endpgm
15682 ; GFX7-LABEL: global_system_one_as_acq_rel_acquire_cmpxchg:
15683 ; GFX7: ; %bb.0: ; %entry
15684 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
15685 ; GFX7-NEXT: s_load_dwordx2 s[8:9], s[4:5], 0x0
15686 ; GFX7-NEXT: s_load_dword s7, s[4:5], 0x2
15687 ; GFX7-NEXT: s_load_dword s6, s[4:5], 0x3
15688 ; GFX7-NEXT: s_mov_b64 s[10:11], 16
15689 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
15690 ; GFX7-NEXT: s_mov_b32 s4, s8
15691 ; GFX7-NEXT: s_mov_b32 s5, s9
15692 ; GFX7-NEXT: s_mov_b32 s9, s10
15693 ; GFX7-NEXT: s_mov_b32 s8, s11
15694 ; GFX7-NEXT: s_add_u32 s4, s4, s9
15695 ; GFX7-NEXT: s_addc_u32 s8, s5, s8
15696 ; GFX7-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5
15697 ; GFX7-NEXT: s_mov_b32 s5, s8
15698 ; GFX7-NEXT: v_mov_b32_e32 v2, s7
15699 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
15700 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
15701 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
15702 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
15703 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
15704 ; GFX7-NEXT: s_waitcnt vmcnt(0)
15705 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
15706 ; GFX7-NEXT: s_waitcnt vmcnt(0)
15707 ; GFX7-NEXT: buffer_wbinvl1_vol
15708 ; GFX7-NEXT: s_endpgm
15710 ; GFX10-WGP-LABEL: global_system_one_as_acq_rel_acquire_cmpxchg:
15711 ; GFX10-WGP: ; %bb.0: ; %entry
15712 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
15713 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
15714 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
15715 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
15716 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
15717 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
15718 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
15719 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
15720 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
15721 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
15722 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
15723 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
15724 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
15725 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
15726 ; GFX10-WGP-NEXT: buffer_gl1_inv
15727 ; GFX10-WGP-NEXT: buffer_gl0_inv
15728 ; GFX10-WGP-NEXT: s_endpgm
15730 ; GFX10-CU-LABEL: global_system_one_as_acq_rel_acquire_cmpxchg:
15731 ; GFX10-CU: ; %bb.0: ; %entry
15732 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
15733 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
15734 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
15735 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
15736 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
15737 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
15738 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
15739 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
15740 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
15741 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
15742 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
15743 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
15744 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
15745 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
15746 ; GFX10-CU-NEXT: buffer_gl1_inv
15747 ; GFX10-CU-NEXT: buffer_gl0_inv
15748 ; GFX10-CU-NEXT: s_endpgm
15750 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acq_rel_acquire_cmpxchg:
15751 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
15752 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
15753 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
15754 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
15755 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
15756 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
15757 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
15758 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
15759 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
15760 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
15761 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
15762 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
15763 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
15764 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
15765 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
15766 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
15767 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
15768 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
15769 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16
15770 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
15771 ; SKIP-CACHE-INV-NEXT: s_endpgm
15773 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_acquire_cmpxchg:
15774 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
15775 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
15776 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
15777 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
15778 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
15779 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
15780 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15781 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
15782 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
15783 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
15784 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
15785 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
15786 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
15787 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
15788 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
15789 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
15790 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
15791 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
15793 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acq_rel_acquire_cmpxchg:
15794 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
15795 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
15796 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
15797 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
15798 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
15799 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
15800 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15801 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
15802 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
15803 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
15804 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
15805 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
15806 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
15807 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
15808 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
15809 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
15810 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
15811 ; GFX90A-TGSPLIT-NEXT: s_endpgm
15813 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_acquire_cmpxchg:
15814 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
15815 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
15816 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
15817 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
15818 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
15819 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
15820 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15821 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
15822 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
15823 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
15824 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
15825 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
15826 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
15827 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
15828 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
15829 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
15830 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
15832 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acq_rel_acquire_cmpxchg:
15833 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
15834 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
15835 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
15836 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
15837 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
15838 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
15839 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15840 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
15841 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
15842 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
15843 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
15844 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
15845 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
15846 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
15847 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
15848 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
15849 ; GFX940-TGSPLIT-NEXT: s_endpgm
15851 ; GFX11-WGP-LABEL: global_system_one_as_acq_rel_acquire_cmpxchg:
15852 ; GFX11-WGP: ; %bb.0: ; %entry
15853 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
15854 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
15855 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
15856 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
15857 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
15858 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
15859 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
15860 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
15861 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
15862 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
15863 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
15864 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
15865 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
15866 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
15867 ; GFX11-WGP-NEXT: buffer_gl1_inv
15868 ; GFX11-WGP-NEXT: buffer_gl0_inv
15869 ; GFX11-WGP-NEXT: s_endpgm
15871 ; GFX11-CU-LABEL: global_system_one_as_acq_rel_acquire_cmpxchg:
15872 ; GFX11-CU: ; %bb.0: ; %entry
15873 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
15874 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
15875 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
15876 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
15877 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
15878 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
15879 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
15880 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
15881 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
15882 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
15883 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
15884 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
15885 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
15886 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
15887 ; GFX11-CU-NEXT: buffer_gl1_inv
15888 ; GFX11-CU-NEXT: buffer_gl0_inv
15889 ; GFX11-CU-NEXT: s_endpgm
15891 ; GFX12-WGP-LABEL: global_system_one_as_acq_rel_acquire_cmpxchg:
15892 ; GFX12-WGP: ; %bb.0: ; %entry
15893 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
15894 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
15895 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
15896 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
15897 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
15898 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
15899 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
15900 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
15901 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
15902 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
15903 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
15904 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
15905 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
15906 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
15907 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
15908 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
15909 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
15910 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
15911 ; GFX12-WGP-NEXT: s_endpgm
15913 ; GFX12-CU-LABEL: global_system_one_as_acq_rel_acquire_cmpxchg:
15914 ; GFX12-CU: ; %bb.0: ; %entry
15915 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
15916 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
15917 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
15918 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
15919 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
15920 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
15921 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
15922 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
15923 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
15924 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
15925 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
15926 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
15927 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
15928 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
15929 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
15930 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
15931 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
15932 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
15933 ; GFX12-CU-NEXT: s_endpgm
15934 ptr addrspace(1) %out, i32 %in, i32 %old) {
15936 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
15937 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") acq_rel acquire
15941 define amdgpu_kernel void @global_system_one_as_seq_cst_acquire_cmpxchg(
15942 ; GFX6-LABEL: global_system_one_as_seq_cst_acquire_cmpxchg:
15943 ; GFX6: ; %bb.0: ; %entry
15944 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
15945 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
15946 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
15947 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
15948 ; GFX6-NEXT: s_mov_b32 s12, s5
15949 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
15950 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
15951 ; GFX6-NEXT: s_mov_b32 s11, -1
15952 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
15953 ; GFX6-NEXT: s_mov_b32 s5, s12
15954 ; GFX6-NEXT: s_mov_b32 s6, s11
15955 ; GFX6-NEXT: s_mov_b32 s7, s10
15956 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
15957 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
15958 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
15959 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
15960 ; GFX6-NEXT: s_waitcnt vmcnt(0)
15961 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
15962 ; GFX6-NEXT: s_waitcnt vmcnt(0)
15963 ; GFX6-NEXT: buffer_wbinvl1
15964 ; GFX6-NEXT: s_endpgm
15966 ; GFX7-LABEL: global_system_one_as_seq_cst_acquire_cmpxchg:
15967 ; GFX7: ; %bb.0: ; %entry
15968 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
15969 ; GFX7-NEXT: s_load_dwordx2 s[8:9], s[4:5], 0x0
15970 ; GFX7-NEXT: s_load_dword s7, s[4:5], 0x2
15971 ; GFX7-NEXT: s_load_dword s6, s[4:5], 0x3
15972 ; GFX7-NEXT: s_mov_b64 s[10:11], 16
15973 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
15974 ; GFX7-NEXT: s_mov_b32 s4, s8
15975 ; GFX7-NEXT: s_mov_b32 s5, s9
15976 ; GFX7-NEXT: s_mov_b32 s9, s10
15977 ; GFX7-NEXT: s_mov_b32 s8, s11
15978 ; GFX7-NEXT: s_add_u32 s4, s4, s9
15979 ; GFX7-NEXT: s_addc_u32 s8, s5, s8
15980 ; GFX7-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5
15981 ; GFX7-NEXT: s_mov_b32 s5, s8
15982 ; GFX7-NEXT: v_mov_b32_e32 v2, s7
15983 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
15984 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
15985 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
15986 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
15987 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
15988 ; GFX7-NEXT: s_waitcnt vmcnt(0)
15989 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
15990 ; GFX7-NEXT: s_waitcnt vmcnt(0)
15991 ; GFX7-NEXT: buffer_wbinvl1_vol
15992 ; GFX7-NEXT: s_endpgm
15994 ; GFX10-WGP-LABEL: global_system_one_as_seq_cst_acquire_cmpxchg:
15995 ; GFX10-WGP: ; %bb.0: ; %entry
15996 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
15997 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
15998 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
15999 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
16000 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
16001 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
16002 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
16003 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
16004 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
16005 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
16006 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
16007 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
16008 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
16009 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
16010 ; GFX10-WGP-NEXT: buffer_gl1_inv
16011 ; GFX10-WGP-NEXT: buffer_gl0_inv
16012 ; GFX10-WGP-NEXT: s_endpgm
16014 ; GFX10-CU-LABEL: global_system_one_as_seq_cst_acquire_cmpxchg:
16015 ; GFX10-CU: ; %bb.0: ; %entry
16016 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
16017 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
16018 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
16019 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
16020 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
16021 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
16022 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
16023 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
16024 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
16025 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
16026 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
16027 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
16028 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
16029 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
16030 ; GFX10-CU-NEXT: buffer_gl1_inv
16031 ; GFX10-CU-NEXT: buffer_gl0_inv
16032 ; GFX10-CU-NEXT: s_endpgm
16034 ; SKIP-CACHE-INV-LABEL: global_system_one_as_seq_cst_acquire_cmpxchg:
16035 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
16036 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
16037 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
16038 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
16039 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
16040 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
16041 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
16042 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
16043 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
16044 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
16045 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
16046 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
16047 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
16048 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
16049 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
16050 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
16051 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
16052 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
16053 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16
16054 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
16055 ; SKIP-CACHE-INV-NEXT: s_endpgm
16057 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_acquire_cmpxchg:
16058 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
16059 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
16060 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
16061 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
16062 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
16063 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
16064 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16065 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
16066 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
16067 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
16068 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
16069 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
16070 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
16071 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
16072 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
16073 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
16074 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
16075 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
16077 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_seq_cst_acquire_cmpxchg:
16078 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
16079 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
16080 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
16081 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
16082 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
16083 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
16084 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16085 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
16086 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
16087 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
16088 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
16089 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
16090 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
16091 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
16092 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
16093 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
16094 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
16095 ; GFX90A-TGSPLIT-NEXT: s_endpgm
16097 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_acquire_cmpxchg:
16098 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
16099 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
16100 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
16101 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
16102 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
16103 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
16104 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16105 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
16106 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
16107 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
16108 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
16109 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
16110 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
16111 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
16112 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
16113 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
16114 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
16116 ; GFX940-TGSPLIT-LABEL: global_system_one_as_seq_cst_acquire_cmpxchg:
16117 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
16118 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
16119 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
16120 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
16121 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
16122 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
16123 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16124 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
16125 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
16126 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
16127 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
16128 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
16129 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
16130 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
16131 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
16132 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
16133 ; GFX940-TGSPLIT-NEXT: s_endpgm
16135 ; GFX11-WGP-LABEL: global_system_one_as_seq_cst_acquire_cmpxchg:
16136 ; GFX11-WGP: ; %bb.0: ; %entry
16137 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
16138 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
16139 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
16140 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
16141 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
16142 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
16143 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
16144 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
16145 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
16146 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
16147 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
16148 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
16149 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
16150 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
16151 ; GFX11-WGP-NEXT: buffer_gl1_inv
16152 ; GFX11-WGP-NEXT: buffer_gl0_inv
16153 ; GFX11-WGP-NEXT: s_endpgm
16155 ; GFX11-CU-LABEL: global_system_one_as_seq_cst_acquire_cmpxchg:
16156 ; GFX11-CU: ; %bb.0: ; %entry
16157 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
16158 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
16159 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
16160 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
16161 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
16162 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
16163 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
16164 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
16165 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
16166 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
16167 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
16168 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
16169 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
16170 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
16171 ; GFX11-CU-NEXT: buffer_gl1_inv
16172 ; GFX11-CU-NEXT: buffer_gl0_inv
16173 ; GFX11-CU-NEXT: s_endpgm
16175 ; GFX12-WGP-LABEL: global_system_one_as_seq_cst_acquire_cmpxchg:
16176 ; GFX12-WGP: ; %bb.0: ; %entry
16177 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
16178 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
16179 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
16180 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
16181 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
16182 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
16183 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
16184 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
16185 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
16186 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
16187 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
16188 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
16189 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
16190 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
16191 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
16192 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
16193 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
16194 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
16195 ; GFX12-WGP-NEXT: s_endpgm
16197 ; GFX12-CU-LABEL: global_system_one_as_seq_cst_acquire_cmpxchg:
16198 ; GFX12-CU: ; %bb.0: ; %entry
16199 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
16200 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
16201 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
16202 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
16203 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
16204 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
16205 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
16206 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
16207 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
16208 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
16209 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
16210 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
16211 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
16212 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
16213 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
16214 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
16215 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
16216 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
16217 ; GFX12-CU-NEXT: s_endpgm
16218 ptr addrspace(1) %out, i32 %in, i32 %old) {
16220 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
16221 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") seq_cst acquire
16225 define amdgpu_kernel void @global_system_one_as_monotonic_seq_cst_cmpxchg(
16226 ; GFX6-LABEL: global_system_one_as_monotonic_seq_cst_cmpxchg:
16227 ; GFX6: ; %bb.0: ; %entry
16228 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
16229 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
16230 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
16231 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
16232 ; GFX6-NEXT: s_mov_b32 s12, s5
16233 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
16234 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
16235 ; GFX6-NEXT: s_mov_b32 s11, -1
16236 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
16237 ; GFX6-NEXT: s_mov_b32 s5, s12
16238 ; GFX6-NEXT: s_mov_b32 s6, s11
16239 ; GFX6-NEXT: s_mov_b32 s7, s10
16240 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
16241 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
16242 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
16243 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
16244 ; GFX6-NEXT: s_waitcnt vmcnt(0)
16245 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
16246 ; GFX6-NEXT: s_waitcnt vmcnt(0)
16247 ; GFX6-NEXT: buffer_wbinvl1
16248 ; GFX6-NEXT: s_endpgm
16250 ; GFX7-LABEL: global_system_one_as_monotonic_seq_cst_cmpxchg:
16251 ; GFX7: ; %bb.0: ; %entry
16252 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
16253 ; GFX7-NEXT: s_load_dwordx2 s[8:9], s[4:5], 0x0
16254 ; GFX7-NEXT: s_load_dword s7, s[4:5], 0x2
16255 ; GFX7-NEXT: s_load_dword s6, s[4:5], 0x3
16256 ; GFX7-NEXT: s_mov_b64 s[10:11], 16
16257 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
16258 ; GFX7-NEXT: s_mov_b32 s4, s8
16259 ; GFX7-NEXT: s_mov_b32 s5, s9
16260 ; GFX7-NEXT: s_mov_b32 s9, s10
16261 ; GFX7-NEXT: s_mov_b32 s8, s11
16262 ; GFX7-NEXT: s_add_u32 s4, s4, s9
16263 ; GFX7-NEXT: s_addc_u32 s8, s5, s8
16264 ; GFX7-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5
16265 ; GFX7-NEXT: s_mov_b32 s5, s8
16266 ; GFX7-NEXT: v_mov_b32_e32 v2, s7
16267 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
16268 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
16269 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
16270 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
16271 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
16272 ; GFX7-NEXT: s_waitcnt vmcnt(0)
16273 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
16274 ; GFX7-NEXT: s_waitcnt vmcnt(0)
16275 ; GFX7-NEXT: buffer_wbinvl1_vol
16276 ; GFX7-NEXT: s_endpgm
16278 ; GFX10-WGP-LABEL: global_system_one_as_monotonic_seq_cst_cmpxchg:
16279 ; GFX10-WGP: ; %bb.0: ; %entry
16280 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
16281 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
16282 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
16283 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
16284 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
16285 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
16286 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
16287 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
16288 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
16289 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
16290 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
16291 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
16292 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
16293 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
16294 ; GFX10-WGP-NEXT: buffer_gl1_inv
16295 ; GFX10-WGP-NEXT: buffer_gl0_inv
16296 ; GFX10-WGP-NEXT: s_endpgm
16298 ; GFX10-CU-LABEL: global_system_one_as_monotonic_seq_cst_cmpxchg:
16299 ; GFX10-CU: ; %bb.0: ; %entry
16300 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
16301 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
16302 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
16303 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
16304 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
16305 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
16306 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
16307 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
16308 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
16309 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
16310 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
16311 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
16312 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
16313 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
16314 ; GFX10-CU-NEXT: buffer_gl1_inv
16315 ; GFX10-CU-NEXT: buffer_gl0_inv
16316 ; GFX10-CU-NEXT: s_endpgm
16318 ; SKIP-CACHE-INV-LABEL: global_system_one_as_monotonic_seq_cst_cmpxchg:
16319 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
16320 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
16321 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
16322 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
16323 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
16324 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
16325 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
16326 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
16327 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
16328 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
16329 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
16330 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
16331 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
16332 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
16333 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
16334 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
16335 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
16336 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
16337 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16
16338 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
16339 ; SKIP-CACHE-INV-NEXT: s_endpgm
16341 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_seq_cst_cmpxchg:
16342 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
16343 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
16344 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
16345 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
16346 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
16347 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
16348 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16349 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
16350 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
16351 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
16352 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
16353 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
16354 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
16355 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
16356 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
16357 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
16358 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
16359 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
16361 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_monotonic_seq_cst_cmpxchg:
16362 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
16363 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
16364 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
16365 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
16366 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
16367 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
16368 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16369 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
16370 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
16371 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
16372 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
16373 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
16374 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
16375 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
16376 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
16377 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
16378 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
16379 ; GFX90A-TGSPLIT-NEXT: s_endpgm
16381 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_seq_cst_cmpxchg:
16382 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
16383 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
16384 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
16385 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
16386 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
16387 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
16388 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16389 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
16390 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
16391 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
16392 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
16393 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
16394 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
16395 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
16396 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
16397 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
16398 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
16400 ; GFX940-TGSPLIT-LABEL: global_system_one_as_monotonic_seq_cst_cmpxchg:
16401 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
16402 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
16403 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
16404 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
16405 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
16406 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
16407 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16408 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
16409 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
16410 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
16411 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
16412 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
16413 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
16414 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
16415 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
16416 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
16417 ; GFX940-TGSPLIT-NEXT: s_endpgm
16419 ; GFX11-WGP-LABEL: global_system_one_as_monotonic_seq_cst_cmpxchg:
16420 ; GFX11-WGP: ; %bb.0: ; %entry
16421 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
16422 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
16423 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
16424 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
16425 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
16426 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
16427 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
16428 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
16429 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
16430 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
16431 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
16432 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
16433 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
16434 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
16435 ; GFX11-WGP-NEXT: buffer_gl1_inv
16436 ; GFX11-WGP-NEXT: buffer_gl0_inv
16437 ; GFX11-WGP-NEXT: s_endpgm
16439 ; GFX11-CU-LABEL: global_system_one_as_monotonic_seq_cst_cmpxchg:
16440 ; GFX11-CU: ; %bb.0: ; %entry
16441 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
16442 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
16443 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
16444 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
16445 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
16446 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
16447 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
16448 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
16449 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
16450 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
16451 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
16452 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
16453 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
16454 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
16455 ; GFX11-CU-NEXT: buffer_gl1_inv
16456 ; GFX11-CU-NEXT: buffer_gl0_inv
16457 ; GFX11-CU-NEXT: s_endpgm
16459 ; GFX12-WGP-LABEL: global_system_one_as_monotonic_seq_cst_cmpxchg:
16460 ; GFX12-WGP: ; %bb.0: ; %entry
16461 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
16462 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
16463 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
16464 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
16465 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
16466 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
16467 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
16468 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
16469 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
16470 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
16471 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
16472 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
16473 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
16474 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
16475 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
16476 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
16477 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
16478 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
16479 ; GFX12-WGP-NEXT: s_endpgm
16481 ; GFX12-CU-LABEL: global_system_one_as_monotonic_seq_cst_cmpxchg:
16482 ; GFX12-CU: ; %bb.0: ; %entry
16483 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
16484 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
16485 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
16486 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
16487 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
16488 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
16489 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
16490 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
16491 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
16492 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
16493 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
16494 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
16495 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
16496 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
16497 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
16498 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
16499 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
16500 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
16501 ; GFX12-CU-NEXT: s_endpgm
16502 ptr addrspace(1) %out, i32 %in, i32 %old) {
16504 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
16505 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") monotonic seq_cst
16509 define amdgpu_kernel void @global_system_one_as_acquire_seq_cst_cmpxchg(
16510 ; GFX6-LABEL: global_system_one_as_acquire_seq_cst_cmpxchg:
16511 ; GFX6: ; %bb.0: ; %entry
16512 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
16513 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
16514 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
16515 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
16516 ; GFX6-NEXT: s_mov_b32 s12, s5
16517 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
16518 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
16519 ; GFX6-NEXT: s_mov_b32 s11, -1
16520 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
16521 ; GFX6-NEXT: s_mov_b32 s5, s12
16522 ; GFX6-NEXT: s_mov_b32 s6, s11
16523 ; GFX6-NEXT: s_mov_b32 s7, s10
16524 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
16525 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
16526 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
16527 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
16528 ; GFX6-NEXT: s_waitcnt vmcnt(0)
16529 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
16530 ; GFX6-NEXT: s_waitcnt vmcnt(0)
16531 ; GFX6-NEXT: buffer_wbinvl1
16532 ; GFX6-NEXT: s_endpgm
16534 ; GFX7-LABEL: global_system_one_as_acquire_seq_cst_cmpxchg:
16535 ; GFX7: ; %bb.0: ; %entry
16536 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
16537 ; GFX7-NEXT: s_load_dwordx2 s[8:9], s[4:5], 0x0
16538 ; GFX7-NEXT: s_load_dword s7, s[4:5], 0x2
16539 ; GFX7-NEXT: s_load_dword s6, s[4:5], 0x3
16540 ; GFX7-NEXT: s_mov_b64 s[10:11], 16
16541 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
16542 ; GFX7-NEXT: s_mov_b32 s4, s8
16543 ; GFX7-NEXT: s_mov_b32 s5, s9
16544 ; GFX7-NEXT: s_mov_b32 s9, s10
16545 ; GFX7-NEXT: s_mov_b32 s8, s11
16546 ; GFX7-NEXT: s_add_u32 s4, s4, s9
16547 ; GFX7-NEXT: s_addc_u32 s8, s5, s8
16548 ; GFX7-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5
16549 ; GFX7-NEXT: s_mov_b32 s5, s8
16550 ; GFX7-NEXT: v_mov_b32_e32 v2, s7
16551 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
16552 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
16553 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
16554 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
16555 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
16556 ; GFX7-NEXT: s_waitcnt vmcnt(0)
16557 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
16558 ; GFX7-NEXT: s_waitcnt vmcnt(0)
16559 ; GFX7-NEXT: buffer_wbinvl1_vol
16560 ; GFX7-NEXT: s_endpgm
16562 ; GFX10-WGP-LABEL: global_system_one_as_acquire_seq_cst_cmpxchg:
16563 ; GFX10-WGP: ; %bb.0: ; %entry
16564 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
16565 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
16566 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
16567 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
16568 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
16569 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
16570 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
16571 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
16572 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
16573 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
16574 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
16575 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
16576 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
16577 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
16578 ; GFX10-WGP-NEXT: buffer_gl1_inv
16579 ; GFX10-WGP-NEXT: buffer_gl0_inv
16580 ; GFX10-WGP-NEXT: s_endpgm
16582 ; GFX10-CU-LABEL: global_system_one_as_acquire_seq_cst_cmpxchg:
16583 ; GFX10-CU: ; %bb.0: ; %entry
16584 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
16585 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
16586 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
16587 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
16588 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
16589 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
16590 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
16591 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
16592 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
16593 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
16594 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
16595 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
16596 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
16597 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
16598 ; GFX10-CU-NEXT: buffer_gl1_inv
16599 ; GFX10-CU-NEXT: buffer_gl0_inv
16600 ; GFX10-CU-NEXT: s_endpgm
16602 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acquire_seq_cst_cmpxchg:
16603 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
16604 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
16605 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
16606 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
16607 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
16608 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
16609 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
16610 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
16611 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
16612 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
16613 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
16614 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
16615 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
16616 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
16617 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
16618 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
16619 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
16620 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
16621 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16
16622 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
16623 ; SKIP-CACHE-INV-NEXT: s_endpgm
16625 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acquire_seq_cst_cmpxchg:
16626 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
16627 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
16628 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
16629 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
16630 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
16631 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
16632 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16633 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
16634 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
16635 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
16636 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
16637 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
16638 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
16639 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
16640 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
16641 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
16642 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
16643 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
16645 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acquire_seq_cst_cmpxchg:
16646 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
16647 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
16648 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
16649 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
16650 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
16651 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
16652 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16653 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
16654 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
16655 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
16656 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
16657 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
16658 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
16659 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
16660 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
16661 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
16662 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
16663 ; GFX90A-TGSPLIT-NEXT: s_endpgm
16665 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acquire_seq_cst_cmpxchg:
16666 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
16667 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
16668 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
16669 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
16670 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
16671 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
16672 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16673 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
16674 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
16675 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
16676 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
16677 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
16678 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
16679 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
16680 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
16681 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
16682 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
16684 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acquire_seq_cst_cmpxchg:
16685 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
16686 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
16687 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
16688 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
16689 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
16690 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
16691 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16692 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
16693 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
16694 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
16695 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
16696 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
16697 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
16698 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
16699 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
16700 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
16701 ; GFX940-TGSPLIT-NEXT: s_endpgm
16703 ; GFX11-WGP-LABEL: global_system_one_as_acquire_seq_cst_cmpxchg:
16704 ; GFX11-WGP: ; %bb.0: ; %entry
16705 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
16706 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
16707 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
16708 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
16709 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
16710 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
16711 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
16712 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
16713 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
16714 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
16715 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
16716 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
16717 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
16718 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
16719 ; GFX11-WGP-NEXT: buffer_gl1_inv
16720 ; GFX11-WGP-NEXT: buffer_gl0_inv
16721 ; GFX11-WGP-NEXT: s_endpgm
16723 ; GFX11-CU-LABEL: global_system_one_as_acquire_seq_cst_cmpxchg:
16724 ; GFX11-CU: ; %bb.0: ; %entry
16725 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
16726 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
16727 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
16728 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
16729 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
16730 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
16731 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
16732 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
16733 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
16734 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
16735 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
16736 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
16737 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
16738 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
16739 ; GFX11-CU-NEXT: buffer_gl1_inv
16740 ; GFX11-CU-NEXT: buffer_gl0_inv
16741 ; GFX11-CU-NEXT: s_endpgm
16743 ; GFX12-WGP-LABEL: global_system_one_as_acquire_seq_cst_cmpxchg:
16744 ; GFX12-WGP: ; %bb.0: ; %entry
16745 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
16746 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
16747 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
16748 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
16749 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
16750 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
16751 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
16752 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
16753 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
16754 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
16755 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
16756 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
16757 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
16758 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
16759 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
16760 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
16761 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
16762 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
16763 ; GFX12-WGP-NEXT: s_endpgm
16765 ; GFX12-CU-LABEL: global_system_one_as_acquire_seq_cst_cmpxchg:
16766 ; GFX12-CU: ; %bb.0: ; %entry
16767 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
16768 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
16769 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
16770 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
16771 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
16772 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
16773 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
16774 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
16775 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
16776 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
16777 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
16778 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
16779 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
16780 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
16781 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
16782 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
16783 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
16784 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
16785 ; GFX12-CU-NEXT: s_endpgm
16786 ptr addrspace(1) %out, i32 %in, i32 %old) {
16788 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
16789 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") acquire seq_cst
16793 define amdgpu_kernel void @global_system_one_as_release_seq_cst_cmpxchg(
16794 ; GFX6-LABEL: global_system_one_as_release_seq_cst_cmpxchg:
16795 ; GFX6: ; %bb.0: ; %entry
16796 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
16797 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
16798 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
16799 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
16800 ; GFX6-NEXT: s_mov_b32 s12, s5
16801 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
16802 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
16803 ; GFX6-NEXT: s_mov_b32 s11, -1
16804 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
16805 ; GFX6-NEXT: s_mov_b32 s5, s12
16806 ; GFX6-NEXT: s_mov_b32 s6, s11
16807 ; GFX6-NEXT: s_mov_b32 s7, s10
16808 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
16809 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
16810 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
16811 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
16812 ; GFX6-NEXT: s_waitcnt vmcnt(0)
16813 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
16814 ; GFX6-NEXT: s_waitcnt vmcnt(0)
16815 ; GFX6-NEXT: buffer_wbinvl1
16816 ; GFX6-NEXT: s_endpgm
16818 ; GFX7-LABEL: global_system_one_as_release_seq_cst_cmpxchg:
16819 ; GFX7: ; %bb.0: ; %entry
16820 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
16821 ; GFX7-NEXT: s_load_dwordx2 s[8:9], s[4:5], 0x0
16822 ; GFX7-NEXT: s_load_dword s7, s[4:5], 0x2
16823 ; GFX7-NEXT: s_load_dword s6, s[4:5], 0x3
16824 ; GFX7-NEXT: s_mov_b64 s[10:11], 16
16825 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
16826 ; GFX7-NEXT: s_mov_b32 s4, s8
16827 ; GFX7-NEXT: s_mov_b32 s5, s9
16828 ; GFX7-NEXT: s_mov_b32 s9, s10
16829 ; GFX7-NEXT: s_mov_b32 s8, s11
16830 ; GFX7-NEXT: s_add_u32 s4, s4, s9
16831 ; GFX7-NEXT: s_addc_u32 s8, s5, s8
16832 ; GFX7-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5
16833 ; GFX7-NEXT: s_mov_b32 s5, s8
16834 ; GFX7-NEXT: v_mov_b32_e32 v2, s7
16835 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
16836 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
16837 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
16838 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
16839 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
16840 ; GFX7-NEXT: s_waitcnt vmcnt(0)
16841 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
16842 ; GFX7-NEXT: s_waitcnt vmcnt(0)
16843 ; GFX7-NEXT: buffer_wbinvl1_vol
16844 ; GFX7-NEXT: s_endpgm
16846 ; GFX10-WGP-LABEL: global_system_one_as_release_seq_cst_cmpxchg:
16847 ; GFX10-WGP: ; %bb.0: ; %entry
16848 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
16849 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
16850 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
16851 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
16852 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
16853 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
16854 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
16855 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
16856 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
16857 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
16858 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
16859 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
16860 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
16861 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
16862 ; GFX10-WGP-NEXT: buffer_gl1_inv
16863 ; GFX10-WGP-NEXT: buffer_gl0_inv
16864 ; GFX10-WGP-NEXT: s_endpgm
16866 ; GFX10-CU-LABEL: global_system_one_as_release_seq_cst_cmpxchg:
16867 ; GFX10-CU: ; %bb.0: ; %entry
16868 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
16869 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
16870 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
16871 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
16872 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
16873 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
16874 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
16875 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
16876 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
16877 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
16878 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
16879 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
16880 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
16881 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
16882 ; GFX10-CU-NEXT: buffer_gl1_inv
16883 ; GFX10-CU-NEXT: buffer_gl0_inv
16884 ; GFX10-CU-NEXT: s_endpgm
16886 ; SKIP-CACHE-INV-LABEL: global_system_one_as_release_seq_cst_cmpxchg:
16887 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
16888 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
16889 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
16890 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
16891 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
16892 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
16893 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
16894 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
16895 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
16896 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
16897 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
16898 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
16899 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
16900 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
16901 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
16902 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
16903 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
16904 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
16905 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16
16906 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
16907 ; SKIP-CACHE-INV-NEXT: s_endpgm
16909 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_release_seq_cst_cmpxchg:
16910 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
16911 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
16912 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
16913 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
16914 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
16915 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
16916 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16917 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
16918 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
16919 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
16920 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
16921 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
16922 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
16923 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
16924 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
16925 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
16926 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
16927 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
16929 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_release_seq_cst_cmpxchg:
16930 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
16931 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
16932 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
16933 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
16934 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
16935 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
16936 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16937 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
16938 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
16939 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
16940 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
16941 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
16942 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
16943 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
16944 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
16945 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
16946 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
16947 ; GFX90A-TGSPLIT-NEXT: s_endpgm
16949 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_release_seq_cst_cmpxchg:
16950 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
16951 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
16952 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
16953 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
16954 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
16955 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
16956 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16957 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
16958 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
16959 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
16960 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
16961 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
16962 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
16963 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
16964 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
16965 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
16966 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
16968 ; GFX940-TGSPLIT-LABEL: global_system_one_as_release_seq_cst_cmpxchg:
16969 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
16970 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
16971 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
16972 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
16973 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
16974 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
16975 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16976 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
16977 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
16978 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
16979 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
16980 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
16981 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
16982 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
16983 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
16984 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
16985 ; GFX940-TGSPLIT-NEXT: s_endpgm
16987 ; GFX11-WGP-LABEL: global_system_one_as_release_seq_cst_cmpxchg:
16988 ; GFX11-WGP: ; %bb.0: ; %entry
16989 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
16990 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
16991 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
16992 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
16993 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
16994 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
16995 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
16996 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
16997 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
16998 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
16999 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
17000 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
17001 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
17002 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
17003 ; GFX11-WGP-NEXT: buffer_gl1_inv
17004 ; GFX11-WGP-NEXT: buffer_gl0_inv
17005 ; GFX11-WGP-NEXT: s_endpgm
17007 ; GFX11-CU-LABEL: global_system_one_as_release_seq_cst_cmpxchg:
17008 ; GFX11-CU: ; %bb.0: ; %entry
17009 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
17010 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
17011 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
17012 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
17013 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
17014 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
17015 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
17016 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
17017 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
17018 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
17019 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
17020 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
17021 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
17022 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
17023 ; GFX11-CU-NEXT: buffer_gl1_inv
17024 ; GFX11-CU-NEXT: buffer_gl0_inv
17025 ; GFX11-CU-NEXT: s_endpgm
17027 ; GFX12-WGP-LABEL: global_system_one_as_release_seq_cst_cmpxchg:
17028 ; GFX12-WGP: ; %bb.0: ; %entry
17029 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
17030 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
17031 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
17032 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
17033 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
17034 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
17035 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
17036 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
17037 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
17038 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
17039 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
17040 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
17041 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
17042 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
17043 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
17044 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
17045 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
17046 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
17047 ; GFX12-WGP-NEXT: s_endpgm
17049 ; GFX12-CU-LABEL: global_system_one_as_release_seq_cst_cmpxchg:
17050 ; GFX12-CU: ; %bb.0: ; %entry
17051 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
17052 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
17053 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
17054 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
17055 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
17056 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
17057 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
17058 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
17059 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
17060 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
17061 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
17062 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
17063 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
17064 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
17065 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
17066 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
17067 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
17068 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
17069 ; GFX12-CU-NEXT: s_endpgm
17070 ptr addrspace(1) %out, i32 %in, i32 %old) {
17072 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
17073 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") release seq_cst
17077 define amdgpu_kernel void @global_system_one_as_acq_rel_seq_cst_cmpxchg(
17078 ; GFX6-LABEL: global_system_one_as_acq_rel_seq_cst_cmpxchg:
17079 ; GFX6: ; %bb.0: ; %entry
17080 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
17081 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
17082 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
17083 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
17084 ; GFX6-NEXT: s_mov_b32 s12, s5
17085 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
17086 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
17087 ; GFX6-NEXT: s_mov_b32 s11, -1
17088 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
17089 ; GFX6-NEXT: s_mov_b32 s5, s12
17090 ; GFX6-NEXT: s_mov_b32 s6, s11
17091 ; GFX6-NEXT: s_mov_b32 s7, s10
17092 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
17093 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
17094 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
17095 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
17096 ; GFX6-NEXT: s_waitcnt vmcnt(0)
17097 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
17098 ; GFX6-NEXT: s_waitcnt vmcnt(0)
17099 ; GFX6-NEXT: buffer_wbinvl1
17100 ; GFX6-NEXT: s_endpgm
17102 ; GFX7-LABEL: global_system_one_as_acq_rel_seq_cst_cmpxchg:
17103 ; GFX7: ; %bb.0: ; %entry
17104 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
17105 ; GFX7-NEXT: s_load_dwordx2 s[8:9], s[4:5], 0x0
17106 ; GFX7-NEXT: s_load_dword s7, s[4:5], 0x2
17107 ; GFX7-NEXT: s_load_dword s6, s[4:5], 0x3
17108 ; GFX7-NEXT: s_mov_b64 s[10:11], 16
17109 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
17110 ; GFX7-NEXT: s_mov_b32 s4, s8
17111 ; GFX7-NEXT: s_mov_b32 s5, s9
17112 ; GFX7-NEXT: s_mov_b32 s9, s10
17113 ; GFX7-NEXT: s_mov_b32 s8, s11
17114 ; GFX7-NEXT: s_add_u32 s4, s4, s9
17115 ; GFX7-NEXT: s_addc_u32 s8, s5, s8
17116 ; GFX7-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5
17117 ; GFX7-NEXT: s_mov_b32 s5, s8
17118 ; GFX7-NEXT: v_mov_b32_e32 v2, s7
17119 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
17120 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
17121 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
17122 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
17123 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
17124 ; GFX7-NEXT: s_waitcnt vmcnt(0)
17125 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
17126 ; GFX7-NEXT: s_waitcnt vmcnt(0)
17127 ; GFX7-NEXT: buffer_wbinvl1_vol
17128 ; GFX7-NEXT: s_endpgm
17130 ; GFX10-WGP-LABEL: global_system_one_as_acq_rel_seq_cst_cmpxchg:
17131 ; GFX10-WGP: ; %bb.0: ; %entry
17132 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
17133 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
17134 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
17135 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
17136 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
17137 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
17138 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
17139 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
17140 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
17141 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
17142 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
17143 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
17144 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
17145 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
17146 ; GFX10-WGP-NEXT: buffer_gl1_inv
17147 ; GFX10-WGP-NEXT: buffer_gl0_inv
17148 ; GFX10-WGP-NEXT: s_endpgm
17150 ; GFX10-CU-LABEL: global_system_one_as_acq_rel_seq_cst_cmpxchg:
17151 ; GFX10-CU: ; %bb.0: ; %entry
17152 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
17153 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
17154 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
17155 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
17156 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
17157 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
17158 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
17159 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
17160 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
17161 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
17162 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
17163 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
17164 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
17165 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
17166 ; GFX10-CU-NEXT: buffer_gl1_inv
17167 ; GFX10-CU-NEXT: buffer_gl0_inv
17168 ; GFX10-CU-NEXT: s_endpgm
17170 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acq_rel_seq_cst_cmpxchg:
17171 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
17172 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
17173 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
17174 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
17175 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
17176 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
17177 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
17178 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
17179 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
17180 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
17181 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
17182 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
17183 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
17184 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
17185 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
17186 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
17187 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
17188 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
17189 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16
17190 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
17191 ; SKIP-CACHE-INV-NEXT: s_endpgm
17193 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_seq_cst_cmpxchg:
17194 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
17195 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
17196 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
17197 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
17198 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
17199 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
17200 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
17201 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
17202 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
17203 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
17204 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
17205 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
17206 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
17207 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
17208 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
17209 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
17210 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
17211 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
17213 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acq_rel_seq_cst_cmpxchg:
17214 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
17215 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
17216 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
17217 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
17218 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
17219 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
17220 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
17221 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
17222 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
17223 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
17224 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
17225 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
17226 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
17227 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
17228 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
17229 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
17230 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
17231 ; GFX90A-TGSPLIT-NEXT: s_endpgm
17233 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_seq_cst_cmpxchg:
17234 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
17235 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
17236 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
17237 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
17238 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
17239 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
17240 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
17241 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
17242 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
17243 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
17244 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
17245 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
17246 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
17247 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
17248 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
17249 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
17250 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
17252 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acq_rel_seq_cst_cmpxchg:
17253 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
17254 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
17255 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
17256 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
17257 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
17258 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
17259 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
17260 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
17261 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
17262 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
17263 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
17264 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
17265 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
17266 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
17267 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
17268 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
17269 ; GFX940-TGSPLIT-NEXT: s_endpgm
17271 ; GFX11-WGP-LABEL: global_system_one_as_acq_rel_seq_cst_cmpxchg:
17272 ; GFX11-WGP: ; %bb.0: ; %entry
17273 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
17274 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
17275 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
17276 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
17277 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
17278 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
17279 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
17280 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
17281 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
17282 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
17283 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
17284 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
17285 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
17286 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
17287 ; GFX11-WGP-NEXT: buffer_gl1_inv
17288 ; GFX11-WGP-NEXT: buffer_gl0_inv
17289 ; GFX11-WGP-NEXT: s_endpgm
17291 ; GFX11-CU-LABEL: global_system_one_as_acq_rel_seq_cst_cmpxchg:
17292 ; GFX11-CU: ; %bb.0: ; %entry
17293 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
17294 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
17295 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
17296 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
17297 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
17298 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
17299 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
17300 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
17301 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
17302 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
17303 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
17304 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
17305 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
17306 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
17307 ; GFX11-CU-NEXT: buffer_gl1_inv
17308 ; GFX11-CU-NEXT: buffer_gl0_inv
17309 ; GFX11-CU-NEXT: s_endpgm
17311 ; GFX12-WGP-LABEL: global_system_one_as_acq_rel_seq_cst_cmpxchg:
17312 ; GFX12-WGP: ; %bb.0: ; %entry
17313 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
17314 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
17315 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
17316 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
17317 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
17318 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
17319 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
17320 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
17321 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
17322 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
17323 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
17324 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
17325 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
17326 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
17327 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
17328 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
17329 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
17330 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
17331 ; GFX12-WGP-NEXT: s_endpgm
17333 ; GFX12-CU-LABEL: global_system_one_as_acq_rel_seq_cst_cmpxchg:
17334 ; GFX12-CU: ; %bb.0: ; %entry
17335 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
17336 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
17337 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
17338 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
17339 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
17340 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
17341 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
17342 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
17343 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
17344 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
17345 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
17346 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
17347 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
17348 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
17349 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
17350 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
17351 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
17352 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
17353 ; GFX12-CU-NEXT: s_endpgm
17354 ptr addrspace(1) %out, i32 %in, i32 %old) {
17356 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
17357 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") acq_rel seq_cst
17361 define amdgpu_kernel void @global_system_one_as_seq_cst_seq_cst_cmpxchg(
17362 ; GFX6-LABEL: global_system_one_as_seq_cst_seq_cst_cmpxchg:
17363 ; GFX6: ; %bb.0: ; %entry
17364 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
17365 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
17366 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
17367 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
17368 ; GFX6-NEXT: s_mov_b32 s12, s5
17369 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
17370 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
17371 ; GFX6-NEXT: s_mov_b32 s11, -1
17372 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
17373 ; GFX6-NEXT: s_mov_b32 s5, s12
17374 ; GFX6-NEXT: s_mov_b32 s6, s11
17375 ; GFX6-NEXT: s_mov_b32 s7, s10
17376 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
17377 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
17378 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
17379 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
17380 ; GFX6-NEXT: s_waitcnt vmcnt(0)
17381 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
17382 ; GFX6-NEXT: s_waitcnt vmcnt(0)
17383 ; GFX6-NEXT: buffer_wbinvl1
17384 ; GFX6-NEXT: s_endpgm
17386 ; GFX7-LABEL: global_system_one_as_seq_cst_seq_cst_cmpxchg:
17387 ; GFX7: ; %bb.0: ; %entry
17388 ; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7]
17389 ; GFX7-NEXT: s_load_dwordx2 s[8:9], s[4:5], 0x0
17390 ; GFX7-NEXT: s_load_dword s7, s[4:5], 0x2
17391 ; GFX7-NEXT: s_load_dword s6, s[4:5], 0x3
17392 ; GFX7-NEXT: s_mov_b64 s[10:11], 16
17393 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
17394 ; GFX7-NEXT: s_mov_b32 s4, s8
17395 ; GFX7-NEXT: s_mov_b32 s5, s9
17396 ; GFX7-NEXT: s_mov_b32 s9, s10
17397 ; GFX7-NEXT: s_mov_b32 s8, s11
17398 ; GFX7-NEXT: s_add_u32 s4, s4, s9
17399 ; GFX7-NEXT: s_addc_u32 s8, s5, s8
17400 ; GFX7-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5
17401 ; GFX7-NEXT: s_mov_b32 s5, s8
17402 ; GFX7-NEXT: v_mov_b32_e32 v2, s7
17403 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
17404 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
17405 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
17406 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
17407 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
17408 ; GFX7-NEXT: s_waitcnt vmcnt(0)
17409 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
17410 ; GFX7-NEXT: s_waitcnt vmcnt(0)
17411 ; GFX7-NEXT: buffer_wbinvl1_vol
17412 ; GFX7-NEXT: s_endpgm
17414 ; GFX10-WGP-LABEL: global_system_one_as_seq_cst_seq_cst_cmpxchg:
17415 ; GFX10-WGP: ; %bb.0: ; %entry
17416 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
17417 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
17418 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
17419 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
17420 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
17421 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
17422 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
17423 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
17424 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
17425 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
17426 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
17427 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
17428 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
17429 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
17430 ; GFX10-WGP-NEXT: buffer_gl1_inv
17431 ; GFX10-WGP-NEXT: buffer_gl0_inv
17432 ; GFX10-WGP-NEXT: s_endpgm
17434 ; GFX10-CU-LABEL: global_system_one_as_seq_cst_seq_cst_cmpxchg:
17435 ; GFX10-CU: ; %bb.0: ; %entry
17436 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
17437 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
17438 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
17439 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
17440 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
17441 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
17442 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
17443 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
17444 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
17445 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
17446 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
17447 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
17448 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v[1:2], s[4:5] offset:16
17449 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
17450 ; GFX10-CU-NEXT: buffer_gl1_inv
17451 ; GFX10-CU-NEXT: buffer_gl0_inv
17452 ; GFX10-CU-NEXT: s_endpgm
17454 ; SKIP-CACHE-INV-LABEL: global_system_one_as_seq_cst_seq_cst_cmpxchg:
17455 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
17456 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
17457 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
17458 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
17459 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
17460 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
17461 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
17462 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
17463 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
17464 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
17465 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
17466 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
17467 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
17468 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
17469 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
17470 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
17471 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
17472 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
17473 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16
17474 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
17475 ; SKIP-CACHE-INV-NEXT: s_endpgm
17477 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_seq_cst_cmpxchg:
17478 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
17479 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
17480 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
17481 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
17482 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
17483 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
17484 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
17485 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
17486 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
17487 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
17488 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
17489 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
17490 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
17491 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
17492 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
17493 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
17494 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
17495 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
17497 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_seq_cst_seq_cst_cmpxchg:
17498 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
17499 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
17500 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
17501 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
17502 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
17503 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
17504 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
17505 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
17506 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
17507 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
17508 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
17509 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
17510 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
17511 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[4:5] offset:16
17512 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
17513 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
17514 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
17515 ; GFX90A-TGSPLIT-NEXT: s_endpgm
17517 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_seq_cst_cmpxchg:
17518 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
17519 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
17520 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
17521 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
17522 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
17523 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
17524 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
17525 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
17526 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
17527 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
17528 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
17529 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
17530 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
17531 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
17532 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
17533 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
17534 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
17536 ; GFX940-TGSPLIT-LABEL: global_system_one_as_seq_cst_seq_cst_cmpxchg:
17537 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
17538 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
17539 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
17540 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
17541 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
17542 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
17543 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
17544 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
17545 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
17546 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
17547 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
17548 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
17549 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
17550 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v[2:3], s[0:1] offset:16 sc1
17551 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
17552 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
17553 ; GFX940-TGSPLIT-NEXT: s_endpgm
17555 ; GFX11-WGP-LABEL: global_system_one_as_seq_cst_seq_cst_cmpxchg:
17556 ; GFX11-WGP: ; %bb.0: ; %entry
17557 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
17558 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
17559 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
17560 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
17561 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
17562 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
17563 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
17564 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
17565 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
17566 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
17567 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
17568 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
17569 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
17570 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
17571 ; GFX11-WGP-NEXT: buffer_gl1_inv
17572 ; GFX11-WGP-NEXT: buffer_gl0_inv
17573 ; GFX11-WGP-NEXT: s_endpgm
17575 ; GFX11-CU-LABEL: global_system_one_as_seq_cst_seq_cst_cmpxchg:
17576 ; GFX11-CU: ; %bb.0: ; %entry
17577 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
17578 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
17579 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
17580 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
17581 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
17582 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
17583 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
17584 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
17585 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
17586 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
17587 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
17588 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
17589 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16
17590 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
17591 ; GFX11-CU-NEXT: buffer_gl1_inv
17592 ; GFX11-CU-NEXT: buffer_gl0_inv
17593 ; GFX11-CU-NEXT: s_endpgm
17595 ; GFX12-WGP-LABEL: global_system_one_as_seq_cst_seq_cst_cmpxchg:
17596 ; GFX12-WGP: ; %bb.0: ; %entry
17597 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
17598 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
17599 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
17600 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
17601 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
17602 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
17603 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
17604 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
17605 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
17606 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
17607 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
17608 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
17609 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
17610 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
17611 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
17612 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
17613 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
17614 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
17615 ; GFX12-WGP-NEXT: s_endpgm
17617 ; GFX12-CU-LABEL: global_system_one_as_seq_cst_seq_cst_cmpxchg:
17618 ; GFX12-CU: ; %bb.0: ; %entry
17619 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
17620 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
17621 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
17622 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
17623 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
17624 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
17625 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
17626 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
17627 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
17628 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
17629 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
17630 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
17631 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
17632 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
17633 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
17634 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v0, v[1:2], s[0:1] offset:16 scope:SCOPE_SYS
17635 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
17636 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
17637 ; GFX12-CU-NEXT: s_endpgm
17638 ptr addrspace(1) %out, i32 %in, i32 %old) {
17640 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
17641 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") seq_cst seq_cst
17645 define amdgpu_kernel void @global_system_one_as_monotonic_monotonic_ret_cmpxchg(
17646 ; GFX6-LABEL: global_system_one_as_monotonic_monotonic_ret_cmpxchg:
17647 ; GFX6: ; %bb.0: ; %entry
17648 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
17649 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
17650 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
17651 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
17652 ; GFX6-NEXT: s_mov_b32 s12, s5
17653 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
17654 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
17655 ; GFX6-NEXT: s_mov_b32 s11, -1
17656 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
17657 ; GFX6-NEXT: s_mov_b32 s5, s12
17658 ; GFX6-NEXT: s_mov_b32 s6, s11
17659 ; GFX6-NEXT: s_mov_b32 s7, s10
17660 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
17661 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
17662 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
17663 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
17664 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
17665 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
17666 ; GFX6-NEXT: s_waitcnt vmcnt(0)
17667 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
17668 ; GFX6-NEXT: s_endpgm
17670 ; GFX7-LABEL: global_system_one_as_monotonic_monotonic_ret_cmpxchg:
17671 ; GFX7: ; %bb.0: ; %entry
17672 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
17673 ; GFX7-NEXT: s_load_dword s9, s[6:7], 0x2
17674 ; GFX7-NEXT: s_load_dword s8, s[6:7], 0x3
17675 ; GFX7-NEXT: s_mov_b64 s[12:13], 16
17676 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
17677 ; GFX7-NEXT: s_mov_b32 s6, s4
17678 ; GFX7-NEXT: s_mov_b32 s7, s5
17679 ; GFX7-NEXT: s_mov_b32 s11, s12
17680 ; GFX7-NEXT: s_mov_b32 s10, s13
17681 ; GFX7-NEXT: s_add_u32 s6, s6, s11
17682 ; GFX7-NEXT: s_addc_u32 s10, s7, s10
17683 ; GFX7-NEXT: ; kill: def $sgpr6 killed $sgpr6 def $sgpr6_sgpr7
17684 ; GFX7-NEXT: s_mov_b32 s7, s10
17685 ; GFX7-NEXT: v_mov_b32_e32 v2, s9
17686 ; GFX7-NEXT: v_mov_b32_e32 v0, s8
17687 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
17688 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
17689 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
17690 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
17691 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
17692 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
17693 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
17694 ; GFX7-NEXT: s_waitcnt vmcnt(0)
17695 ; GFX7-NEXT: flat_store_dword v[0:1], v2
17696 ; GFX7-NEXT: s_endpgm
17698 ; GFX10-WGP-LABEL: global_system_one_as_monotonic_monotonic_ret_cmpxchg:
17699 ; GFX10-WGP: ; %bb.0: ; %entry
17700 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
17701 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
17702 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
17703 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
17704 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
17705 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
17706 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
17707 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
17708 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
17709 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
17710 ; GFX10-WGP-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
17711 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
17712 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
17713 ; GFX10-WGP-NEXT: s_endpgm
17715 ; GFX10-CU-LABEL: global_system_one_as_monotonic_monotonic_ret_cmpxchg:
17716 ; GFX10-CU: ; %bb.0: ; %entry
17717 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
17718 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
17719 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
17720 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
17721 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
17722 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
17723 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
17724 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
17725 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
17726 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
17727 ; GFX10-CU-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
17728 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
17729 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
17730 ; GFX10-CU-NEXT: s_endpgm
17732 ; SKIP-CACHE-INV-LABEL: global_system_one_as_monotonic_monotonic_ret_cmpxchg:
17733 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
17734 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
17735 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
17736 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
17737 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
17738 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
17739 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
17740 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
17741 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
17742 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
17743 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
17744 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
17745 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
17746 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
17747 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
17748 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
17749 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
17750 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16 glc
17751 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
17752 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
17753 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
17754 ; SKIP-CACHE-INV-NEXT: s_endpgm
17756 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_monotonic_ret_cmpxchg:
17757 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
17758 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
17759 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
17760 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
17761 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
17762 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
17763 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
17764 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
17765 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
17766 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
17767 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
17768 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
17769 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
17770 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
17771 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
17773 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_monotonic_monotonic_ret_cmpxchg:
17774 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
17775 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
17776 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
17777 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
17778 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
17779 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
17780 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
17781 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
17782 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
17783 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
17784 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
17785 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
17786 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
17787 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
17788 ; GFX90A-TGSPLIT-NEXT: s_endpgm
17790 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_monotonic_ret_cmpxchg:
17791 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
17792 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
17793 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
17794 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
17795 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
17796 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
17797 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
17798 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
17799 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
17800 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
17801 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
17802 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
17803 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
17804 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
17805 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
17807 ; GFX940-TGSPLIT-LABEL: global_system_one_as_monotonic_monotonic_ret_cmpxchg:
17808 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
17809 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
17810 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
17811 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
17812 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
17813 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
17814 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
17815 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
17816 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
17817 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
17818 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
17819 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
17820 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
17821 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
17822 ; GFX940-TGSPLIT-NEXT: s_endpgm
17824 ; GFX11-WGP-LABEL: global_system_one_as_monotonic_monotonic_ret_cmpxchg:
17825 ; GFX11-WGP: ; %bb.0: ; %entry
17826 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
17827 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
17828 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
17829 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
17830 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
17831 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
17832 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
17833 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
17834 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
17835 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
17836 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
17837 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
17838 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
17839 ; GFX11-WGP-NEXT: s_endpgm
17841 ; GFX11-CU-LABEL: global_system_one_as_monotonic_monotonic_ret_cmpxchg:
17842 ; GFX11-CU: ; %bb.0: ; %entry
17843 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
17844 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
17845 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
17846 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
17847 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
17848 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
17849 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
17850 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
17851 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
17852 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
17853 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
17854 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
17855 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
17856 ; GFX11-CU-NEXT: s_endpgm
17858 ; GFX12-WGP-LABEL: global_system_one_as_monotonic_monotonic_ret_cmpxchg:
17859 ; GFX12-WGP: ; %bb.0: ; %entry
17860 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
17861 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
17862 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
17863 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
17864 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
17865 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
17866 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
17867 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
17868 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
17869 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
17870 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
17871 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
17872 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
17873 ; GFX12-WGP-NEXT: s_endpgm
17875 ; GFX12-CU-LABEL: global_system_one_as_monotonic_monotonic_ret_cmpxchg:
17876 ; GFX12-CU: ; %bb.0: ; %entry
17877 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
17878 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
17879 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
17880 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
17881 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
17882 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
17883 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
17884 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
17885 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
17886 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
17887 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
17888 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
17889 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
17890 ; GFX12-CU-NEXT: s_endpgm
17891 ptr addrspace(1) %out, i32 %in, i32 %old) {
17893 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
17894 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") monotonic monotonic
17895 %val0 = extractvalue { i32, i1 } %val, 0
17896 store i32 %val0, ptr addrspace(1) %out, align 4
17900 define amdgpu_kernel void @global_system_one_as_acquire_monotonic_ret_cmpxchg(
17901 ; GFX6-LABEL: global_system_one_as_acquire_monotonic_ret_cmpxchg:
17902 ; GFX6: ; %bb.0: ; %entry
17903 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
17904 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
17905 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
17906 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
17907 ; GFX6-NEXT: s_mov_b32 s12, s5
17908 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
17909 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
17910 ; GFX6-NEXT: s_mov_b32 s11, -1
17911 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
17912 ; GFX6-NEXT: s_mov_b32 s5, s12
17913 ; GFX6-NEXT: s_mov_b32 s6, s11
17914 ; GFX6-NEXT: s_mov_b32 s7, s10
17915 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
17916 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
17917 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
17918 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
17919 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
17920 ; GFX6-NEXT: s_waitcnt vmcnt(0)
17921 ; GFX6-NEXT: buffer_wbinvl1
17922 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
17923 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
17924 ; GFX6-NEXT: s_endpgm
17926 ; GFX7-LABEL: global_system_one_as_acquire_monotonic_ret_cmpxchg:
17927 ; GFX7: ; %bb.0: ; %entry
17928 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
17929 ; GFX7-NEXT: s_load_dword s9, s[6:7], 0x2
17930 ; GFX7-NEXT: s_load_dword s8, s[6:7], 0x3
17931 ; GFX7-NEXT: s_mov_b64 s[12:13], 16
17932 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
17933 ; GFX7-NEXT: s_mov_b32 s6, s4
17934 ; GFX7-NEXT: s_mov_b32 s7, s5
17935 ; GFX7-NEXT: s_mov_b32 s11, s12
17936 ; GFX7-NEXT: s_mov_b32 s10, s13
17937 ; GFX7-NEXT: s_add_u32 s6, s6, s11
17938 ; GFX7-NEXT: s_addc_u32 s10, s7, s10
17939 ; GFX7-NEXT: ; kill: def $sgpr6 killed $sgpr6 def $sgpr6_sgpr7
17940 ; GFX7-NEXT: s_mov_b32 s7, s10
17941 ; GFX7-NEXT: v_mov_b32_e32 v2, s9
17942 ; GFX7-NEXT: v_mov_b32_e32 v0, s8
17943 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
17944 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
17945 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
17946 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
17947 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
17948 ; GFX7-NEXT: s_waitcnt vmcnt(0)
17949 ; GFX7-NEXT: buffer_wbinvl1_vol
17950 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
17951 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
17952 ; GFX7-NEXT: flat_store_dword v[0:1], v2
17953 ; GFX7-NEXT: s_endpgm
17955 ; GFX10-WGP-LABEL: global_system_one_as_acquire_monotonic_ret_cmpxchg:
17956 ; GFX10-WGP: ; %bb.0: ; %entry
17957 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
17958 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
17959 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
17960 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
17961 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
17962 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
17963 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
17964 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
17965 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
17966 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
17967 ; GFX10-WGP-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
17968 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
17969 ; GFX10-WGP-NEXT: buffer_gl1_inv
17970 ; GFX10-WGP-NEXT: buffer_gl0_inv
17971 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
17972 ; GFX10-WGP-NEXT: s_endpgm
17974 ; GFX10-CU-LABEL: global_system_one_as_acquire_monotonic_ret_cmpxchg:
17975 ; GFX10-CU: ; %bb.0: ; %entry
17976 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
17977 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
17978 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
17979 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
17980 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
17981 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
17982 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
17983 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
17984 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
17985 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
17986 ; GFX10-CU-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
17987 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
17988 ; GFX10-CU-NEXT: buffer_gl1_inv
17989 ; GFX10-CU-NEXT: buffer_gl0_inv
17990 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
17991 ; GFX10-CU-NEXT: s_endpgm
17993 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acquire_monotonic_ret_cmpxchg:
17994 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
17995 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
17996 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
17997 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
17998 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
17999 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
18000 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
18001 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
18002 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
18003 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
18004 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
18005 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
18006 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
18007 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
18008 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
18009 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
18010 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
18011 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16 glc
18012 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
18013 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
18014 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
18015 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
18016 ; SKIP-CACHE-INV-NEXT: s_endpgm
18018 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acquire_monotonic_ret_cmpxchg:
18019 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
18020 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
18021 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
18022 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
18023 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
18024 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
18025 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
18026 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
18027 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
18028 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
18029 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
18030 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
18031 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
18032 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
18033 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
18034 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
18035 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
18037 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acquire_monotonic_ret_cmpxchg:
18038 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
18039 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
18040 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
18041 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
18042 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
18043 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
18044 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
18045 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
18046 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
18047 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
18048 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
18049 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
18050 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
18051 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
18052 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
18053 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
18054 ; GFX90A-TGSPLIT-NEXT: s_endpgm
18056 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acquire_monotonic_ret_cmpxchg:
18057 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
18058 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
18059 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
18060 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
18061 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
18062 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
18063 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
18064 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
18065 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
18066 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
18067 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
18068 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
18069 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
18070 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
18071 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
18072 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
18074 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acquire_monotonic_ret_cmpxchg:
18075 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
18076 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
18077 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
18078 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
18079 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
18080 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
18081 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
18082 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
18083 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
18084 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
18085 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
18086 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
18087 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
18088 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
18089 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
18090 ; GFX940-TGSPLIT-NEXT: s_endpgm
18092 ; GFX11-WGP-LABEL: global_system_one_as_acquire_monotonic_ret_cmpxchg:
18093 ; GFX11-WGP: ; %bb.0: ; %entry
18094 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
18095 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
18096 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
18097 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
18098 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
18099 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
18100 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
18101 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
18102 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
18103 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
18104 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
18105 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
18106 ; GFX11-WGP-NEXT: buffer_gl1_inv
18107 ; GFX11-WGP-NEXT: buffer_gl0_inv
18108 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
18109 ; GFX11-WGP-NEXT: s_endpgm
18111 ; GFX11-CU-LABEL: global_system_one_as_acquire_monotonic_ret_cmpxchg:
18112 ; GFX11-CU: ; %bb.0: ; %entry
18113 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
18114 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
18115 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
18116 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
18117 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
18118 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
18119 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
18120 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
18121 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
18122 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
18123 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
18124 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
18125 ; GFX11-CU-NEXT: buffer_gl1_inv
18126 ; GFX11-CU-NEXT: buffer_gl0_inv
18127 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
18128 ; GFX11-CU-NEXT: s_endpgm
18130 ; GFX12-WGP-LABEL: global_system_one_as_acquire_monotonic_ret_cmpxchg:
18131 ; GFX12-WGP: ; %bb.0: ; %entry
18132 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
18133 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
18134 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
18135 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
18136 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
18137 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
18138 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
18139 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
18140 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
18141 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
18142 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
18143 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
18144 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
18145 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
18146 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
18147 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
18148 ; GFX12-WGP-NEXT: s_endpgm
18150 ; GFX12-CU-LABEL: global_system_one_as_acquire_monotonic_ret_cmpxchg:
18151 ; GFX12-CU: ; %bb.0: ; %entry
18152 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
18153 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
18154 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
18155 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
18156 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
18157 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
18158 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
18159 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
18160 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
18161 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
18162 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
18163 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
18164 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
18165 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
18166 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
18167 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
18168 ; GFX12-CU-NEXT: s_endpgm
18169 ptr addrspace(1) %out, i32 %in, i32 %old) {
18171 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
18172 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") acquire monotonic
18173 %val0 = extractvalue { i32, i1 } %val, 0
18174 store i32 %val0, ptr addrspace(1) %out, align 4
18178 define amdgpu_kernel void @global_system_one_as_release_monotonic_ret_cmpxchg(
18179 ; GFX6-LABEL: global_system_one_as_release_monotonic_ret_cmpxchg:
18180 ; GFX6: ; %bb.0: ; %entry
18181 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
18182 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
18183 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
18184 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
18185 ; GFX6-NEXT: s_mov_b32 s12, s5
18186 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
18187 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
18188 ; GFX6-NEXT: s_mov_b32 s11, -1
18189 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
18190 ; GFX6-NEXT: s_mov_b32 s5, s12
18191 ; GFX6-NEXT: s_mov_b32 s6, s11
18192 ; GFX6-NEXT: s_mov_b32 s7, s10
18193 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
18194 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
18195 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
18196 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
18197 ; GFX6-NEXT: s_waitcnt vmcnt(0)
18198 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
18199 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
18200 ; GFX6-NEXT: s_waitcnt vmcnt(0)
18201 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
18202 ; GFX6-NEXT: s_endpgm
18204 ; GFX7-LABEL: global_system_one_as_release_monotonic_ret_cmpxchg:
18205 ; GFX7: ; %bb.0: ; %entry
18206 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
18207 ; GFX7-NEXT: s_load_dword s9, s[6:7], 0x2
18208 ; GFX7-NEXT: s_load_dword s8, s[6:7], 0x3
18209 ; GFX7-NEXT: s_mov_b64 s[12:13], 16
18210 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
18211 ; GFX7-NEXT: s_mov_b32 s6, s4
18212 ; GFX7-NEXT: s_mov_b32 s7, s5
18213 ; GFX7-NEXT: s_mov_b32 s11, s12
18214 ; GFX7-NEXT: s_mov_b32 s10, s13
18215 ; GFX7-NEXT: s_add_u32 s6, s6, s11
18216 ; GFX7-NEXT: s_addc_u32 s10, s7, s10
18217 ; GFX7-NEXT: ; kill: def $sgpr6 killed $sgpr6 def $sgpr6_sgpr7
18218 ; GFX7-NEXT: s_mov_b32 s7, s10
18219 ; GFX7-NEXT: v_mov_b32_e32 v2, s9
18220 ; GFX7-NEXT: v_mov_b32_e32 v0, s8
18221 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
18222 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
18223 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
18224 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
18225 ; GFX7-NEXT: s_waitcnt vmcnt(0)
18226 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
18227 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
18228 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
18229 ; GFX7-NEXT: s_waitcnt vmcnt(0)
18230 ; GFX7-NEXT: flat_store_dword v[0:1], v2
18231 ; GFX7-NEXT: s_endpgm
18233 ; GFX10-WGP-LABEL: global_system_one_as_release_monotonic_ret_cmpxchg:
18234 ; GFX10-WGP: ; %bb.0: ; %entry
18235 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
18236 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
18237 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
18238 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
18239 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
18240 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
18241 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
18242 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
18243 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
18244 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
18245 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
18246 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
18247 ; GFX10-WGP-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
18248 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
18249 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
18250 ; GFX10-WGP-NEXT: s_endpgm
18252 ; GFX10-CU-LABEL: global_system_one_as_release_monotonic_ret_cmpxchg:
18253 ; GFX10-CU: ; %bb.0: ; %entry
18254 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
18255 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
18256 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
18257 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
18258 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
18259 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
18260 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
18261 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
18262 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
18263 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
18264 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
18265 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
18266 ; GFX10-CU-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
18267 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
18268 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
18269 ; GFX10-CU-NEXT: s_endpgm
18271 ; SKIP-CACHE-INV-LABEL: global_system_one_as_release_monotonic_ret_cmpxchg:
18272 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
18273 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
18274 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
18275 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
18276 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
18277 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
18278 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
18279 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
18280 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
18281 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
18282 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
18283 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
18284 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
18285 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
18286 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
18287 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
18288 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
18289 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
18290 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16 glc
18291 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
18292 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
18293 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
18294 ; SKIP-CACHE-INV-NEXT: s_endpgm
18296 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_release_monotonic_ret_cmpxchg:
18297 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
18298 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
18299 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
18300 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
18301 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
18302 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
18303 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
18304 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
18305 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
18306 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
18307 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
18308 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
18309 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
18310 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
18311 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
18312 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
18313 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
18315 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_release_monotonic_ret_cmpxchg:
18316 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
18317 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
18318 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
18319 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
18320 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
18321 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
18322 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
18323 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
18324 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
18325 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
18326 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
18327 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
18328 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
18329 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
18330 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
18331 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
18332 ; GFX90A-TGSPLIT-NEXT: s_endpgm
18334 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_release_monotonic_ret_cmpxchg:
18335 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
18336 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
18337 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
18338 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
18339 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
18340 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
18341 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
18342 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
18343 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
18344 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
18345 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
18346 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
18347 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
18348 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
18349 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
18350 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
18351 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
18353 ; GFX940-TGSPLIT-LABEL: global_system_one_as_release_monotonic_ret_cmpxchg:
18354 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
18355 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
18356 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
18357 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
18358 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
18359 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
18360 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
18361 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
18362 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
18363 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
18364 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
18365 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
18366 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
18367 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
18368 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
18369 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
18370 ; GFX940-TGSPLIT-NEXT: s_endpgm
18372 ; GFX11-WGP-LABEL: global_system_one_as_release_monotonic_ret_cmpxchg:
18373 ; GFX11-WGP: ; %bb.0: ; %entry
18374 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
18375 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
18376 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
18377 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
18378 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
18379 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
18380 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
18381 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
18382 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
18383 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
18384 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
18385 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
18386 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
18387 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
18388 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
18389 ; GFX11-WGP-NEXT: s_endpgm
18391 ; GFX11-CU-LABEL: global_system_one_as_release_monotonic_ret_cmpxchg:
18392 ; GFX11-CU: ; %bb.0: ; %entry
18393 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
18394 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
18395 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
18396 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
18397 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
18398 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
18399 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
18400 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
18401 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
18402 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
18403 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
18404 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
18405 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
18406 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
18407 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
18408 ; GFX11-CU-NEXT: s_endpgm
18410 ; GFX12-WGP-LABEL: global_system_one_as_release_monotonic_ret_cmpxchg:
18411 ; GFX12-WGP: ; %bb.0: ; %entry
18412 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
18413 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
18414 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
18415 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
18416 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
18417 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
18418 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
18419 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
18420 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
18421 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
18422 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
18423 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
18424 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
18425 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
18426 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
18427 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
18428 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
18429 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
18430 ; GFX12-WGP-NEXT: s_endpgm
18432 ; GFX12-CU-LABEL: global_system_one_as_release_monotonic_ret_cmpxchg:
18433 ; GFX12-CU: ; %bb.0: ; %entry
18434 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
18435 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
18436 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
18437 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
18438 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
18439 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
18440 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
18441 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
18442 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
18443 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
18444 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
18445 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
18446 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
18447 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
18448 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
18449 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
18450 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
18451 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
18452 ; GFX12-CU-NEXT: s_endpgm
18453 ptr addrspace(1) %out, i32 %in, i32 %old) {
18455 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
18456 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") release monotonic
18457 %val0 = extractvalue { i32, i1 } %val, 0
18458 store i32 %val0, ptr addrspace(1) %out, align 4
18462 define amdgpu_kernel void @global_system_one_as_acq_rel_monotonic_ret_cmpxchg(
18463 ; GFX6-LABEL: global_system_one_as_acq_rel_monotonic_ret_cmpxchg:
18464 ; GFX6: ; %bb.0: ; %entry
18465 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
18466 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
18467 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
18468 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
18469 ; GFX6-NEXT: s_mov_b32 s12, s5
18470 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
18471 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
18472 ; GFX6-NEXT: s_mov_b32 s11, -1
18473 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
18474 ; GFX6-NEXT: s_mov_b32 s5, s12
18475 ; GFX6-NEXT: s_mov_b32 s6, s11
18476 ; GFX6-NEXT: s_mov_b32 s7, s10
18477 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
18478 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
18479 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
18480 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
18481 ; GFX6-NEXT: s_waitcnt vmcnt(0)
18482 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
18483 ; GFX6-NEXT: s_waitcnt vmcnt(0)
18484 ; GFX6-NEXT: buffer_wbinvl1
18485 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
18486 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
18487 ; GFX6-NEXT: s_endpgm
18489 ; GFX7-LABEL: global_system_one_as_acq_rel_monotonic_ret_cmpxchg:
18490 ; GFX7: ; %bb.0: ; %entry
18491 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
18492 ; GFX7-NEXT: s_load_dword s9, s[6:7], 0x2
18493 ; GFX7-NEXT: s_load_dword s8, s[6:7], 0x3
18494 ; GFX7-NEXT: s_mov_b64 s[12:13], 16
18495 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
18496 ; GFX7-NEXT: s_mov_b32 s6, s4
18497 ; GFX7-NEXT: s_mov_b32 s7, s5
18498 ; GFX7-NEXT: s_mov_b32 s11, s12
18499 ; GFX7-NEXT: s_mov_b32 s10, s13
18500 ; GFX7-NEXT: s_add_u32 s6, s6, s11
18501 ; GFX7-NEXT: s_addc_u32 s10, s7, s10
18502 ; GFX7-NEXT: ; kill: def $sgpr6 killed $sgpr6 def $sgpr6_sgpr7
18503 ; GFX7-NEXT: s_mov_b32 s7, s10
18504 ; GFX7-NEXT: v_mov_b32_e32 v2, s9
18505 ; GFX7-NEXT: v_mov_b32_e32 v0, s8
18506 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
18507 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
18508 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
18509 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
18510 ; GFX7-NEXT: s_waitcnt vmcnt(0)
18511 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
18512 ; GFX7-NEXT: s_waitcnt vmcnt(0)
18513 ; GFX7-NEXT: buffer_wbinvl1_vol
18514 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
18515 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
18516 ; GFX7-NEXT: flat_store_dword v[0:1], v2
18517 ; GFX7-NEXT: s_endpgm
18519 ; GFX10-WGP-LABEL: global_system_one_as_acq_rel_monotonic_ret_cmpxchg:
18520 ; GFX10-WGP: ; %bb.0: ; %entry
18521 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
18522 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
18523 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
18524 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
18525 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
18526 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
18527 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
18528 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
18529 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
18530 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
18531 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
18532 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
18533 ; GFX10-WGP-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
18534 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
18535 ; GFX10-WGP-NEXT: buffer_gl1_inv
18536 ; GFX10-WGP-NEXT: buffer_gl0_inv
18537 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
18538 ; GFX10-WGP-NEXT: s_endpgm
18540 ; GFX10-CU-LABEL: global_system_one_as_acq_rel_monotonic_ret_cmpxchg:
18541 ; GFX10-CU: ; %bb.0: ; %entry
18542 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
18543 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
18544 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
18545 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
18546 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
18547 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
18548 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
18549 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
18550 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
18551 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
18552 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
18553 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
18554 ; GFX10-CU-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
18555 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
18556 ; GFX10-CU-NEXT: buffer_gl1_inv
18557 ; GFX10-CU-NEXT: buffer_gl0_inv
18558 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
18559 ; GFX10-CU-NEXT: s_endpgm
18561 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acq_rel_monotonic_ret_cmpxchg:
18562 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
18563 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
18564 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
18565 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
18566 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
18567 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
18568 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
18569 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
18570 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
18571 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
18572 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
18573 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
18574 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
18575 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
18576 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
18577 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
18578 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
18579 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
18580 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16 glc
18581 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
18582 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
18583 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
18584 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
18585 ; SKIP-CACHE-INV-NEXT: s_endpgm
18587 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_monotonic_ret_cmpxchg:
18588 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
18589 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
18590 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
18591 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
18592 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
18593 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
18594 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
18595 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
18596 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
18597 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
18598 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
18599 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
18600 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
18601 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
18602 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
18603 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
18604 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
18605 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
18606 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
18608 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acq_rel_monotonic_ret_cmpxchg:
18609 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
18610 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
18611 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
18612 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
18613 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
18614 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
18615 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
18616 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
18617 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
18618 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
18619 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
18620 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
18621 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
18622 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
18623 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
18624 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
18625 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
18626 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
18627 ; GFX90A-TGSPLIT-NEXT: s_endpgm
18629 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_monotonic_ret_cmpxchg:
18630 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
18631 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
18632 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
18633 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
18634 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
18635 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
18636 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
18637 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
18638 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
18639 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
18640 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
18641 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
18642 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
18643 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
18644 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
18645 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
18646 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
18647 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
18649 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acq_rel_monotonic_ret_cmpxchg:
18650 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
18651 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
18652 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
18653 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
18654 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
18655 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
18656 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
18657 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
18658 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
18659 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
18660 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
18661 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
18662 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
18663 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
18664 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
18665 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
18666 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
18667 ; GFX940-TGSPLIT-NEXT: s_endpgm
18669 ; GFX11-WGP-LABEL: global_system_one_as_acq_rel_monotonic_ret_cmpxchg:
18670 ; GFX11-WGP: ; %bb.0: ; %entry
18671 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
18672 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
18673 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
18674 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
18675 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
18676 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
18677 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
18678 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
18679 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
18680 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
18681 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
18682 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
18683 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
18684 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
18685 ; GFX11-WGP-NEXT: buffer_gl1_inv
18686 ; GFX11-WGP-NEXT: buffer_gl0_inv
18687 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
18688 ; GFX11-WGP-NEXT: s_endpgm
18690 ; GFX11-CU-LABEL: global_system_one_as_acq_rel_monotonic_ret_cmpxchg:
18691 ; GFX11-CU: ; %bb.0: ; %entry
18692 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
18693 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
18694 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
18695 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
18696 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
18697 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
18698 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
18699 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
18700 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
18701 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
18702 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
18703 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
18704 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
18705 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
18706 ; GFX11-CU-NEXT: buffer_gl1_inv
18707 ; GFX11-CU-NEXT: buffer_gl0_inv
18708 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
18709 ; GFX11-CU-NEXT: s_endpgm
18711 ; GFX12-WGP-LABEL: global_system_one_as_acq_rel_monotonic_ret_cmpxchg:
18712 ; GFX12-WGP: ; %bb.0: ; %entry
18713 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
18714 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
18715 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
18716 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
18717 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
18718 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
18719 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
18720 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
18721 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
18722 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
18723 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
18724 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
18725 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
18726 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
18727 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
18728 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
18729 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
18730 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
18731 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
18732 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
18733 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
18734 ; GFX12-WGP-NEXT: s_endpgm
18736 ; GFX12-CU-LABEL: global_system_one_as_acq_rel_monotonic_ret_cmpxchg:
18737 ; GFX12-CU: ; %bb.0: ; %entry
18738 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
18739 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
18740 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
18741 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
18742 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
18743 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
18744 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
18745 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
18746 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
18747 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
18748 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
18749 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
18750 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
18751 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
18752 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
18753 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
18754 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
18755 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
18756 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
18757 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
18758 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
18759 ; GFX12-CU-NEXT: s_endpgm
18760 ptr addrspace(1) %out, i32 %in, i32 %old) {
18762 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
18763 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") acq_rel monotonic
18764 %val0 = extractvalue { i32, i1 } %val, 0
18765 store i32 %val0, ptr addrspace(1) %out, align 4
18769 define amdgpu_kernel void @global_system_one_as_seq_cst_monotonic_ret_cmpxchg(
18770 ; GFX6-LABEL: global_system_one_as_seq_cst_monotonic_ret_cmpxchg:
18771 ; GFX6: ; %bb.0: ; %entry
18772 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
18773 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
18774 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
18775 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
18776 ; GFX6-NEXT: s_mov_b32 s12, s5
18777 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
18778 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
18779 ; GFX6-NEXT: s_mov_b32 s11, -1
18780 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
18781 ; GFX6-NEXT: s_mov_b32 s5, s12
18782 ; GFX6-NEXT: s_mov_b32 s6, s11
18783 ; GFX6-NEXT: s_mov_b32 s7, s10
18784 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
18785 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
18786 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
18787 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
18788 ; GFX6-NEXT: s_waitcnt vmcnt(0)
18789 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
18790 ; GFX6-NEXT: s_waitcnt vmcnt(0)
18791 ; GFX6-NEXT: buffer_wbinvl1
18792 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
18793 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
18794 ; GFX6-NEXT: s_endpgm
18796 ; GFX7-LABEL: global_system_one_as_seq_cst_monotonic_ret_cmpxchg:
18797 ; GFX7: ; %bb.0: ; %entry
18798 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
18799 ; GFX7-NEXT: s_load_dword s9, s[6:7], 0x2
18800 ; GFX7-NEXT: s_load_dword s8, s[6:7], 0x3
18801 ; GFX7-NEXT: s_mov_b64 s[12:13], 16
18802 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
18803 ; GFX7-NEXT: s_mov_b32 s6, s4
18804 ; GFX7-NEXT: s_mov_b32 s7, s5
18805 ; GFX7-NEXT: s_mov_b32 s11, s12
18806 ; GFX7-NEXT: s_mov_b32 s10, s13
18807 ; GFX7-NEXT: s_add_u32 s6, s6, s11
18808 ; GFX7-NEXT: s_addc_u32 s10, s7, s10
18809 ; GFX7-NEXT: ; kill: def $sgpr6 killed $sgpr6 def $sgpr6_sgpr7
18810 ; GFX7-NEXT: s_mov_b32 s7, s10
18811 ; GFX7-NEXT: v_mov_b32_e32 v2, s9
18812 ; GFX7-NEXT: v_mov_b32_e32 v0, s8
18813 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
18814 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
18815 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
18816 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
18817 ; GFX7-NEXT: s_waitcnt vmcnt(0)
18818 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
18819 ; GFX7-NEXT: s_waitcnt vmcnt(0)
18820 ; GFX7-NEXT: buffer_wbinvl1_vol
18821 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
18822 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
18823 ; GFX7-NEXT: flat_store_dword v[0:1], v2
18824 ; GFX7-NEXT: s_endpgm
18826 ; GFX10-WGP-LABEL: global_system_one_as_seq_cst_monotonic_ret_cmpxchg:
18827 ; GFX10-WGP: ; %bb.0: ; %entry
18828 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
18829 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
18830 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
18831 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
18832 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
18833 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
18834 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
18835 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
18836 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
18837 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
18838 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
18839 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
18840 ; GFX10-WGP-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
18841 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
18842 ; GFX10-WGP-NEXT: buffer_gl1_inv
18843 ; GFX10-WGP-NEXT: buffer_gl0_inv
18844 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
18845 ; GFX10-WGP-NEXT: s_endpgm
18847 ; GFX10-CU-LABEL: global_system_one_as_seq_cst_monotonic_ret_cmpxchg:
18848 ; GFX10-CU: ; %bb.0: ; %entry
18849 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
18850 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
18851 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
18852 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
18853 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
18854 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
18855 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
18856 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
18857 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
18858 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
18859 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
18860 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
18861 ; GFX10-CU-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
18862 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
18863 ; GFX10-CU-NEXT: buffer_gl1_inv
18864 ; GFX10-CU-NEXT: buffer_gl0_inv
18865 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
18866 ; GFX10-CU-NEXT: s_endpgm
18868 ; SKIP-CACHE-INV-LABEL: global_system_one_as_seq_cst_monotonic_ret_cmpxchg:
18869 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
18870 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
18871 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
18872 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
18873 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
18874 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
18875 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
18876 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
18877 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
18878 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
18879 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
18880 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
18881 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
18882 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
18883 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
18884 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
18885 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
18886 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
18887 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16 glc
18888 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
18889 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
18890 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
18891 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
18892 ; SKIP-CACHE-INV-NEXT: s_endpgm
18894 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_monotonic_ret_cmpxchg:
18895 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
18896 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
18897 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
18898 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
18899 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
18900 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
18901 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
18902 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
18903 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
18904 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
18905 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
18906 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
18907 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
18908 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
18909 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
18910 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
18911 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
18912 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
18913 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
18915 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_seq_cst_monotonic_ret_cmpxchg:
18916 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
18917 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
18918 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
18919 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
18920 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
18921 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
18922 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
18923 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
18924 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
18925 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
18926 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
18927 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
18928 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
18929 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
18930 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
18931 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
18932 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
18933 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
18934 ; GFX90A-TGSPLIT-NEXT: s_endpgm
18936 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_monotonic_ret_cmpxchg:
18937 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
18938 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
18939 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
18940 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
18941 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
18942 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
18943 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
18944 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
18945 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
18946 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
18947 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
18948 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
18949 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
18950 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
18951 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
18952 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
18953 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
18954 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
18956 ; GFX940-TGSPLIT-LABEL: global_system_one_as_seq_cst_monotonic_ret_cmpxchg:
18957 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
18958 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
18959 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
18960 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
18961 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
18962 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
18963 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
18964 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
18965 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
18966 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
18967 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
18968 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
18969 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
18970 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
18971 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
18972 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
18973 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
18974 ; GFX940-TGSPLIT-NEXT: s_endpgm
18976 ; GFX11-WGP-LABEL: global_system_one_as_seq_cst_monotonic_ret_cmpxchg:
18977 ; GFX11-WGP: ; %bb.0: ; %entry
18978 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
18979 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
18980 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
18981 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
18982 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
18983 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
18984 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
18985 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
18986 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
18987 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
18988 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
18989 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
18990 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
18991 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
18992 ; GFX11-WGP-NEXT: buffer_gl1_inv
18993 ; GFX11-WGP-NEXT: buffer_gl0_inv
18994 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
18995 ; GFX11-WGP-NEXT: s_endpgm
18997 ; GFX11-CU-LABEL: global_system_one_as_seq_cst_monotonic_ret_cmpxchg:
18998 ; GFX11-CU: ; %bb.0: ; %entry
18999 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
19000 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
19001 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
19002 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
19003 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
19004 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
19005 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
19006 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
19007 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
19008 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
19009 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
19010 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
19011 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
19012 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
19013 ; GFX11-CU-NEXT: buffer_gl1_inv
19014 ; GFX11-CU-NEXT: buffer_gl0_inv
19015 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
19016 ; GFX11-CU-NEXT: s_endpgm
19018 ; GFX12-WGP-LABEL: global_system_one_as_seq_cst_monotonic_ret_cmpxchg:
19019 ; GFX12-WGP: ; %bb.0: ; %entry
19020 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
19021 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
19022 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
19023 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
19024 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
19025 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
19026 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
19027 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
19028 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
19029 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
19030 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
19031 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
19032 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
19033 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
19034 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
19035 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
19036 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
19037 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
19038 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
19039 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
19040 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
19041 ; GFX12-WGP-NEXT: s_endpgm
19043 ; GFX12-CU-LABEL: global_system_one_as_seq_cst_monotonic_ret_cmpxchg:
19044 ; GFX12-CU: ; %bb.0: ; %entry
19045 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
19046 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
19047 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
19048 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
19049 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
19050 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
19051 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
19052 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
19053 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
19054 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
19055 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
19056 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
19057 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
19058 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
19059 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
19060 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
19061 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
19062 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
19063 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
19064 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
19065 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
19066 ; GFX12-CU-NEXT: s_endpgm
19067 ptr addrspace(1) %out, i32 %in, i32 %old) {
19069 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
19070 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") seq_cst monotonic
19071 %val0 = extractvalue { i32, i1 } %val, 0
19072 store i32 %val0, ptr addrspace(1) %out, align 4
19076 define amdgpu_kernel void @global_system_one_as_monotonic_acquire_ret_cmpxchg(
19077 ; GFX6-LABEL: global_system_one_as_monotonic_acquire_ret_cmpxchg:
19078 ; GFX6: ; %bb.0: ; %entry
19079 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
19080 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
19081 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
19082 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
19083 ; GFX6-NEXT: s_mov_b32 s12, s5
19084 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
19085 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
19086 ; GFX6-NEXT: s_mov_b32 s11, -1
19087 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
19088 ; GFX6-NEXT: s_mov_b32 s5, s12
19089 ; GFX6-NEXT: s_mov_b32 s6, s11
19090 ; GFX6-NEXT: s_mov_b32 s7, s10
19091 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
19092 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
19093 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
19094 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
19095 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
19096 ; GFX6-NEXT: s_waitcnt vmcnt(0)
19097 ; GFX6-NEXT: buffer_wbinvl1
19098 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
19099 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
19100 ; GFX6-NEXT: s_endpgm
19102 ; GFX7-LABEL: global_system_one_as_monotonic_acquire_ret_cmpxchg:
19103 ; GFX7: ; %bb.0: ; %entry
19104 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
19105 ; GFX7-NEXT: s_load_dword s9, s[6:7], 0x2
19106 ; GFX7-NEXT: s_load_dword s8, s[6:7], 0x3
19107 ; GFX7-NEXT: s_mov_b64 s[12:13], 16
19108 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
19109 ; GFX7-NEXT: s_mov_b32 s6, s4
19110 ; GFX7-NEXT: s_mov_b32 s7, s5
19111 ; GFX7-NEXT: s_mov_b32 s11, s12
19112 ; GFX7-NEXT: s_mov_b32 s10, s13
19113 ; GFX7-NEXT: s_add_u32 s6, s6, s11
19114 ; GFX7-NEXT: s_addc_u32 s10, s7, s10
19115 ; GFX7-NEXT: ; kill: def $sgpr6 killed $sgpr6 def $sgpr6_sgpr7
19116 ; GFX7-NEXT: s_mov_b32 s7, s10
19117 ; GFX7-NEXT: v_mov_b32_e32 v2, s9
19118 ; GFX7-NEXT: v_mov_b32_e32 v0, s8
19119 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
19120 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
19121 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
19122 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
19123 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
19124 ; GFX7-NEXT: s_waitcnt vmcnt(0)
19125 ; GFX7-NEXT: buffer_wbinvl1_vol
19126 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
19127 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
19128 ; GFX7-NEXT: flat_store_dword v[0:1], v2
19129 ; GFX7-NEXT: s_endpgm
19131 ; GFX10-WGP-LABEL: global_system_one_as_monotonic_acquire_ret_cmpxchg:
19132 ; GFX10-WGP: ; %bb.0: ; %entry
19133 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
19134 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
19135 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
19136 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
19137 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
19138 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
19139 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
19140 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
19141 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
19142 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
19143 ; GFX10-WGP-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
19144 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
19145 ; GFX10-WGP-NEXT: buffer_gl1_inv
19146 ; GFX10-WGP-NEXT: buffer_gl0_inv
19147 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
19148 ; GFX10-WGP-NEXT: s_endpgm
19150 ; GFX10-CU-LABEL: global_system_one_as_monotonic_acquire_ret_cmpxchg:
19151 ; GFX10-CU: ; %bb.0: ; %entry
19152 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
19153 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
19154 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
19155 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
19156 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
19157 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
19158 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
19159 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
19160 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
19161 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
19162 ; GFX10-CU-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
19163 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
19164 ; GFX10-CU-NEXT: buffer_gl1_inv
19165 ; GFX10-CU-NEXT: buffer_gl0_inv
19166 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
19167 ; GFX10-CU-NEXT: s_endpgm
19169 ; SKIP-CACHE-INV-LABEL: global_system_one_as_monotonic_acquire_ret_cmpxchg:
19170 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
19171 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
19172 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
19173 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
19174 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
19175 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
19176 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
19177 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
19178 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
19179 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
19180 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
19181 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
19182 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
19183 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
19184 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
19185 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
19186 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
19187 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16 glc
19188 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
19189 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
19190 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
19191 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
19192 ; SKIP-CACHE-INV-NEXT: s_endpgm
19194 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_acquire_ret_cmpxchg:
19195 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
19196 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
19197 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
19198 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
19199 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
19200 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
19201 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
19202 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
19203 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
19204 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
19205 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
19206 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
19207 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
19208 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
19209 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
19210 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
19211 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
19213 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_monotonic_acquire_ret_cmpxchg:
19214 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
19215 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
19216 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
19217 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
19218 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
19219 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
19220 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
19221 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
19222 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
19223 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
19224 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
19225 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
19226 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
19227 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
19228 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
19229 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
19230 ; GFX90A-TGSPLIT-NEXT: s_endpgm
19232 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_acquire_ret_cmpxchg:
19233 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
19234 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
19235 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
19236 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
19237 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
19238 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
19239 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
19240 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
19241 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
19242 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
19243 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
19244 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
19245 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
19246 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
19247 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
19248 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
19250 ; GFX940-TGSPLIT-LABEL: global_system_one_as_monotonic_acquire_ret_cmpxchg:
19251 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
19252 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
19253 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
19254 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
19255 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
19256 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
19257 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
19258 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
19259 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
19260 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
19261 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
19262 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
19263 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
19264 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
19265 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
19266 ; GFX940-TGSPLIT-NEXT: s_endpgm
19268 ; GFX11-WGP-LABEL: global_system_one_as_monotonic_acquire_ret_cmpxchg:
19269 ; GFX11-WGP: ; %bb.0: ; %entry
19270 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
19271 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
19272 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
19273 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
19274 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
19275 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
19276 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
19277 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
19278 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
19279 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
19280 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
19281 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
19282 ; GFX11-WGP-NEXT: buffer_gl1_inv
19283 ; GFX11-WGP-NEXT: buffer_gl0_inv
19284 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
19285 ; GFX11-WGP-NEXT: s_endpgm
19287 ; GFX11-CU-LABEL: global_system_one_as_monotonic_acquire_ret_cmpxchg:
19288 ; GFX11-CU: ; %bb.0: ; %entry
19289 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
19290 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
19291 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
19292 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
19293 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
19294 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
19295 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
19296 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
19297 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
19298 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
19299 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
19300 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
19301 ; GFX11-CU-NEXT: buffer_gl1_inv
19302 ; GFX11-CU-NEXT: buffer_gl0_inv
19303 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
19304 ; GFX11-CU-NEXT: s_endpgm
19306 ; GFX12-WGP-LABEL: global_system_one_as_monotonic_acquire_ret_cmpxchg:
19307 ; GFX12-WGP: ; %bb.0: ; %entry
19308 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
19309 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
19310 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
19311 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
19312 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
19313 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
19314 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
19315 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
19316 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
19317 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
19318 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
19319 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
19320 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
19321 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
19322 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
19323 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
19324 ; GFX12-WGP-NEXT: s_endpgm
19326 ; GFX12-CU-LABEL: global_system_one_as_monotonic_acquire_ret_cmpxchg:
19327 ; GFX12-CU: ; %bb.0: ; %entry
19328 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
19329 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
19330 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
19331 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
19332 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
19333 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
19334 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
19335 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
19336 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
19337 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
19338 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
19339 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
19340 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
19341 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
19342 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
19343 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
19344 ; GFX12-CU-NEXT: s_endpgm
19345 ptr addrspace(1) %out, i32 %in, i32 %old) {
19347 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
19348 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") monotonic acquire
19349 %val0 = extractvalue { i32, i1 } %val, 0
19350 store i32 %val0, ptr addrspace(1) %out, align 4
19354 define amdgpu_kernel void @global_system_one_as_acquire_acquire_ret_cmpxchg(
19355 ; GFX6-LABEL: global_system_one_as_acquire_acquire_ret_cmpxchg:
19356 ; GFX6: ; %bb.0: ; %entry
19357 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
19358 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
19359 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
19360 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
19361 ; GFX6-NEXT: s_mov_b32 s12, s5
19362 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
19363 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
19364 ; GFX6-NEXT: s_mov_b32 s11, -1
19365 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
19366 ; GFX6-NEXT: s_mov_b32 s5, s12
19367 ; GFX6-NEXT: s_mov_b32 s6, s11
19368 ; GFX6-NEXT: s_mov_b32 s7, s10
19369 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
19370 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
19371 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
19372 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
19373 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
19374 ; GFX6-NEXT: s_waitcnt vmcnt(0)
19375 ; GFX6-NEXT: buffer_wbinvl1
19376 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
19377 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
19378 ; GFX6-NEXT: s_endpgm
19380 ; GFX7-LABEL: global_system_one_as_acquire_acquire_ret_cmpxchg:
19381 ; GFX7: ; %bb.0: ; %entry
19382 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
19383 ; GFX7-NEXT: s_load_dword s9, s[6:7], 0x2
19384 ; GFX7-NEXT: s_load_dword s8, s[6:7], 0x3
19385 ; GFX7-NEXT: s_mov_b64 s[12:13], 16
19386 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
19387 ; GFX7-NEXT: s_mov_b32 s6, s4
19388 ; GFX7-NEXT: s_mov_b32 s7, s5
19389 ; GFX7-NEXT: s_mov_b32 s11, s12
19390 ; GFX7-NEXT: s_mov_b32 s10, s13
19391 ; GFX7-NEXT: s_add_u32 s6, s6, s11
19392 ; GFX7-NEXT: s_addc_u32 s10, s7, s10
19393 ; GFX7-NEXT: ; kill: def $sgpr6 killed $sgpr6 def $sgpr6_sgpr7
19394 ; GFX7-NEXT: s_mov_b32 s7, s10
19395 ; GFX7-NEXT: v_mov_b32_e32 v2, s9
19396 ; GFX7-NEXT: v_mov_b32_e32 v0, s8
19397 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
19398 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
19399 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
19400 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
19401 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
19402 ; GFX7-NEXT: s_waitcnt vmcnt(0)
19403 ; GFX7-NEXT: buffer_wbinvl1_vol
19404 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
19405 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
19406 ; GFX7-NEXT: flat_store_dword v[0:1], v2
19407 ; GFX7-NEXT: s_endpgm
19409 ; GFX10-WGP-LABEL: global_system_one_as_acquire_acquire_ret_cmpxchg:
19410 ; GFX10-WGP: ; %bb.0: ; %entry
19411 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
19412 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
19413 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
19414 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
19415 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
19416 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
19417 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
19418 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
19419 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
19420 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
19421 ; GFX10-WGP-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
19422 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
19423 ; GFX10-WGP-NEXT: buffer_gl1_inv
19424 ; GFX10-WGP-NEXT: buffer_gl0_inv
19425 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
19426 ; GFX10-WGP-NEXT: s_endpgm
19428 ; GFX10-CU-LABEL: global_system_one_as_acquire_acquire_ret_cmpxchg:
19429 ; GFX10-CU: ; %bb.0: ; %entry
19430 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
19431 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
19432 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
19433 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
19434 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
19435 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
19436 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
19437 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
19438 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
19439 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
19440 ; GFX10-CU-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
19441 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
19442 ; GFX10-CU-NEXT: buffer_gl1_inv
19443 ; GFX10-CU-NEXT: buffer_gl0_inv
19444 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
19445 ; GFX10-CU-NEXT: s_endpgm
19447 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acquire_acquire_ret_cmpxchg:
19448 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
19449 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
19450 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
19451 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
19452 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
19453 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
19454 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
19455 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
19456 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
19457 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
19458 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
19459 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
19460 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
19461 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
19462 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
19463 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
19464 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
19465 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16 glc
19466 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
19467 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
19468 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
19469 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
19470 ; SKIP-CACHE-INV-NEXT: s_endpgm
19472 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acquire_acquire_ret_cmpxchg:
19473 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
19474 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
19475 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
19476 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
19477 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
19478 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
19479 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
19480 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
19481 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
19482 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
19483 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
19484 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
19485 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
19486 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
19487 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
19488 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
19489 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
19491 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acquire_acquire_ret_cmpxchg:
19492 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
19493 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
19494 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
19495 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
19496 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
19497 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
19498 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
19499 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
19500 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
19501 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
19502 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
19503 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
19504 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
19505 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
19506 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
19507 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
19508 ; GFX90A-TGSPLIT-NEXT: s_endpgm
19510 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acquire_acquire_ret_cmpxchg:
19511 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
19512 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
19513 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
19514 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
19515 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
19516 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
19517 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
19518 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
19519 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
19520 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
19521 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
19522 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
19523 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
19524 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
19525 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
19526 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
19528 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acquire_acquire_ret_cmpxchg:
19529 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
19530 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
19531 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
19532 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
19533 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
19534 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
19535 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
19536 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
19537 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
19538 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
19539 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
19540 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
19541 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
19542 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
19543 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
19544 ; GFX940-TGSPLIT-NEXT: s_endpgm
19546 ; GFX11-WGP-LABEL: global_system_one_as_acquire_acquire_ret_cmpxchg:
19547 ; GFX11-WGP: ; %bb.0: ; %entry
19548 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
19549 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
19550 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
19551 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
19552 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
19553 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
19554 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
19555 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
19556 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
19557 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
19558 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
19559 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
19560 ; GFX11-WGP-NEXT: buffer_gl1_inv
19561 ; GFX11-WGP-NEXT: buffer_gl0_inv
19562 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
19563 ; GFX11-WGP-NEXT: s_endpgm
19565 ; GFX11-CU-LABEL: global_system_one_as_acquire_acquire_ret_cmpxchg:
19566 ; GFX11-CU: ; %bb.0: ; %entry
19567 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
19568 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
19569 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
19570 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
19571 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
19572 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
19573 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
19574 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
19575 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
19576 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
19577 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
19578 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
19579 ; GFX11-CU-NEXT: buffer_gl1_inv
19580 ; GFX11-CU-NEXT: buffer_gl0_inv
19581 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
19582 ; GFX11-CU-NEXT: s_endpgm
19584 ; GFX12-WGP-LABEL: global_system_one_as_acquire_acquire_ret_cmpxchg:
19585 ; GFX12-WGP: ; %bb.0: ; %entry
19586 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
19587 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
19588 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
19589 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
19590 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
19591 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
19592 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
19593 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
19594 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
19595 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
19596 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
19597 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
19598 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
19599 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
19600 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
19601 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
19602 ; GFX12-WGP-NEXT: s_endpgm
19604 ; GFX12-CU-LABEL: global_system_one_as_acquire_acquire_ret_cmpxchg:
19605 ; GFX12-CU: ; %bb.0: ; %entry
19606 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
19607 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
19608 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
19609 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
19610 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
19611 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
19612 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
19613 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
19614 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
19615 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
19616 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
19617 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
19618 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
19619 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
19620 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
19621 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
19622 ; GFX12-CU-NEXT: s_endpgm
19623 ptr addrspace(1) %out, i32 %in, i32 %old) {
19625 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
19626 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") acquire acquire
19627 %val0 = extractvalue { i32, i1 } %val, 0
19628 store i32 %val0, ptr addrspace(1) %out, align 4
19632 define amdgpu_kernel void @global_system_one_as_release_acquire_ret_cmpxchg(
19633 ; GFX6-LABEL: global_system_one_as_release_acquire_ret_cmpxchg:
19634 ; GFX6: ; %bb.0: ; %entry
19635 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
19636 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
19637 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
19638 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
19639 ; GFX6-NEXT: s_mov_b32 s12, s5
19640 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
19641 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
19642 ; GFX6-NEXT: s_mov_b32 s11, -1
19643 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
19644 ; GFX6-NEXT: s_mov_b32 s5, s12
19645 ; GFX6-NEXT: s_mov_b32 s6, s11
19646 ; GFX6-NEXT: s_mov_b32 s7, s10
19647 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
19648 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
19649 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
19650 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
19651 ; GFX6-NEXT: s_waitcnt vmcnt(0)
19652 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
19653 ; GFX6-NEXT: s_waitcnt vmcnt(0)
19654 ; GFX6-NEXT: buffer_wbinvl1
19655 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
19656 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
19657 ; GFX6-NEXT: s_endpgm
19659 ; GFX7-LABEL: global_system_one_as_release_acquire_ret_cmpxchg:
19660 ; GFX7: ; %bb.0: ; %entry
19661 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
19662 ; GFX7-NEXT: s_load_dword s9, s[6:7], 0x2
19663 ; GFX7-NEXT: s_load_dword s8, s[6:7], 0x3
19664 ; GFX7-NEXT: s_mov_b64 s[12:13], 16
19665 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
19666 ; GFX7-NEXT: s_mov_b32 s6, s4
19667 ; GFX7-NEXT: s_mov_b32 s7, s5
19668 ; GFX7-NEXT: s_mov_b32 s11, s12
19669 ; GFX7-NEXT: s_mov_b32 s10, s13
19670 ; GFX7-NEXT: s_add_u32 s6, s6, s11
19671 ; GFX7-NEXT: s_addc_u32 s10, s7, s10
19672 ; GFX7-NEXT: ; kill: def $sgpr6 killed $sgpr6 def $sgpr6_sgpr7
19673 ; GFX7-NEXT: s_mov_b32 s7, s10
19674 ; GFX7-NEXT: v_mov_b32_e32 v2, s9
19675 ; GFX7-NEXT: v_mov_b32_e32 v0, s8
19676 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
19677 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
19678 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
19679 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
19680 ; GFX7-NEXT: s_waitcnt vmcnt(0)
19681 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
19682 ; GFX7-NEXT: s_waitcnt vmcnt(0)
19683 ; GFX7-NEXT: buffer_wbinvl1_vol
19684 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
19685 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
19686 ; GFX7-NEXT: flat_store_dword v[0:1], v2
19687 ; GFX7-NEXT: s_endpgm
19689 ; GFX10-WGP-LABEL: global_system_one_as_release_acquire_ret_cmpxchg:
19690 ; GFX10-WGP: ; %bb.0: ; %entry
19691 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
19692 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
19693 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
19694 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
19695 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
19696 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
19697 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
19698 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
19699 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
19700 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
19701 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
19702 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
19703 ; GFX10-WGP-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
19704 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
19705 ; GFX10-WGP-NEXT: buffer_gl1_inv
19706 ; GFX10-WGP-NEXT: buffer_gl0_inv
19707 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
19708 ; GFX10-WGP-NEXT: s_endpgm
19710 ; GFX10-CU-LABEL: global_system_one_as_release_acquire_ret_cmpxchg:
19711 ; GFX10-CU: ; %bb.0: ; %entry
19712 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
19713 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
19714 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
19715 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
19716 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
19717 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
19718 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
19719 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
19720 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
19721 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
19722 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
19723 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
19724 ; GFX10-CU-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
19725 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
19726 ; GFX10-CU-NEXT: buffer_gl1_inv
19727 ; GFX10-CU-NEXT: buffer_gl0_inv
19728 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
19729 ; GFX10-CU-NEXT: s_endpgm
19731 ; SKIP-CACHE-INV-LABEL: global_system_one_as_release_acquire_ret_cmpxchg:
19732 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
19733 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
19734 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
19735 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
19736 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
19737 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
19738 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
19739 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
19740 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
19741 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
19742 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
19743 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
19744 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
19745 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
19746 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
19747 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
19748 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
19749 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
19750 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16 glc
19751 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
19752 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
19753 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
19754 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
19755 ; SKIP-CACHE-INV-NEXT: s_endpgm
19757 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_release_acquire_ret_cmpxchg:
19758 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
19759 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
19760 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
19761 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
19762 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
19763 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
19764 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
19765 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
19766 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
19767 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
19768 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
19769 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
19770 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
19771 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
19772 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
19773 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
19774 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
19775 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
19776 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
19778 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_release_acquire_ret_cmpxchg:
19779 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
19780 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
19781 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
19782 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
19783 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
19784 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
19785 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
19786 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
19787 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
19788 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
19789 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
19790 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
19791 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
19792 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
19793 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
19794 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
19795 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
19796 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
19797 ; GFX90A-TGSPLIT-NEXT: s_endpgm
19799 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_release_acquire_ret_cmpxchg:
19800 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
19801 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
19802 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
19803 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
19804 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
19805 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
19806 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
19807 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
19808 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
19809 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
19810 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
19811 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
19812 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
19813 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
19814 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
19815 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
19816 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
19817 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
19819 ; GFX940-TGSPLIT-LABEL: global_system_one_as_release_acquire_ret_cmpxchg:
19820 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
19821 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
19822 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
19823 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
19824 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
19825 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
19826 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
19827 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
19828 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
19829 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
19830 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
19831 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
19832 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
19833 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
19834 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
19835 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
19836 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
19837 ; GFX940-TGSPLIT-NEXT: s_endpgm
19839 ; GFX11-WGP-LABEL: global_system_one_as_release_acquire_ret_cmpxchg:
19840 ; GFX11-WGP: ; %bb.0: ; %entry
19841 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
19842 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
19843 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
19844 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
19845 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
19846 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
19847 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
19848 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
19849 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
19850 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
19851 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
19852 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
19853 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
19854 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
19855 ; GFX11-WGP-NEXT: buffer_gl1_inv
19856 ; GFX11-WGP-NEXT: buffer_gl0_inv
19857 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
19858 ; GFX11-WGP-NEXT: s_endpgm
19860 ; GFX11-CU-LABEL: global_system_one_as_release_acquire_ret_cmpxchg:
19861 ; GFX11-CU: ; %bb.0: ; %entry
19862 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
19863 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
19864 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
19865 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
19866 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
19867 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
19868 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
19869 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
19870 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
19871 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
19872 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
19873 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
19874 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
19875 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
19876 ; GFX11-CU-NEXT: buffer_gl1_inv
19877 ; GFX11-CU-NEXT: buffer_gl0_inv
19878 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
19879 ; GFX11-CU-NEXT: s_endpgm
19881 ; GFX12-WGP-LABEL: global_system_one_as_release_acquire_ret_cmpxchg:
19882 ; GFX12-WGP: ; %bb.0: ; %entry
19883 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
19884 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
19885 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
19886 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
19887 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
19888 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
19889 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
19890 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
19891 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
19892 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
19893 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
19894 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
19895 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
19896 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
19897 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
19898 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
19899 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
19900 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
19901 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
19902 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
19903 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
19904 ; GFX12-WGP-NEXT: s_endpgm
19906 ; GFX12-CU-LABEL: global_system_one_as_release_acquire_ret_cmpxchg:
19907 ; GFX12-CU: ; %bb.0: ; %entry
19908 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
19909 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
19910 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
19911 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
19912 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
19913 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
19914 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
19915 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
19916 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
19917 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
19918 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
19919 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
19920 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
19921 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
19922 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
19923 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
19924 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
19925 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
19926 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
19927 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
19928 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
19929 ; GFX12-CU-NEXT: s_endpgm
19930 ptr addrspace(1) %out, i32 %in, i32 %old) {
19932 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
19933 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") release acquire
19934 %val0 = extractvalue { i32, i1 } %val, 0
19935 store i32 %val0, ptr addrspace(1) %out, align 4
19939 define amdgpu_kernel void @global_system_one_as_acq_rel_acquire_ret_cmpxchg(
19940 ; GFX6-LABEL: global_system_one_as_acq_rel_acquire_ret_cmpxchg:
19941 ; GFX6: ; %bb.0: ; %entry
19942 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
19943 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
19944 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
19945 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
19946 ; GFX6-NEXT: s_mov_b32 s12, s5
19947 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
19948 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
19949 ; GFX6-NEXT: s_mov_b32 s11, -1
19950 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
19951 ; GFX6-NEXT: s_mov_b32 s5, s12
19952 ; GFX6-NEXT: s_mov_b32 s6, s11
19953 ; GFX6-NEXT: s_mov_b32 s7, s10
19954 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
19955 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
19956 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
19957 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
19958 ; GFX6-NEXT: s_waitcnt vmcnt(0)
19959 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
19960 ; GFX6-NEXT: s_waitcnt vmcnt(0)
19961 ; GFX6-NEXT: buffer_wbinvl1
19962 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
19963 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
19964 ; GFX6-NEXT: s_endpgm
19966 ; GFX7-LABEL: global_system_one_as_acq_rel_acquire_ret_cmpxchg:
19967 ; GFX7: ; %bb.0: ; %entry
19968 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
19969 ; GFX7-NEXT: s_load_dword s9, s[6:7], 0x2
19970 ; GFX7-NEXT: s_load_dword s8, s[6:7], 0x3
19971 ; GFX7-NEXT: s_mov_b64 s[12:13], 16
19972 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
19973 ; GFX7-NEXT: s_mov_b32 s6, s4
19974 ; GFX7-NEXT: s_mov_b32 s7, s5
19975 ; GFX7-NEXT: s_mov_b32 s11, s12
19976 ; GFX7-NEXT: s_mov_b32 s10, s13
19977 ; GFX7-NEXT: s_add_u32 s6, s6, s11
19978 ; GFX7-NEXT: s_addc_u32 s10, s7, s10
19979 ; GFX7-NEXT: ; kill: def $sgpr6 killed $sgpr6 def $sgpr6_sgpr7
19980 ; GFX7-NEXT: s_mov_b32 s7, s10
19981 ; GFX7-NEXT: v_mov_b32_e32 v2, s9
19982 ; GFX7-NEXT: v_mov_b32_e32 v0, s8
19983 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
19984 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
19985 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
19986 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
19987 ; GFX7-NEXT: s_waitcnt vmcnt(0)
19988 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
19989 ; GFX7-NEXT: s_waitcnt vmcnt(0)
19990 ; GFX7-NEXT: buffer_wbinvl1_vol
19991 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
19992 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
19993 ; GFX7-NEXT: flat_store_dword v[0:1], v2
19994 ; GFX7-NEXT: s_endpgm
19996 ; GFX10-WGP-LABEL: global_system_one_as_acq_rel_acquire_ret_cmpxchg:
19997 ; GFX10-WGP: ; %bb.0: ; %entry
19998 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
19999 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
20000 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
20001 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
20002 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
20003 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
20004 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
20005 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
20006 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
20007 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
20008 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
20009 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
20010 ; GFX10-WGP-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
20011 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
20012 ; GFX10-WGP-NEXT: buffer_gl1_inv
20013 ; GFX10-WGP-NEXT: buffer_gl0_inv
20014 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
20015 ; GFX10-WGP-NEXT: s_endpgm
20017 ; GFX10-CU-LABEL: global_system_one_as_acq_rel_acquire_ret_cmpxchg:
20018 ; GFX10-CU: ; %bb.0: ; %entry
20019 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
20020 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
20021 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
20022 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
20023 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
20024 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
20025 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
20026 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
20027 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
20028 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
20029 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
20030 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
20031 ; GFX10-CU-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
20032 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
20033 ; GFX10-CU-NEXT: buffer_gl1_inv
20034 ; GFX10-CU-NEXT: buffer_gl0_inv
20035 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
20036 ; GFX10-CU-NEXT: s_endpgm
20038 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acq_rel_acquire_ret_cmpxchg:
20039 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
20040 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
20041 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
20042 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
20043 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
20044 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
20045 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
20046 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
20047 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
20048 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
20049 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
20050 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
20051 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
20052 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
20053 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
20054 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
20055 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
20056 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
20057 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16 glc
20058 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
20059 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
20060 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
20061 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
20062 ; SKIP-CACHE-INV-NEXT: s_endpgm
20064 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_acquire_ret_cmpxchg:
20065 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
20066 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
20067 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
20068 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
20069 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
20070 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
20071 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
20072 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
20073 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
20074 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
20075 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
20076 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
20077 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
20078 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
20079 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
20080 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
20081 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
20082 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
20083 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
20085 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acq_rel_acquire_ret_cmpxchg:
20086 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
20087 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
20088 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
20089 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
20090 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
20091 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
20092 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
20093 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
20094 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
20095 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
20096 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
20097 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
20098 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
20099 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
20100 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
20101 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
20102 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
20103 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
20104 ; GFX90A-TGSPLIT-NEXT: s_endpgm
20106 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_acquire_ret_cmpxchg:
20107 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
20108 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
20109 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
20110 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
20111 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
20112 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
20113 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
20114 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
20115 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
20116 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
20117 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
20118 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
20119 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
20120 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
20121 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
20122 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
20123 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
20124 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
20126 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acq_rel_acquire_ret_cmpxchg:
20127 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
20128 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
20129 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
20130 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
20131 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
20132 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
20133 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
20134 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
20135 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
20136 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
20137 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
20138 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
20139 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
20140 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
20141 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
20142 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
20143 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
20144 ; GFX940-TGSPLIT-NEXT: s_endpgm
20146 ; GFX11-WGP-LABEL: global_system_one_as_acq_rel_acquire_ret_cmpxchg:
20147 ; GFX11-WGP: ; %bb.0: ; %entry
20148 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
20149 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
20150 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
20151 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
20152 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
20153 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
20154 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
20155 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
20156 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
20157 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
20158 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
20159 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
20160 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
20161 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
20162 ; GFX11-WGP-NEXT: buffer_gl1_inv
20163 ; GFX11-WGP-NEXT: buffer_gl0_inv
20164 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
20165 ; GFX11-WGP-NEXT: s_endpgm
20167 ; GFX11-CU-LABEL: global_system_one_as_acq_rel_acquire_ret_cmpxchg:
20168 ; GFX11-CU: ; %bb.0: ; %entry
20169 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
20170 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
20171 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
20172 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
20173 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
20174 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
20175 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
20176 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
20177 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
20178 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
20179 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
20180 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
20181 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
20182 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
20183 ; GFX11-CU-NEXT: buffer_gl1_inv
20184 ; GFX11-CU-NEXT: buffer_gl0_inv
20185 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
20186 ; GFX11-CU-NEXT: s_endpgm
20188 ; GFX12-WGP-LABEL: global_system_one_as_acq_rel_acquire_ret_cmpxchg:
20189 ; GFX12-WGP: ; %bb.0: ; %entry
20190 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
20191 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
20192 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
20193 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
20194 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
20195 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
20196 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
20197 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
20198 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
20199 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
20200 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
20201 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
20202 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
20203 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
20204 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
20205 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
20206 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
20207 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
20208 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
20209 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
20210 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
20211 ; GFX12-WGP-NEXT: s_endpgm
20213 ; GFX12-CU-LABEL: global_system_one_as_acq_rel_acquire_ret_cmpxchg:
20214 ; GFX12-CU: ; %bb.0: ; %entry
20215 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
20216 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
20217 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
20218 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
20219 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
20220 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
20221 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
20222 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
20223 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
20224 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
20225 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
20226 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
20227 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
20228 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
20229 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
20230 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
20231 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
20232 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
20233 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
20234 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
20235 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
20236 ; GFX12-CU-NEXT: s_endpgm
20237 ptr addrspace(1) %out, i32 %in, i32 %old) {
20239 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
20240 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") acq_rel acquire
20241 %val0 = extractvalue { i32, i1 } %val, 0
20242 store i32 %val0, ptr addrspace(1) %out, align 4
20246 define amdgpu_kernel void @global_system_one_as_seq_cst_acquire_ret_cmpxchg(
20247 ; GFX6-LABEL: global_system_one_as_seq_cst_acquire_ret_cmpxchg:
20248 ; GFX6: ; %bb.0: ; %entry
20249 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
20250 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
20251 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
20252 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
20253 ; GFX6-NEXT: s_mov_b32 s12, s5
20254 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
20255 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
20256 ; GFX6-NEXT: s_mov_b32 s11, -1
20257 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
20258 ; GFX6-NEXT: s_mov_b32 s5, s12
20259 ; GFX6-NEXT: s_mov_b32 s6, s11
20260 ; GFX6-NEXT: s_mov_b32 s7, s10
20261 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
20262 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
20263 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
20264 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
20265 ; GFX6-NEXT: s_waitcnt vmcnt(0)
20266 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
20267 ; GFX6-NEXT: s_waitcnt vmcnt(0)
20268 ; GFX6-NEXT: buffer_wbinvl1
20269 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
20270 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
20271 ; GFX6-NEXT: s_endpgm
20273 ; GFX7-LABEL: global_system_one_as_seq_cst_acquire_ret_cmpxchg:
20274 ; GFX7: ; %bb.0: ; %entry
20275 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
20276 ; GFX7-NEXT: s_load_dword s9, s[6:7], 0x2
20277 ; GFX7-NEXT: s_load_dword s8, s[6:7], 0x3
20278 ; GFX7-NEXT: s_mov_b64 s[12:13], 16
20279 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
20280 ; GFX7-NEXT: s_mov_b32 s6, s4
20281 ; GFX7-NEXT: s_mov_b32 s7, s5
20282 ; GFX7-NEXT: s_mov_b32 s11, s12
20283 ; GFX7-NEXT: s_mov_b32 s10, s13
20284 ; GFX7-NEXT: s_add_u32 s6, s6, s11
20285 ; GFX7-NEXT: s_addc_u32 s10, s7, s10
20286 ; GFX7-NEXT: ; kill: def $sgpr6 killed $sgpr6 def $sgpr6_sgpr7
20287 ; GFX7-NEXT: s_mov_b32 s7, s10
20288 ; GFX7-NEXT: v_mov_b32_e32 v2, s9
20289 ; GFX7-NEXT: v_mov_b32_e32 v0, s8
20290 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
20291 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
20292 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
20293 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
20294 ; GFX7-NEXT: s_waitcnt vmcnt(0)
20295 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
20296 ; GFX7-NEXT: s_waitcnt vmcnt(0)
20297 ; GFX7-NEXT: buffer_wbinvl1_vol
20298 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
20299 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
20300 ; GFX7-NEXT: flat_store_dword v[0:1], v2
20301 ; GFX7-NEXT: s_endpgm
20303 ; GFX10-WGP-LABEL: global_system_one_as_seq_cst_acquire_ret_cmpxchg:
20304 ; GFX10-WGP: ; %bb.0: ; %entry
20305 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
20306 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
20307 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
20308 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
20309 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
20310 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
20311 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
20312 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
20313 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
20314 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
20315 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
20316 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
20317 ; GFX10-WGP-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
20318 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
20319 ; GFX10-WGP-NEXT: buffer_gl1_inv
20320 ; GFX10-WGP-NEXT: buffer_gl0_inv
20321 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
20322 ; GFX10-WGP-NEXT: s_endpgm
20324 ; GFX10-CU-LABEL: global_system_one_as_seq_cst_acquire_ret_cmpxchg:
20325 ; GFX10-CU: ; %bb.0: ; %entry
20326 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
20327 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
20328 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
20329 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
20330 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
20331 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
20332 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
20333 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
20334 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
20335 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
20336 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
20337 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
20338 ; GFX10-CU-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
20339 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
20340 ; GFX10-CU-NEXT: buffer_gl1_inv
20341 ; GFX10-CU-NEXT: buffer_gl0_inv
20342 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
20343 ; GFX10-CU-NEXT: s_endpgm
20345 ; SKIP-CACHE-INV-LABEL: global_system_one_as_seq_cst_acquire_ret_cmpxchg:
20346 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
20347 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
20348 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
20349 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
20350 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
20351 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
20352 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
20353 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
20354 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
20355 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
20356 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
20357 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
20358 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
20359 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
20360 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
20361 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
20362 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
20363 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
20364 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16 glc
20365 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
20366 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
20367 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
20368 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
20369 ; SKIP-CACHE-INV-NEXT: s_endpgm
20371 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_acquire_ret_cmpxchg:
20372 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
20373 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
20374 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
20375 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
20376 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
20377 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
20378 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
20379 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
20380 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
20381 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
20382 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
20383 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
20384 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
20385 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
20386 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
20387 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
20388 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
20389 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
20390 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
20392 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_seq_cst_acquire_ret_cmpxchg:
20393 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
20394 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
20395 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
20396 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
20397 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
20398 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
20399 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
20400 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
20401 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
20402 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
20403 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
20404 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
20405 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
20406 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
20407 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
20408 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
20409 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
20410 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
20411 ; GFX90A-TGSPLIT-NEXT: s_endpgm
20413 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_acquire_ret_cmpxchg:
20414 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
20415 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
20416 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
20417 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
20418 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
20419 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
20420 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
20421 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
20422 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
20423 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
20424 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
20425 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
20426 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
20427 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
20428 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
20429 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
20430 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
20431 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
20433 ; GFX940-TGSPLIT-LABEL: global_system_one_as_seq_cst_acquire_ret_cmpxchg:
20434 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
20435 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
20436 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
20437 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
20438 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
20439 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
20440 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
20441 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
20442 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
20443 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
20444 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
20445 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
20446 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
20447 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
20448 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
20449 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
20450 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
20451 ; GFX940-TGSPLIT-NEXT: s_endpgm
20453 ; GFX11-WGP-LABEL: global_system_one_as_seq_cst_acquire_ret_cmpxchg:
20454 ; GFX11-WGP: ; %bb.0: ; %entry
20455 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
20456 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
20457 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
20458 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
20459 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
20460 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
20461 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
20462 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
20463 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
20464 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
20465 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
20466 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
20467 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
20468 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
20469 ; GFX11-WGP-NEXT: buffer_gl1_inv
20470 ; GFX11-WGP-NEXT: buffer_gl0_inv
20471 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
20472 ; GFX11-WGP-NEXT: s_endpgm
20474 ; GFX11-CU-LABEL: global_system_one_as_seq_cst_acquire_ret_cmpxchg:
20475 ; GFX11-CU: ; %bb.0: ; %entry
20476 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
20477 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
20478 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
20479 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
20480 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
20481 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
20482 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
20483 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
20484 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
20485 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
20486 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
20487 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
20488 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
20489 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
20490 ; GFX11-CU-NEXT: buffer_gl1_inv
20491 ; GFX11-CU-NEXT: buffer_gl0_inv
20492 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
20493 ; GFX11-CU-NEXT: s_endpgm
20495 ; GFX12-WGP-LABEL: global_system_one_as_seq_cst_acquire_ret_cmpxchg:
20496 ; GFX12-WGP: ; %bb.0: ; %entry
20497 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
20498 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
20499 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
20500 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
20501 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
20502 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
20503 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
20504 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
20505 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
20506 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
20507 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
20508 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
20509 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
20510 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
20511 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
20512 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
20513 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
20514 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
20515 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
20516 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
20517 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
20518 ; GFX12-WGP-NEXT: s_endpgm
20520 ; GFX12-CU-LABEL: global_system_one_as_seq_cst_acquire_ret_cmpxchg:
20521 ; GFX12-CU: ; %bb.0: ; %entry
20522 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
20523 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
20524 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
20525 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
20526 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
20527 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
20528 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
20529 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
20530 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
20531 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
20532 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
20533 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
20534 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
20535 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
20536 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
20537 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
20538 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
20539 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
20540 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
20541 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
20542 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
20543 ; GFX12-CU-NEXT: s_endpgm
20544 ptr addrspace(1) %out, i32 %in, i32 %old) {
20546 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
20547 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") seq_cst acquire
20548 %val0 = extractvalue { i32, i1 } %val, 0
20549 store i32 %val0, ptr addrspace(1) %out, align 4
20553 define amdgpu_kernel void @global_system_one_as_monotonic_seq_cst_ret_cmpxchg(
20554 ; GFX6-LABEL: global_system_one_as_monotonic_seq_cst_ret_cmpxchg:
20555 ; GFX6: ; %bb.0: ; %entry
20556 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
20557 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
20558 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
20559 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
20560 ; GFX6-NEXT: s_mov_b32 s12, s5
20561 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
20562 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
20563 ; GFX6-NEXT: s_mov_b32 s11, -1
20564 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
20565 ; GFX6-NEXT: s_mov_b32 s5, s12
20566 ; GFX6-NEXT: s_mov_b32 s6, s11
20567 ; GFX6-NEXT: s_mov_b32 s7, s10
20568 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
20569 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
20570 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
20571 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
20572 ; GFX6-NEXT: s_waitcnt vmcnt(0)
20573 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
20574 ; GFX6-NEXT: s_waitcnt vmcnt(0)
20575 ; GFX6-NEXT: buffer_wbinvl1
20576 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
20577 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
20578 ; GFX6-NEXT: s_endpgm
20580 ; GFX7-LABEL: global_system_one_as_monotonic_seq_cst_ret_cmpxchg:
20581 ; GFX7: ; %bb.0: ; %entry
20582 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
20583 ; GFX7-NEXT: s_load_dword s9, s[6:7], 0x2
20584 ; GFX7-NEXT: s_load_dword s8, s[6:7], 0x3
20585 ; GFX7-NEXT: s_mov_b64 s[12:13], 16
20586 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
20587 ; GFX7-NEXT: s_mov_b32 s6, s4
20588 ; GFX7-NEXT: s_mov_b32 s7, s5
20589 ; GFX7-NEXT: s_mov_b32 s11, s12
20590 ; GFX7-NEXT: s_mov_b32 s10, s13
20591 ; GFX7-NEXT: s_add_u32 s6, s6, s11
20592 ; GFX7-NEXT: s_addc_u32 s10, s7, s10
20593 ; GFX7-NEXT: ; kill: def $sgpr6 killed $sgpr6 def $sgpr6_sgpr7
20594 ; GFX7-NEXT: s_mov_b32 s7, s10
20595 ; GFX7-NEXT: v_mov_b32_e32 v2, s9
20596 ; GFX7-NEXT: v_mov_b32_e32 v0, s8
20597 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
20598 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
20599 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
20600 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
20601 ; GFX7-NEXT: s_waitcnt vmcnt(0)
20602 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
20603 ; GFX7-NEXT: s_waitcnt vmcnt(0)
20604 ; GFX7-NEXT: buffer_wbinvl1_vol
20605 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
20606 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
20607 ; GFX7-NEXT: flat_store_dword v[0:1], v2
20608 ; GFX7-NEXT: s_endpgm
20610 ; GFX10-WGP-LABEL: global_system_one_as_monotonic_seq_cst_ret_cmpxchg:
20611 ; GFX10-WGP: ; %bb.0: ; %entry
20612 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
20613 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
20614 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
20615 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
20616 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
20617 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
20618 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
20619 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
20620 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
20621 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
20622 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
20623 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
20624 ; GFX10-WGP-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
20625 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
20626 ; GFX10-WGP-NEXT: buffer_gl1_inv
20627 ; GFX10-WGP-NEXT: buffer_gl0_inv
20628 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
20629 ; GFX10-WGP-NEXT: s_endpgm
20631 ; GFX10-CU-LABEL: global_system_one_as_monotonic_seq_cst_ret_cmpxchg:
20632 ; GFX10-CU: ; %bb.0: ; %entry
20633 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
20634 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
20635 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
20636 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
20637 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
20638 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
20639 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
20640 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
20641 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
20642 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
20643 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
20644 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
20645 ; GFX10-CU-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
20646 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
20647 ; GFX10-CU-NEXT: buffer_gl1_inv
20648 ; GFX10-CU-NEXT: buffer_gl0_inv
20649 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
20650 ; GFX10-CU-NEXT: s_endpgm
20652 ; SKIP-CACHE-INV-LABEL: global_system_one_as_monotonic_seq_cst_ret_cmpxchg:
20653 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
20654 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
20655 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
20656 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
20657 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
20658 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
20659 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
20660 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
20661 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
20662 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
20663 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
20664 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
20665 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
20666 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
20667 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
20668 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
20669 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
20670 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
20671 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16 glc
20672 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
20673 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
20674 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
20675 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
20676 ; SKIP-CACHE-INV-NEXT: s_endpgm
20678 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_seq_cst_ret_cmpxchg:
20679 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
20680 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
20681 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
20682 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
20683 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
20684 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
20685 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
20686 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
20687 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
20688 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
20689 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
20690 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
20691 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
20692 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
20693 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
20694 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
20695 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
20696 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
20697 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
20699 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_monotonic_seq_cst_ret_cmpxchg:
20700 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
20701 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
20702 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
20703 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
20704 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
20705 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
20706 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
20707 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
20708 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
20709 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
20710 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
20711 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
20712 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
20713 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
20714 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
20715 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
20716 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
20717 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
20718 ; GFX90A-TGSPLIT-NEXT: s_endpgm
20720 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_seq_cst_ret_cmpxchg:
20721 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
20722 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
20723 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
20724 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
20725 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
20726 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
20727 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
20728 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
20729 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
20730 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
20731 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
20732 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
20733 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
20734 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
20735 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
20736 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
20737 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
20738 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
20740 ; GFX940-TGSPLIT-LABEL: global_system_one_as_monotonic_seq_cst_ret_cmpxchg:
20741 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
20742 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
20743 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
20744 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
20745 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
20746 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
20747 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
20748 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
20749 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
20750 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
20751 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
20752 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
20753 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
20754 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
20755 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
20756 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
20757 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
20758 ; GFX940-TGSPLIT-NEXT: s_endpgm
20760 ; GFX11-WGP-LABEL: global_system_one_as_monotonic_seq_cst_ret_cmpxchg:
20761 ; GFX11-WGP: ; %bb.0: ; %entry
20762 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
20763 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
20764 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
20765 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
20766 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
20767 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
20768 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
20769 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
20770 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
20771 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
20772 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
20773 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
20774 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
20775 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
20776 ; GFX11-WGP-NEXT: buffer_gl1_inv
20777 ; GFX11-WGP-NEXT: buffer_gl0_inv
20778 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
20779 ; GFX11-WGP-NEXT: s_endpgm
20781 ; GFX11-CU-LABEL: global_system_one_as_monotonic_seq_cst_ret_cmpxchg:
20782 ; GFX11-CU: ; %bb.0: ; %entry
20783 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
20784 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
20785 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
20786 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
20787 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
20788 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
20789 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
20790 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
20791 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
20792 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
20793 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
20794 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
20795 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
20796 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
20797 ; GFX11-CU-NEXT: buffer_gl1_inv
20798 ; GFX11-CU-NEXT: buffer_gl0_inv
20799 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
20800 ; GFX11-CU-NEXT: s_endpgm
20802 ; GFX12-WGP-LABEL: global_system_one_as_monotonic_seq_cst_ret_cmpxchg:
20803 ; GFX12-WGP: ; %bb.0: ; %entry
20804 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
20805 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
20806 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
20807 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
20808 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
20809 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
20810 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
20811 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
20812 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
20813 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
20814 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
20815 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
20816 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
20817 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
20818 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
20819 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
20820 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
20821 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
20822 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
20823 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
20824 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
20825 ; GFX12-WGP-NEXT: s_endpgm
20827 ; GFX12-CU-LABEL: global_system_one_as_monotonic_seq_cst_ret_cmpxchg:
20828 ; GFX12-CU: ; %bb.0: ; %entry
20829 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
20830 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
20831 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
20832 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
20833 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
20834 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
20835 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
20836 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
20837 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
20838 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
20839 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
20840 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
20841 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
20842 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
20843 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
20844 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
20845 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
20846 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
20847 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
20848 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
20849 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
20850 ; GFX12-CU-NEXT: s_endpgm
20851 ptr addrspace(1) %out, i32 %in, i32 %old) {
20853 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
20854 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") monotonic seq_cst
20855 %val0 = extractvalue { i32, i1 } %val, 0
20856 store i32 %val0, ptr addrspace(1) %out, align 4
20860 define amdgpu_kernel void @global_system_one_as_acquire_seq_cst_ret_cmpxchg(
20861 ; GFX6-LABEL: global_system_one_as_acquire_seq_cst_ret_cmpxchg:
20862 ; GFX6: ; %bb.0: ; %entry
20863 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
20864 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
20865 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
20866 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
20867 ; GFX6-NEXT: s_mov_b32 s12, s5
20868 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
20869 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
20870 ; GFX6-NEXT: s_mov_b32 s11, -1
20871 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
20872 ; GFX6-NEXT: s_mov_b32 s5, s12
20873 ; GFX6-NEXT: s_mov_b32 s6, s11
20874 ; GFX6-NEXT: s_mov_b32 s7, s10
20875 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
20876 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
20877 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
20878 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
20879 ; GFX6-NEXT: s_waitcnt vmcnt(0)
20880 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
20881 ; GFX6-NEXT: s_waitcnt vmcnt(0)
20882 ; GFX6-NEXT: buffer_wbinvl1
20883 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
20884 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
20885 ; GFX6-NEXT: s_endpgm
20887 ; GFX7-LABEL: global_system_one_as_acquire_seq_cst_ret_cmpxchg:
20888 ; GFX7: ; %bb.0: ; %entry
20889 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
20890 ; GFX7-NEXT: s_load_dword s9, s[6:7], 0x2
20891 ; GFX7-NEXT: s_load_dword s8, s[6:7], 0x3
20892 ; GFX7-NEXT: s_mov_b64 s[12:13], 16
20893 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
20894 ; GFX7-NEXT: s_mov_b32 s6, s4
20895 ; GFX7-NEXT: s_mov_b32 s7, s5
20896 ; GFX7-NEXT: s_mov_b32 s11, s12
20897 ; GFX7-NEXT: s_mov_b32 s10, s13
20898 ; GFX7-NEXT: s_add_u32 s6, s6, s11
20899 ; GFX7-NEXT: s_addc_u32 s10, s7, s10
20900 ; GFX7-NEXT: ; kill: def $sgpr6 killed $sgpr6 def $sgpr6_sgpr7
20901 ; GFX7-NEXT: s_mov_b32 s7, s10
20902 ; GFX7-NEXT: v_mov_b32_e32 v2, s9
20903 ; GFX7-NEXT: v_mov_b32_e32 v0, s8
20904 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
20905 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
20906 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
20907 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
20908 ; GFX7-NEXT: s_waitcnt vmcnt(0)
20909 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
20910 ; GFX7-NEXT: s_waitcnt vmcnt(0)
20911 ; GFX7-NEXT: buffer_wbinvl1_vol
20912 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
20913 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
20914 ; GFX7-NEXT: flat_store_dword v[0:1], v2
20915 ; GFX7-NEXT: s_endpgm
20917 ; GFX10-WGP-LABEL: global_system_one_as_acquire_seq_cst_ret_cmpxchg:
20918 ; GFX10-WGP: ; %bb.0: ; %entry
20919 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
20920 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
20921 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
20922 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
20923 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
20924 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
20925 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
20926 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
20927 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
20928 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
20929 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
20930 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
20931 ; GFX10-WGP-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
20932 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
20933 ; GFX10-WGP-NEXT: buffer_gl1_inv
20934 ; GFX10-WGP-NEXT: buffer_gl0_inv
20935 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
20936 ; GFX10-WGP-NEXT: s_endpgm
20938 ; GFX10-CU-LABEL: global_system_one_as_acquire_seq_cst_ret_cmpxchg:
20939 ; GFX10-CU: ; %bb.0: ; %entry
20940 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
20941 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
20942 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
20943 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
20944 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
20945 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
20946 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
20947 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
20948 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
20949 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
20950 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
20951 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
20952 ; GFX10-CU-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
20953 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
20954 ; GFX10-CU-NEXT: buffer_gl1_inv
20955 ; GFX10-CU-NEXT: buffer_gl0_inv
20956 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
20957 ; GFX10-CU-NEXT: s_endpgm
20959 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acquire_seq_cst_ret_cmpxchg:
20960 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
20961 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
20962 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
20963 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
20964 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
20965 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
20966 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
20967 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
20968 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
20969 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
20970 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
20971 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
20972 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
20973 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
20974 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
20975 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
20976 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
20977 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
20978 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16 glc
20979 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
20980 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
20981 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
20982 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
20983 ; SKIP-CACHE-INV-NEXT: s_endpgm
20985 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acquire_seq_cst_ret_cmpxchg:
20986 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
20987 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
20988 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
20989 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
20990 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
20991 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
20992 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
20993 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
20994 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
20995 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
20996 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
20997 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
20998 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
20999 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
21000 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
21001 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
21002 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
21003 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
21004 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
21006 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acquire_seq_cst_ret_cmpxchg:
21007 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
21008 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
21009 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
21010 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
21011 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
21012 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
21013 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
21014 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
21015 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
21016 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
21017 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
21018 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
21019 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
21020 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
21021 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
21022 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
21023 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
21024 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
21025 ; GFX90A-TGSPLIT-NEXT: s_endpgm
21027 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acquire_seq_cst_ret_cmpxchg:
21028 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
21029 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
21030 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
21031 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
21032 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
21033 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
21034 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
21035 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
21036 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
21037 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
21038 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
21039 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
21040 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
21041 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
21042 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
21043 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
21044 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
21045 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
21047 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acquire_seq_cst_ret_cmpxchg:
21048 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
21049 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
21050 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
21051 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
21052 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
21053 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
21054 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
21055 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
21056 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
21057 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
21058 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
21059 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
21060 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
21061 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
21062 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
21063 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
21064 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
21065 ; GFX940-TGSPLIT-NEXT: s_endpgm
21067 ; GFX11-WGP-LABEL: global_system_one_as_acquire_seq_cst_ret_cmpxchg:
21068 ; GFX11-WGP: ; %bb.0: ; %entry
21069 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
21070 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
21071 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
21072 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
21073 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
21074 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
21075 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
21076 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
21077 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
21078 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
21079 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
21080 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
21081 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
21082 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
21083 ; GFX11-WGP-NEXT: buffer_gl1_inv
21084 ; GFX11-WGP-NEXT: buffer_gl0_inv
21085 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
21086 ; GFX11-WGP-NEXT: s_endpgm
21088 ; GFX11-CU-LABEL: global_system_one_as_acquire_seq_cst_ret_cmpxchg:
21089 ; GFX11-CU: ; %bb.0: ; %entry
21090 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
21091 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
21092 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
21093 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
21094 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
21095 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
21096 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
21097 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
21098 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
21099 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
21100 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
21101 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
21102 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
21103 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
21104 ; GFX11-CU-NEXT: buffer_gl1_inv
21105 ; GFX11-CU-NEXT: buffer_gl0_inv
21106 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
21107 ; GFX11-CU-NEXT: s_endpgm
21109 ; GFX12-WGP-LABEL: global_system_one_as_acquire_seq_cst_ret_cmpxchg:
21110 ; GFX12-WGP: ; %bb.0: ; %entry
21111 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
21112 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
21113 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
21114 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
21115 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
21116 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
21117 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
21118 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
21119 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
21120 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
21121 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
21122 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
21123 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
21124 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
21125 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
21126 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
21127 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
21128 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
21129 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
21130 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
21131 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
21132 ; GFX12-WGP-NEXT: s_endpgm
21134 ; GFX12-CU-LABEL: global_system_one_as_acquire_seq_cst_ret_cmpxchg:
21135 ; GFX12-CU: ; %bb.0: ; %entry
21136 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
21137 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
21138 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
21139 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
21140 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
21141 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
21142 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
21143 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
21144 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
21145 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
21146 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
21147 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
21148 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
21149 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
21150 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
21151 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
21152 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
21153 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
21154 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
21155 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
21156 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
21157 ; GFX12-CU-NEXT: s_endpgm
21158 ptr addrspace(1) %out, i32 %in, i32 %old) {
21160 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
21161 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") acquire seq_cst
21162 %val0 = extractvalue { i32, i1 } %val, 0
21163 store i32 %val0, ptr addrspace(1) %out, align 4
21167 define amdgpu_kernel void @global_system_one_as_release_seq_cst_ret_cmpxchg(
21168 ; GFX6-LABEL: global_system_one_as_release_seq_cst_ret_cmpxchg:
21169 ; GFX6: ; %bb.0: ; %entry
21170 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
21171 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
21172 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
21173 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
21174 ; GFX6-NEXT: s_mov_b32 s12, s5
21175 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
21176 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
21177 ; GFX6-NEXT: s_mov_b32 s11, -1
21178 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
21179 ; GFX6-NEXT: s_mov_b32 s5, s12
21180 ; GFX6-NEXT: s_mov_b32 s6, s11
21181 ; GFX6-NEXT: s_mov_b32 s7, s10
21182 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
21183 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
21184 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
21185 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
21186 ; GFX6-NEXT: s_waitcnt vmcnt(0)
21187 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
21188 ; GFX6-NEXT: s_waitcnt vmcnt(0)
21189 ; GFX6-NEXT: buffer_wbinvl1
21190 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
21191 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
21192 ; GFX6-NEXT: s_endpgm
21194 ; GFX7-LABEL: global_system_one_as_release_seq_cst_ret_cmpxchg:
21195 ; GFX7: ; %bb.0: ; %entry
21196 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
21197 ; GFX7-NEXT: s_load_dword s9, s[6:7], 0x2
21198 ; GFX7-NEXT: s_load_dword s8, s[6:7], 0x3
21199 ; GFX7-NEXT: s_mov_b64 s[12:13], 16
21200 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
21201 ; GFX7-NEXT: s_mov_b32 s6, s4
21202 ; GFX7-NEXT: s_mov_b32 s7, s5
21203 ; GFX7-NEXT: s_mov_b32 s11, s12
21204 ; GFX7-NEXT: s_mov_b32 s10, s13
21205 ; GFX7-NEXT: s_add_u32 s6, s6, s11
21206 ; GFX7-NEXT: s_addc_u32 s10, s7, s10
21207 ; GFX7-NEXT: ; kill: def $sgpr6 killed $sgpr6 def $sgpr6_sgpr7
21208 ; GFX7-NEXT: s_mov_b32 s7, s10
21209 ; GFX7-NEXT: v_mov_b32_e32 v2, s9
21210 ; GFX7-NEXT: v_mov_b32_e32 v0, s8
21211 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
21212 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
21213 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
21214 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
21215 ; GFX7-NEXT: s_waitcnt vmcnt(0)
21216 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
21217 ; GFX7-NEXT: s_waitcnt vmcnt(0)
21218 ; GFX7-NEXT: buffer_wbinvl1_vol
21219 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
21220 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
21221 ; GFX7-NEXT: flat_store_dword v[0:1], v2
21222 ; GFX7-NEXT: s_endpgm
21224 ; GFX10-WGP-LABEL: global_system_one_as_release_seq_cst_ret_cmpxchg:
21225 ; GFX10-WGP: ; %bb.0: ; %entry
21226 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
21227 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
21228 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
21229 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
21230 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
21231 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
21232 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
21233 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
21234 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
21235 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
21236 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
21237 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
21238 ; GFX10-WGP-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
21239 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
21240 ; GFX10-WGP-NEXT: buffer_gl1_inv
21241 ; GFX10-WGP-NEXT: buffer_gl0_inv
21242 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
21243 ; GFX10-WGP-NEXT: s_endpgm
21245 ; GFX10-CU-LABEL: global_system_one_as_release_seq_cst_ret_cmpxchg:
21246 ; GFX10-CU: ; %bb.0: ; %entry
21247 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
21248 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
21249 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
21250 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
21251 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
21252 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
21253 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
21254 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
21255 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
21256 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
21257 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
21258 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
21259 ; GFX10-CU-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
21260 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
21261 ; GFX10-CU-NEXT: buffer_gl1_inv
21262 ; GFX10-CU-NEXT: buffer_gl0_inv
21263 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
21264 ; GFX10-CU-NEXT: s_endpgm
21266 ; SKIP-CACHE-INV-LABEL: global_system_one_as_release_seq_cst_ret_cmpxchg:
21267 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
21268 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
21269 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
21270 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
21271 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
21272 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
21273 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
21274 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
21275 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
21276 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
21277 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
21278 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
21279 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
21280 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
21281 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
21282 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
21283 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
21284 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
21285 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16 glc
21286 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
21287 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
21288 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
21289 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
21290 ; SKIP-CACHE-INV-NEXT: s_endpgm
21292 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_release_seq_cst_ret_cmpxchg:
21293 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
21294 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
21295 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
21296 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
21297 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
21298 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
21299 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
21300 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
21301 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
21302 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
21303 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
21304 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
21305 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
21306 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
21307 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
21308 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
21309 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
21310 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
21311 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
21313 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_release_seq_cst_ret_cmpxchg:
21314 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
21315 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
21316 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
21317 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
21318 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
21319 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
21320 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
21321 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
21322 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
21323 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
21324 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
21325 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
21326 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
21327 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
21328 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
21329 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
21330 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
21331 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
21332 ; GFX90A-TGSPLIT-NEXT: s_endpgm
21334 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_release_seq_cst_ret_cmpxchg:
21335 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
21336 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
21337 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
21338 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
21339 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
21340 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
21341 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
21342 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
21343 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
21344 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
21345 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
21346 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
21347 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
21348 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
21349 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
21350 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
21351 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
21352 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
21354 ; GFX940-TGSPLIT-LABEL: global_system_one_as_release_seq_cst_ret_cmpxchg:
21355 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
21356 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
21357 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
21358 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
21359 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
21360 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
21361 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
21362 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
21363 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
21364 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
21365 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
21366 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
21367 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
21368 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
21369 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
21370 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
21371 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
21372 ; GFX940-TGSPLIT-NEXT: s_endpgm
21374 ; GFX11-WGP-LABEL: global_system_one_as_release_seq_cst_ret_cmpxchg:
21375 ; GFX11-WGP: ; %bb.0: ; %entry
21376 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
21377 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
21378 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
21379 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
21380 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
21381 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
21382 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
21383 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
21384 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
21385 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
21386 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
21387 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
21388 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
21389 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
21390 ; GFX11-WGP-NEXT: buffer_gl1_inv
21391 ; GFX11-WGP-NEXT: buffer_gl0_inv
21392 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
21393 ; GFX11-WGP-NEXT: s_endpgm
21395 ; GFX11-CU-LABEL: global_system_one_as_release_seq_cst_ret_cmpxchg:
21396 ; GFX11-CU: ; %bb.0: ; %entry
21397 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
21398 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
21399 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
21400 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
21401 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
21402 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
21403 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
21404 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
21405 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
21406 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
21407 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
21408 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
21409 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
21410 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
21411 ; GFX11-CU-NEXT: buffer_gl1_inv
21412 ; GFX11-CU-NEXT: buffer_gl0_inv
21413 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
21414 ; GFX11-CU-NEXT: s_endpgm
21416 ; GFX12-WGP-LABEL: global_system_one_as_release_seq_cst_ret_cmpxchg:
21417 ; GFX12-WGP: ; %bb.0: ; %entry
21418 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
21419 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
21420 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
21421 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
21422 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
21423 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
21424 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
21425 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
21426 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
21427 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
21428 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
21429 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
21430 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
21431 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
21432 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
21433 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
21434 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
21435 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
21436 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
21437 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
21438 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
21439 ; GFX12-WGP-NEXT: s_endpgm
21441 ; GFX12-CU-LABEL: global_system_one_as_release_seq_cst_ret_cmpxchg:
21442 ; GFX12-CU: ; %bb.0: ; %entry
21443 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
21444 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
21445 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
21446 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
21447 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
21448 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
21449 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
21450 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
21451 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
21452 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
21453 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
21454 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
21455 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
21456 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
21457 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
21458 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
21459 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
21460 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
21461 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
21462 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
21463 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
21464 ; GFX12-CU-NEXT: s_endpgm
21465 ptr addrspace(1) %out, i32 %in, i32 %old) {
21467 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
21468 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") release seq_cst
21469 %val0 = extractvalue { i32, i1 } %val, 0
21470 store i32 %val0, ptr addrspace(1) %out, align 4
21474 define amdgpu_kernel void @global_system_one_as_acq_rel_seq_cst_ret_cmpxchg(
21475 ; GFX6-LABEL: global_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
21476 ; GFX6: ; %bb.0: ; %entry
21477 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
21478 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
21479 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
21480 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
21481 ; GFX6-NEXT: s_mov_b32 s12, s5
21482 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
21483 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
21484 ; GFX6-NEXT: s_mov_b32 s11, -1
21485 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
21486 ; GFX6-NEXT: s_mov_b32 s5, s12
21487 ; GFX6-NEXT: s_mov_b32 s6, s11
21488 ; GFX6-NEXT: s_mov_b32 s7, s10
21489 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
21490 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
21491 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
21492 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
21493 ; GFX6-NEXT: s_waitcnt vmcnt(0)
21494 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
21495 ; GFX6-NEXT: s_waitcnt vmcnt(0)
21496 ; GFX6-NEXT: buffer_wbinvl1
21497 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
21498 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
21499 ; GFX6-NEXT: s_endpgm
21501 ; GFX7-LABEL: global_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
21502 ; GFX7: ; %bb.0: ; %entry
21503 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
21504 ; GFX7-NEXT: s_load_dword s9, s[6:7], 0x2
21505 ; GFX7-NEXT: s_load_dword s8, s[6:7], 0x3
21506 ; GFX7-NEXT: s_mov_b64 s[12:13], 16
21507 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
21508 ; GFX7-NEXT: s_mov_b32 s6, s4
21509 ; GFX7-NEXT: s_mov_b32 s7, s5
21510 ; GFX7-NEXT: s_mov_b32 s11, s12
21511 ; GFX7-NEXT: s_mov_b32 s10, s13
21512 ; GFX7-NEXT: s_add_u32 s6, s6, s11
21513 ; GFX7-NEXT: s_addc_u32 s10, s7, s10
21514 ; GFX7-NEXT: ; kill: def $sgpr6 killed $sgpr6 def $sgpr6_sgpr7
21515 ; GFX7-NEXT: s_mov_b32 s7, s10
21516 ; GFX7-NEXT: v_mov_b32_e32 v2, s9
21517 ; GFX7-NEXT: v_mov_b32_e32 v0, s8
21518 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
21519 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
21520 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
21521 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
21522 ; GFX7-NEXT: s_waitcnt vmcnt(0)
21523 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
21524 ; GFX7-NEXT: s_waitcnt vmcnt(0)
21525 ; GFX7-NEXT: buffer_wbinvl1_vol
21526 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
21527 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
21528 ; GFX7-NEXT: flat_store_dword v[0:1], v2
21529 ; GFX7-NEXT: s_endpgm
21531 ; GFX10-WGP-LABEL: global_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
21532 ; GFX10-WGP: ; %bb.0: ; %entry
21533 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
21534 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
21535 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
21536 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
21537 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
21538 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
21539 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
21540 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
21541 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
21542 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
21543 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
21544 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
21545 ; GFX10-WGP-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
21546 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
21547 ; GFX10-WGP-NEXT: buffer_gl1_inv
21548 ; GFX10-WGP-NEXT: buffer_gl0_inv
21549 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
21550 ; GFX10-WGP-NEXT: s_endpgm
21552 ; GFX10-CU-LABEL: global_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
21553 ; GFX10-CU: ; %bb.0: ; %entry
21554 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
21555 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
21556 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
21557 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
21558 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
21559 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
21560 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
21561 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
21562 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
21563 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
21564 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
21565 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
21566 ; GFX10-CU-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
21567 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
21568 ; GFX10-CU-NEXT: buffer_gl1_inv
21569 ; GFX10-CU-NEXT: buffer_gl0_inv
21570 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
21571 ; GFX10-CU-NEXT: s_endpgm
21573 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
21574 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
21575 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
21576 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
21577 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
21578 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
21579 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
21580 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
21581 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
21582 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
21583 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
21584 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
21585 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
21586 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
21587 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
21588 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
21589 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
21590 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
21591 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
21592 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16 glc
21593 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
21594 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
21595 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
21596 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
21597 ; SKIP-CACHE-INV-NEXT: s_endpgm
21599 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
21600 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
21601 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
21602 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
21603 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
21604 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
21605 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
21606 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
21607 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
21608 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
21609 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
21610 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
21611 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
21612 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
21613 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
21614 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
21615 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
21616 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
21617 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
21618 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
21620 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
21621 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
21622 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
21623 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
21624 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
21625 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
21626 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
21627 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
21628 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
21629 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
21630 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
21631 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
21632 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
21633 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
21634 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
21635 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
21636 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
21637 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
21638 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
21639 ; GFX90A-TGSPLIT-NEXT: s_endpgm
21641 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
21642 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
21643 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
21644 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
21645 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
21646 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
21647 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
21648 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
21649 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
21650 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
21651 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
21652 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
21653 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
21654 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
21655 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
21656 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
21657 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
21658 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
21659 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
21661 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
21662 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
21663 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
21664 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
21665 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
21666 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
21667 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
21668 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
21669 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
21670 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
21671 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
21672 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
21673 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
21674 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
21675 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
21676 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
21677 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
21678 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
21679 ; GFX940-TGSPLIT-NEXT: s_endpgm
21681 ; GFX11-WGP-LABEL: global_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
21682 ; GFX11-WGP: ; %bb.0: ; %entry
21683 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
21684 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
21685 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
21686 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
21687 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
21688 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
21689 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
21690 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
21691 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
21692 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
21693 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
21694 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
21695 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
21696 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
21697 ; GFX11-WGP-NEXT: buffer_gl1_inv
21698 ; GFX11-WGP-NEXT: buffer_gl0_inv
21699 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
21700 ; GFX11-WGP-NEXT: s_endpgm
21702 ; GFX11-CU-LABEL: global_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
21703 ; GFX11-CU: ; %bb.0: ; %entry
21704 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
21705 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
21706 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
21707 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
21708 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
21709 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
21710 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
21711 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
21712 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
21713 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
21714 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
21715 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
21716 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
21717 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
21718 ; GFX11-CU-NEXT: buffer_gl1_inv
21719 ; GFX11-CU-NEXT: buffer_gl0_inv
21720 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
21721 ; GFX11-CU-NEXT: s_endpgm
21723 ; GFX12-WGP-LABEL: global_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
21724 ; GFX12-WGP: ; %bb.0: ; %entry
21725 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
21726 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
21727 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
21728 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
21729 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
21730 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
21731 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
21732 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
21733 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
21734 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
21735 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
21736 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
21737 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
21738 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
21739 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
21740 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
21741 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
21742 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
21743 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
21744 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
21745 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
21746 ; GFX12-WGP-NEXT: s_endpgm
21748 ; GFX12-CU-LABEL: global_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
21749 ; GFX12-CU: ; %bb.0: ; %entry
21750 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
21751 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
21752 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
21753 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
21754 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
21755 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
21756 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
21757 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
21758 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
21759 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
21760 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
21761 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
21762 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
21763 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
21764 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
21765 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
21766 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
21767 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
21768 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
21769 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
21770 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
21771 ; GFX12-CU-NEXT: s_endpgm
21772 ptr addrspace(1) %out, i32 %in, i32 %old) {
21774 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
21775 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") acq_rel seq_cst
21776 %val0 = extractvalue { i32, i1 } %val, 0
21777 store i32 %val0, ptr addrspace(1) %out, align 4
21781 define amdgpu_kernel void @global_system_one_as_seq_cst_seq_cst_ret_cmpxchg(
21782 ; GFX6-LABEL: global_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
21783 ; GFX6: ; %bb.0: ; %entry
21784 ; GFX6-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
21785 ; GFX6-NEXT: s_load_dword s9, s[6:7], 0x2
21786 ; GFX6-NEXT: s_load_dword s8, s[6:7], 0x3
21787 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
21788 ; GFX6-NEXT: s_mov_b32 s12, s5
21789 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 killed $sgpr4_sgpr5
21790 ; GFX6-NEXT: s_mov_b32 s10, 0x100f000
21791 ; GFX6-NEXT: s_mov_b32 s11, -1
21792 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5_sgpr6_sgpr7
21793 ; GFX6-NEXT: s_mov_b32 s5, s12
21794 ; GFX6-NEXT: s_mov_b32 s6, s11
21795 ; GFX6-NEXT: s_mov_b32 s7, s10
21796 ; GFX6-NEXT: v_mov_b32_e32 v0, s9
21797 ; GFX6-NEXT: v_mov_b32_e32 v2, s8
21798 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
21799 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
21800 ; GFX6-NEXT: s_waitcnt vmcnt(0)
21801 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
21802 ; GFX6-NEXT: s_waitcnt vmcnt(0)
21803 ; GFX6-NEXT: buffer_wbinvl1
21804 ; GFX6-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
21805 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
21806 ; GFX6-NEXT: s_endpgm
21808 ; GFX7-LABEL: global_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
21809 ; GFX7: ; %bb.0: ; %entry
21810 ; GFX7-NEXT: s_load_dwordx2 s[4:5], s[6:7], 0x0
21811 ; GFX7-NEXT: s_load_dword s9, s[6:7], 0x2
21812 ; GFX7-NEXT: s_load_dword s8, s[6:7], 0x3
21813 ; GFX7-NEXT: s_mov_b64 s[12:13], 16
21814 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
21815 ; GFX7-NEXT: s_mov_b32 s6, s4
21816 ; GFX7-NEXT: s_mov_b32 s7, s5
21817 ; GFX7-NEXT: s_mov_b32 s11, s12
21818 ; GFX7-NEXT: s_mov_b32 s10, s13
21819 ; GFX7-NEXT: s_add_u32 s6, s6, s11
21820 ; GFX7-NEXT: s_addc_u32 s10, s7, s10
21821 ; GFX7-NEXT: ; kill: def $sgpr6 killed $sgpr6 def $sgpr6_sgpr7
21822 ; GFX7-NEXT: s_mov_b32 s7, s10
21823 ; GFX7-NEXT: v_mov_b32_e32 v2, s9
21824 ; GFX7-NEXT: v_mov_b32_e32 v0, s8
21825 ; GFX7-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
21826 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
21827 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
21828 ; GFX7-NEXT: v_mov_b32_e32 v1, s7
21829 ; GFX7-NEXT: s_waitcnt vmcnt(0)
21830 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
21831 ; GFX7-NEXT: s_waitcnt vmcnt(0)
21832 ; GFX7-NEXT: buffer_wbinvl1_vol
21833 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
21834 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
21835 ; GFX7-NEXT: flat_store_dword v[0:1], v2
21836 ; GFX7-NEXT: s_endpgm
21838 ; GFX10-WGP-LABEL: global_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
21839 ; GFX10-WGP: ; %bb.0: ; %entry
21840 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
21841 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
21842 ; GFX10-WGP-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
21843 ; GFX10-WGP-NEXT: s_load_dword s7, s[8:9], 0x8
21844 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0xc
21845 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
21846 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s7
21847 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s6
21848 ; GFX10-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
21849 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, v3
21850 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
21851 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
21852 ; GFX10-WGP-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
21853 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
21854 ; GFX10-WGP-NEXT: buffer_gl1_inv
21855 ; GFX10-WGP-NEXT: buffer_gl0_inv
21856 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[4:5]
21857 ; GFX10-WGP-NEXT: s_endpgm
21859 ; GFX10-CU-LABEL: global_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
21860 ; GFX10-CU: ; %bb.0: ; %entry
21861 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
21862 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
21863 ; GFX10-CU-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
21864 ; GFX10-CU-NEXT: s_load_dword s7, s[8:9], 0x8
21865 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0xc
21866 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
21867 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s7
21868 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s6
21869 ; GFX10-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
21870 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, v3
21871 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
21872 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
21873 ; GFX10-CU-NEXT: global_atomic_cmpswap v1, v0, v[1:2], s[4:5] offset:16 glc
21874 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
21875 ; GFX10-CU-NEXT: buffer_gl1_inv
21876 ; GFX10-CU-NEXT: buffer_gl0_inv
21877 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[4:5]
21878 ; GFX10-CU-NEXT: s_endpgm
21880 ; SKIP-CACHE-INV-LABEL: global_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
21881 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
21882 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x0
21883 ; SKIP-CACHE-INV-NEXT: s_load_dword s5, s[2:3], 0x2
21884 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[2:3], 0x3
21885 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
21886 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s8, s1
21887 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 killed $sgpr0_sgpr1
21888 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, 0xf000
21889 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, -1
21890 ; SKIP-CACHE-INV-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1_sgpr2_sgpr3
21891 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s1, s8
21892 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, s7
21893 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, s6
21894 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s5
21895 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s4
21896 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 def $vgpr0_vgpr1 killed $exec
21897 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, v2
21898 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
21899 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[0:3], 0 offset:16 glc
21900 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
21901 ; SKIP-CACHE-INV-NEXT: ; kill: def $vgpr0 killed $vgpr0 killed $vgpr0_vgpr1 killed $exec
21902 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
21903 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
21904 ; SKIP-CACHE-INV-NEXT: s_endpgm
21906 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
21907 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
21908 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
21909 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
21910 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
21911 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
21912 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
21913 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
21914 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s7
21915 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
21916 ; GFX90A-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
21917 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
21918 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
21919 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
21920 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
21921 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
21922 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
21923 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
21924 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
21925 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
21927 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
21928 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
21929 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
21930 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
21931 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[4:5], s[8:9], 0x0
21932 ; GFX90A-TGSPLIT-NEXT: s_load_dword s7, s[8:9], 0x8
21933 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0xc
21934 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
21935 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s7
21936 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
21937 ; GFX90A-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
21938 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
21939 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
21940 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
21941 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[4:5] offset:16 glc
21942 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
21943 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
21944 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
21945 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[4:5]
21946 ; GFX90A-TGSPLIT-NEXT: s_endpgm
21948 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
21949 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
21950 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
21951 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
21952 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
21953 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
21954 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
21955 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
21956 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s3
21957 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
21958 ; GFX940-NOTTGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
21959 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v3, v1
21960 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
21961 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
21962 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
21963 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
21964 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
21965 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
21966 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
21968 ; GFX940-TGSPLIT-LABEL: global_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
21969 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
21970 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
21971 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
21972 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
21973 ; GFX940-TGSPLIT-NEXT: s_load_dword s3, s[4:5], 0x8
21974 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0xc
21975 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
21976 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s3
21977 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
21978 ; GFX940-TGSPLIT-NEXT: ; kill: def $vgpr2 killed $vgpr2 def $vgpr2_vgpr3 killed $exec
21979 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v3, v1
21980 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
21981 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
21982 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v1, v0, v[2:3], s[0:1] offset:16 sc0 sc1
21983 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
21984 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
21985 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
21986 ; GFX940-TGSPLIT-NEXT: s_endpgm
21988 ; GFX11-WGP-LABEL: global_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
21989 ; GFX11-WGP: ; %bb.0: ; %entry
21990 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
21991 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
21992 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
21993 ; GFX11-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
21994 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
21995 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
21996 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s3
21997 ; GFX11-WGP-NEXT: v_mov_b32_e32 v3, s2
21998 ; GFX11-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
21999 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, v3
22000 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
22001 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
22002 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
22003 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
22004 ; GFX11-WGP-NEXT: buffer_gl1_inv
22005 ; GFX11-WGP-NEXT: buffer_gl0_inv
22006 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
22007 ; GFX11-WGP-NEXT: s_endpgm
22009 ; GFX11-CU-LABEL: global_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
22010 ; GFX11-CU: ; %bb.0: ; %entry
22011 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
22012 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
22013 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
22014 ; GFX11-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
22015 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
22016 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
22017 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s3
22018 ; GFX11-CU-NEXT: v_mov_b32_e32 v3, s2
22019 ; GFX11-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
22020 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, v3
22021 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
22022 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
22023 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 glc
22024 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
22025 ; GFX11-CU-NEXT: buffer_gl1_inv
22026 ; GFX11-CU-NEXT: buffer_gl0_inv
22027 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
22028 ; GFX11-CU-NEXT: s_endpgm
22030 ; GFX12-WGP-LABEL: global_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
22031 ; GFX12-WGP: ; %bb.0: ; %entry
22032 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
22033 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, 0
22034 ; GFX12-WGP-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
22035 ; GFX12-WGP-NEXT: s_load_b32 s3, s[4:5], 0x8
22036 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0xc
22037 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
22038 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s3
22039 ; GFX12-WGP-NEXT: v_mov_b32_e32 v3, s2
22040 ; GFX12-WGP-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
22041 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, v3
22042 ; GFX12-WGP-NEXT: global_wb scope:SCOPE_SYS
22043 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
22044 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
22045 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
22046 ; GFX12-WGP-NEXT: s_wait_storecnt 0x0
22047 ; GFX12-WGP-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
22048 ; GFX12-WGP-NEXT: s_wait_bvhcnt 0x0
22049 ; GFX12-WGP-NEXT: s_wait_samplecnt 0x0
22050 ; GFX12-WGP-NEXT: s_wait_loadcnt 0x0
22051 ; GFX12-WGP-NEXT: global_inv scope:SCOPE_SYS
22052 ; GFX12-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
22053 ; GFX12-WGP-NEXT: s_endpgm
22055 ; GFX12-CU-LABEL: global_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
22056 ; GFX12-CU: ; %bb.0: ; %entry
22057 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
22058 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, 0
22059 ; GFX12-CU-NEXT: s_load_b64 s[0:1], s[4:5], 0x0
22060 ; GFX12-CU-NEXT: s_load_b32 s3, s[4:5], 0x8
22061 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0xc
22062 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
22063 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s3
22064 ; GFX12-CU-NEXT: v_mov_b32_e32 v3, s2
22065 ; GFX12-CU-NEXT: ; kill: def $vgpr1 killed $vgpr1 def $vgpr1_vgpr2 killed $exec
22066 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, v3
22067 ; GFX12-CU-NEXT: global_wb scope:SCOPE_SYS
22068 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
22069 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
22070 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
22071 ; GFX12-CU-NEXT: s_wait_storecnt 0x0
22072 ; GFX12-CU-NEXT: global_atomic_cmpswap_b32 v1, v0, v[1:2], s[0:1] offset:16 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
22073 ; GFX12-CU-NEXT: s_wait_bvhcnt 0x0
22074 ; GFX12-CU-NEXT: s_wait_samplecnt 0x0
22075 ; GFX12-CU-NEXT: s_wait_loadcnt 0x0
22076 ; GFX12-CU-NEXT: global_inv scope:SCOPE_SYS
22077 ; GFX12-CU-NEXT: global_store_b32 v0, v1, s[0:1]
22078 ; GFX12-CU-NEXT: s_endpgm
22079 ptr addrspace(1) %out, i32 %in, i32 %old) {
22081 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
22082 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("one-as") seq_cst seq_cst
22083 %val0 = extractvalue { i32, i1 } %val, 0
22084 store i32 %val0, ptr addrspace(1) %out, align 4