1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=amdgcn-amd- -mcpu=gfx600 -verify-machineinstrs < %s | FileCheck --check-prefixes=GFX6 %s
3 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx700 -verify-machineinstrs < %s | FileCheck --check-prefixes=GFX7 %s
4 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck --check-prefixes=GFX10-WGP %s
5 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -mattr=+cumode -verify-machineinstrs < %s | FileCheck --check-prefixes=GFX10-CU %s
6 ; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx700 -amdgcn-skip-cache-invalidations -verify-machineinstrs < %s | FileCheck --check-prefixes=SKIP-CACHE-INV %s
7 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1100 -verify-machineinstrs < %s | FileCheck --check-prefixes=GFX11-WGP %s
8 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1100 -mattr=+cumode -verify-machineinstrs < %s | FileCheck --check-prefixes=GFX11-CU %s
10 define amdgpu_kernel void @local_volatile_load_0(
11 ; GFX6-LABEL: local_volatile_load_0:
12 ; GFX6: ; %bb.0: ; %entry
13 ; GFX6-NEXT: s_load_dword s2, s[0:1], 0x9
14 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0xb
15 ; GFX6-NEXT: s_mov_b32 m0, -1
16 ; GFX6-NEXT: s_mov_b32 s3, 0xf000
17 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
18 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
19 ; GFX6-NEXT: ds_read_b32 v0, v0
20 ; GFX6-NEXT: s_mov_b32 s2, -1
21 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
22 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
25 ; GFX7-LABEL: local_volatile_load_0:
26 ; GFX7: ; %bb.0: ; %entry
27 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
28 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
29 ; GFX7-NEXT: s_mov_b32 m0, -1
30 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
31 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
32 ; GFX7-NEXT: ds_read_b32 v2, v0
33 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
34 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
35 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
36 ; GFX7-NEXT: flat_store_dword v[0:1], v2
39 ; GFX10-WGP-LABEL: local_volatile_load_0:
40 ; GFX10-WGP: ; %bb.0: ; %entry
41 ; GFX10-WGP-NEXT: s_clause 0x1
42 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
43 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
44 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, 0
45 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
46 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
47 ; GFX10-WGP-NEXT: ds_read_b32 v0, v0
48 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
49 ; GFX10-WGP-NEXT: global_store_dword v1, v0, s[0:1]
50 ; GFX10-WGP-NEXT: s_endpgm
52 ; GFX10-CU-LABEL: local_volatile_load_0:
53 ; GFX10-CU: ; %bb.0: ; %entry
54 ; GFX10-CU-NEXT: s_clause 0x1
55 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
56 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
57 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, 0
58 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
59 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
60 ; GFX10-CU-NEXT: ds_read_b32 v0, v0
61 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
62 ; GFX10-CU-NEXT: global_store_dword v1, v0, s[0:1]
63 ; GFX10-CU-NEXT: s_endpgm
65 ; SKIP-CACHE-INV-LABEL: local_volatile_load_0:
66 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
67 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[0:1], 0x0
68 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x2
69 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
70 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
71 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
72 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
73 ; SKIP-CACHE-INV-NEXT: ds_read_b32 v0, v0
74 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
75 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
76 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
77 ; SKIP-CACHE-INV-NEXT: s_endpgm
79 ; GFX11-WGP-LABEL: local_volatile_load_0:
80 ; GFX11-WGP: ; %bb.0: ; %entry
81 ; GFX11-WGP-NEXT: s_clause 0x1
82 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
83 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
84 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
85 ; GFX11-WGP-NEXT: v_dual_mov_b32 v1, 0 :: v_dual_mov_b32 v0, s2
86 ; GFX11-WGP-NEXT: ds_load_b32 v0, v0
87 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
88 ; GFX11-WGP-NEXT: global_store_b32 v1, v0, s[0:1]
89 ; GFX11-WGP-NEXT: s_nop 0
90 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
91 ; GFX11-WGP-NEXT: s_endpgm
93 ; GFX11-CU-LABEL: local_volatile_load_0:
94 ; GFX11-CU: ; %bb.0: ; %entry
95 ; GFX11-CU-NEXT: s_clause 0x1
96 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
97 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
98 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
99 ; GFX11-CU-NEXT: v_dual_mov_b32 v1, 0 :: v_dual_mov_b32 v0, s2
100 ; GFX11-CU-NEXT: ds_load_b32 v0, v0
101 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
102 ; GFX11-CU-NEXT: global_store_b32 v1, v0, s[0:1]
103 ; GFX11-CU-NEXT: s_nop 0
104 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
105 ; GFX11-CU-NEXT: s_endpgm
106 ptr addrspace(3) %in, ptr addrspace(1) %out) {
108 %val = load volatile i32, ptr addrspace(3) %in, align 4
109 store i32 %val, ptr addrspace(1) %out
113 define amdgpu_kernel void @local_volatile_load_1(
114 ; GFX6-LABEL: local_volatile_load_1:
115 ; GFX6: ; %bb.0: ; %entry
116 ; GFX6-NEXT: s_load_dword s2, s[0:1], 0x9
117 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0xb
118 ; GFX6-NEXT: v_lshlrev_b32_e32 v0, 2, v0
119 ; GFX6-NEXT: s_mov_b32 m0, -1
120 ; GFX6-NEXT: s_mov_b32 s3, 0xf000
121 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
122 ; GFX6-NEXT: v_add_i32_e32 v0, vcc, s2, v0
123 ; GFX6-NEXT: ds_read_b32 v0, v0
124 ; GFX6-NEXT: s_mov_b32 s2, -1
125 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
126 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
127 ; GFX6-NEXT: s_endpgm
129 ; GFX7-LABEL: local_volatile_load_1:
130 ; GFX7: ; %bb.0: ; %entry
131 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
132 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
133 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 2, v0
134 ; GFX7-NEXT: s_mov_b32 m0, -1
135 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
136 ; GFX7-NEXT: v_add_i32_e32 v0, vcc, s2, v0
137 ; GFX7-NEXT: ds_read_b32 v2, v0
138 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
139 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
140 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
141 ; GFX7-NEXT: flat_store_dword v[0:1], v2
142 ; GFX7-NEXT: s_endpgm
144 ; GFX10-WGP-LABEL: local_volatile_load_1:
145 ; GFX10-WGP: ; %bb.0: ; %entry
146 ; GFX10-WGP-NEXT: s_clause 0x1
147 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
148 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
149 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, 0
150 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
151 ; GFX10-WGP-NEXT: v_lshl_add_u32 v0, v0, 2, s2
152 ; GFX10-WGP-NEXT: ds_read_b32 v0, v0
153 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
154 ; GFX10-WGP-NEXT: global_store_dword v1, v0, s[0:1]
155 ; GFX10-WGP-NEXT: s_endpgm
157 ; GFX10-CU-LABEL: local_volatile_load_1:
158 ; GFX10-CU: ; %bb.0: ; %entry
159 ; GFX10-CU-NEXT: s_clause 0x1
160 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
161 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
162 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, 0
163 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
164 ; GFX10-CU-NEXT: v_lshl_add_u32 v0, v0, 2, s2
165 ; GFX10-CU-NEXT: ds_read_b32 v0, v0
166 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
167 ; GFX10-CU-NEXT: global_store_dword v1, v0, s[0:1]
168 ; GFX10-CU-NEXT: s_endpgm
170 ; SKIP-CACHE-INV-LABEL: local_volatile_load_1:
171 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
172 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[0:1], 0x0
173 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x2
174 ; SKIP-CACHE-INV-NEXT: v_lshlrev_b32_e32 v0, 2, v0
175 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
176 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
177 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
178 ; SKIP-CACHE-INV-NEXT: v_add_i32_e32 v0, vcc, s2, v0
179 ; SKIP-CACHE-INV-NEXT: ds_read_b32 v0, v0
180 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
181 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
182 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
183 ; SKIP-CACHE-INV-NEXT: s_endpgm
185 ; GFX11-WGP-LABEL: local_volatile_load_1:
186 ; GFX11-WGP: ; %bb.0: ; %entry
187 ; GFX11-WGP-NEXT: s_clause 0x1
188 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
189 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
190 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, 0
191 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
192 ; GFX11-WGP-NEXT: v_lshl_add_u32 v0, v0, 2, s2
193 ; GFX11-WGP-NEXT: ds_load_b32 v0, v0
194 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
195 ; GFX11-WGP-NEXT: global_store_b32 v1, v0, s[0:1]
196 ; GFX11-WGP-NEXT: s_nop 0
197 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
198 ; GFX11-WGP-NEXT: s_endpgm
200 ; GFX11-CU-LABEL: local_volatile_load_1:
201 ; GFX11-CU: ; %bb.0: ; %entry
202 ; GFX11-CU-NEXT: s_clause 0x1
203 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
204 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
205 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, 0
206 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
207 ; GFX11-CU-NEXT: v_lshl_add_u32 v0, v0, 2, s2
208 ; GFX11-CU-NEXT: ds_load_b32 v0, v0
209 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
210 ; GFX11-CU-NEXT: global_store_b32 v1, v0, s[0:1]
211 ; GFX11-CU-NEXT: s_nop 0
212 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
213 ; GFX11-CU-NEXT: s_endpgm
214 ptr addrspace(3) %in, ptr addrspace(1) %out) {
216 %tid = call i32 @llvm.amdgcn.workitem.id.x()
217 %val.gep = getelementptr inbounds i32, ptr addrspace(3) %in, i32 %tid
218 %val = load volatile i32, ptr addrspace(3) %val.gep, align 4
219 store i32 %val, ptr addrspace(1) %out
223 define amdgpu_kernel void @local_volatile_store_0(
224 ; GFX6-LABEL: local_volatile_store_0:
225 ; GFX6: ; %bb.0: ; %entry
226 ; GFX6-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
227 ; GFX6-NEXT: s_load_dword s0, s[0:1], 0xb
228 ; GFX6-NEXT: s_mov_b32 m0, -1
229 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
230 ; GFX6-NEXT: s_load_dword s1, s[2:3], 0x0
231 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
232 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
233 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
234 ; GFX6-NEXT: ds_write_b32 v0, v1
235 ; GFX6-NEXT: s_endpgm
237 ; GFX7-LABEL: local_volatile_store_0:
238 ; GFX7: ; %bb.0: ; %entry
239 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
240 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
241 ; GFX7-NEXT: s_mov_b32 m0, -1
242 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
243 ; GFX7-NEXT: s_load_dword s0, s[0:1], 0x0
244 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
245 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
246 ; GFX7-NEXT: v_mov_b32_e32 v1, s0
247 ; GFX7-NEXT: ds_write_b32 v0, v1
248 ; GFX7-NEXT: s_endpgm
250 ; GFX10-WGP-LABEL: local_volatile_store_0:
251 ; GFX10-WGP: ; %bb.0: ; %entry
252 ; GFX10-WGP-NEXT: s_clause 0x1
253 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
254 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
255 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
256 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
257 ; GFX10-WGP-NEXT: s_load_dword s0, s[0:1], 0x0
258 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
259 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s0
260 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
261 ; GFX10-WGP-NEXT: s_endpgm
263 ; GFX10-CU-LABEL: local_volatile_store_0:
264 ; GFX10-CU: ; %bb.0: ; %entry
265 ; GFX10-CU-NEXT: s_clause 0x1
266 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
267 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
268 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
269 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
270 ; GFX10-CU-NEXT: s_load_dword s0, s[0:1], 0x0
271 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
272 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s0
273 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
274 ; GFX10-CU-NEXT: s_endpgm
276 ; SKIP-CACHE-INV-LABEL: local_volatile_store_0:
277 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
278 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
279 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
280 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
281 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
282 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x0
283 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
284 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
285 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
286 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
287 ; SKIP-CACHE-INV-NEXT: s_endpgm
289 ; GFX11-WGP-LABEL: local_volatile_store_0:
290 ; GFX11-WGP: ; %bb.0: ; %entry
291 ; GFX11-WGP-NEXT: s_clause 0x1
292 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
293 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
294 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
295 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
296 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
297 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
298 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
299 ; GFX11-WGP-NEXT: s_endpgm
301 ; GFX11-CU-LABEL: local_volatile_store_0:
302 ; GFX11-CU: ; %bb.0: ; %entry
303 ; GFX11-CU-NEXT: s_clause 0x1
304 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
305 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
306 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
307 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
308 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
309 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
310 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
311 ; GFX11-CU-NEXT: s_endpgm
312 ptr addrspace(1) %in, ptr addrspace(3) %out) {
314 %val = load i32, ptr addrspace(1) %in, align 4
315 store volatile i32 %val, ptr addrspace(3) %out
319 define amdgpu_kernel void @local_volatile_store_1(
320 ; GFX6-LABEL: local_volatile_store_1:
321 ; GFX6: ; %bb.0: ; %entry
322 ; GFX6-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
323 ; GFX6-NEXT: s_load_dword s0, s[0:1], 0xb
324 ; GFX6-NEXT: v_lshlrev_b32_e32 v0, 2, v0
325 ; GFX6-NEXT: s_mov_b32 m0, -1
326 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
327 ; GFX6-NEXT: s_load_dword s1, s[2:3], 0x0
328 ; GFX6-NEXT: v_add_i32_e32 v0, vcc, s0, v0
329 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
330 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
331 ; GFX6-NEXT: ds_write_b32 v0, v1
332 ; GFX6-NEXT: s_endpgm
334 ; GFX7-LABEL: local_volatile_store_1:
335 ; GFX7: ; %bb.0: ; %entry
336 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
337 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
338 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 2, v0
339 ; GFX7-NEXT: s_mov_b32 m0, -1
340 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
341 ; GFX7-NEXT: s_load_dword s0, s[0:1], 0x0
342 ; GFX7-NEXT: v_add_i32_e32 v0, vcc, s2, v0
343 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
344 ; GFX7-NEXT: v_mov_b32_e32 v1, s0
345 ; GFX7-NEXT: ds_write_b32 v0, v1
346 ; GFX7-NEXT: s_endpgm
348 ; GFX10-WGP-LABEL: local_volatile_store_1:
349 ; GFX10-WGP: ; %bb.0: ; %entry
350 ; GFX10-WGP-NEXT: s_clause 0x1
351 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
352 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
353 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
354 ; GFX10-WGP-NEXT: v_lshl_add_u32 v0, v0, 2, s2
355 ; GFX10-WGP-NEXT: s_load_dword s0, s[0:1], 0x0
356 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
357 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s0
358 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
359 ; GFX10-WGP-NEXT: s_endpgm
361 ; GFX10-CU-LABEL: local_volatile_store_1:
362 ; GFX10-CU: ; %bb.0: ; %entry
363 ; GFX10-CU-NEXT: s_clause 0x1
364 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
365 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
366 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
367 ; GFX10-CU-NEXT: v_lshl_add_u32 v0, v0, 2, s2
368 ; GFX10-CU-NEXT: s_load_dword s0, s[0:1], 0x0
369 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
370 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s0
371 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
372 ; GFX10-CU-NEXT: s_endpgm
374 ; SKIP-CACHE-INV-LABEL: local_volatile_store_1:
375 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
376 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
377 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
378 ; SKIP-CACHE-INV-NEXT: v_lshlrev_b32_e32 v0, 2, v0
379 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
380 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
381 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x0
382 ; SKIP-CACHE-INV-NEXT: v_add_i32_e32 v0, vcc, s0, v0
383 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
384 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
385 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
386 ; SKIP-CACHE-INV-NEXT: s_endpgm
388 ; GFX11-WGP-LABEL: local_volatile_store_1:
389 ; GFX11-WGP: ; %bb.0: ; %entry
390 ; GFX11-WGP-NEXT: s_clause 0x1
391 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
392 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
393 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
394 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
395 ; GFX11-WGP-NEXT: v_lshl_add_u32 v0, v0, 2, s0
396 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
397 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
398 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
399 ; GFX11-WGP-NEXT: s_endpgm
401 ; GFX11-CU-LABEL: local_volatile_store_1:
402 ; GFX11-CU: ; %bb.0: ; %entry
403 ; GFX11-CU-NEXT: s_clause 0x1
404 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
405 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
406 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
407 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
408 ; GFX11-CU-NEXT: v_lshl_add_u32 v0, v0, 2, s0
409 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
410 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
411 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
412 ; GFX11-CU-NEXT: s_endpgm
413 ptr addrspace(1) %in, ptr addrspace(3) %out) {
415 %tid = call i32 @llvm.amdgcn.workitem.id.x()
416 %val = load i32, ptr addrspace(1) %in, align 4
417 %out.gep = getelementptr inbounds i32, ptr addrspace(3) %out, i32 %tid
418 store volatile i32 %val, ptr addrspace(3) %out.gep
422 define amdgpu_kernel void @local_volatile_workgroup_acquire_load(
423 ; GFX6-LABEL: local_volatile_workgroup_acquire_load:
424 ; GFX6: ; %bb.0: ; %entry
425 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
426 ; GFX6-NEXT: s_mov_b32 m0, -1
427 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
428 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
429 ; GFX6-NEXT: ds_read_b32 v0, v0
430 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
431 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
432 ; GFX6-NEXT: ds_write_b32 v1, v0
433 ; GFX6-NEXT: s_endpgm
435 ; GFX7-LABEL: local_volatile_workgroup_acquire_load:
436 ; GFX7: ; %bb.0: ; %entry
437 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
438 ; GFX7-NEXT: s_mov_b32 m0, -1
439 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
440 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
441 ; GFX7-NEXT: ds_read_b32 v0, v0
442 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
443 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
444 ; GFX7-NEXT: ds_write_b32 v1, v0
445 ; GFX7-NEXT: s_endpgm
447 ; GFX10-WGP-LABEL: local_volatile_workgroup_acquire_load:
448 ; GFX10-WGP: ; %bb.0: ; %entry
449 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
450 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
451 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
452 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
453 ; GFX10-WGP-NEXT: ds_read_b32 v0, v0
454 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
455 ; GFX10-WGP-NEXT: buffer_gl0_inv
456 ; GFX10-WGP-NEXT: ds_write_b32 v1, v0
457 ; GFX10-WGP-NEXT: s_endpgm
459 ; GFX10-CU-LABEL: local_volatile_workgroup_acquire_load:
460 ; GFX10-CU: ; %bb.0: ; %entry
461 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
462 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
463 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
464 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
465 ; GFX10-CU-NEXT: ds_read_b32 v0, v0
466 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
467 ; GFX10-CU-NEXT: ds_write_b32 v1, v0
468 ; GFX10-CU-NEXT: s_endpgm
470 ; SKIP-CACHE-INV-LABEL: local_volatile_workgroup_acquire_load:
471 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
472 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
473 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
474 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
475 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
476 ; SKIP-CACHE-INV-NEXT: ds_read_b32 v0, v0
477 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
478 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
479 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v1, v0
480 ; SKIP-CACHE-INV-NEXT: s_endpgm
482 ; GFX11-WGP-LABEL: local_volatile_workgroup_acquire_load:
483 ; GFX11-WGP: ; %bb.0: ; %entry
484 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
485 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
486 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
487 ; GFX11-WGP-NEXT: ds_load_b32 v0, v0
488 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
489 ; GFX11-WGP-NEXT: buffer_gl0_inv
490 ; GFX11-WGP-NEXT: ds_store_b32 v1, v0
491 ; GFX11-WGP-NEXT: s_endpgm
493 ; GFX11-CU-LABEL: local_volatile_workgroup_acquire_load:
494 ; GFX11-CU: ; %bb.0: ; %entry
495 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
496 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
497 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
498 ; GFX11-CU-NEXT: ds_load_b32 v0, v0
499 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
500 ; GFX11-CU-NEXT: ds_store_b32 v1, v0
501 ; GFX11-CU-NEXT: s_endpgm
502 ptr addrspace(3) %in, ptr addrspace(3) %out) {
504 %val = load atomic volatile i32, ptr addrspace(3) %in syncscope("workgroup") acquire, align 4
505 store i32 %val, ptr addrspace(3) %out
509 define amdgpu_kernel void @local_volatile_workgroup_release_store(
510 ; GFX6-LABEL: local_volatile_workgroup_release_store:
511 ; GFX6: ; %bb.0: ; %entry
512 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
513 ; GFX6-NEXT: s_mov_b32 m0, -1
514 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
515 ; GFX6-NEXT: v_mov_b32_e32 v0, s1
516 ; GFX6-NEXT: v_mov_b32_e32 v1, s0
517 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
518 ; GFX6-NEXT: ds_write_b32 v0, v1
519 ; GFX6-NEXT: s_endpgm
521 ; GFX7-LABEL: local_volatile_workgroup_release_store:
522 ; GFX7: ; %bb.0: ; %entry
523 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
524 ; GFX7-NEXT: s_mov_b32 m0, -1
525 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
526 ; GFX7-NEXT: v_mov_b32_e32 v0, s1
527 ; GFX7-NEXT: v_mov_b32_e32 v1, s0
528 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
529 ; GFX7-NEXT: ds_write_b32 v0, v1
530 ; GFX7-NEXT: s_endpgm
532 ; GFX10-WGP-LABEL: local_volatile_workgroup_release_store:
533 ; GFX10-WGP: ; %bb.0: ; %entry
534 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
535 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
536 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s1
537 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s0
538 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
539 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
540 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
541 ; GFX10-WGP-NEXT: s_endpgm
543 ; GFX10-CU-LABEL: local_volatile_workgroup_release_store:
544 ; GFX10-CU: ; %bb.0: ; %entry
545 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
546 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
547 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s1
548 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s0
549 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
550 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
551 ; GFX10-CU-NEXT: s_endpgm
553 ; SKIP-CACHE-INV-LABEL: local_volatile_workgroup_release_store:
554 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
555 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
556 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
557 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
558 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
559 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
560 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
561 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
562 ; SKIP-CACHE-INV-NEXT: s_endpgm
564 ; GFX11-WGP-LABEL: local_volatile_workgroup_release_store:
565 ; GFX11-WGP: ; %bb.0: ; %entry
566 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
567 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
568 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s1 :: v_dual_mov_b32 v1, s0
569 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
570 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
571 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
572 ; GFX11-WGP-NEXT: s_endpgm
574 ; GFX11-CU-LABEL: local_volatile_workgroup_release_store:
575 ; GFX11-CU: ; %bb.0: ; %entry
576 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
577 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
578 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s1 :: v_dual_mov_b32 v1, s0
579 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
580 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
581 ; GFX11-CU-NEXT: s_endpgm
582 i32 %in, ptr addrspace(3) %out) {
584 store atomic volatile i32 %in, ptr addrspace(3) %out syncscope("workgroup") release, align 4
588 declare i32 @llvm.amdgcn.workitem.id.x()