1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=amdgcn -mcpu=gfx900 -mattr=-promote-alloca -mattr=+enable-flat-scratch -verify-machineinstrs < %s | FileCheck --check-prefix=GFX9 %s
3 ; RUN: llc -mtriple=amdgcn -mcpu=gfx1030 -mattr=-promote-alloca -mattr=+enable-flat-scratch -verify-machineinstrs < %s | FileCheck --check-prefix=GFX10 %s
4 ; RUN: llc -mtriple=amdgcn -mcpu=gfx1100 -mattr=-promote-alloca -mattr=+enable-flat-scratch -verify-machineinstrs < %s | FileCheck --check-prefix=GFX11 %s
5 ; RUN: llc -mtriple=amdgcn -mcpu=gfx1200 -mattr=-promote-alloca -mattr=+enable-flat-scratch -verify-machineinstrs < %s | FileCheck --check-prefix=GFX12 %s
6 ; RUN: llc -mtriple=amdgcn--amdpal -mcpu=gfx900 -mattr=-promote-alloca -mattr=+enable-flat-scratch -verify-machineinstrs < %s | FileCheck --check-prefix=GFX9-PAL %s
7 ; RUN: llc -mtriple=amdgcn -mcpu=gfx940 -mattr=-promote-alloca -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX940 %s
8 ; RUN: llc -mtriple=amdgcn--amdpal -mcpu=gfx1010 -mattr=-promote-alloca -mattr=+enable-flat-scratch -verify-machineinstrs < %s | FileCheck --check-prefixes=GFX10-PAL,GFX1010-PAL %s
9 ; RUN: llc -mtriple=amdgcn--amdpal -mcpu=gfx1030 -mattr=-promote-alloca -mattr=+enable-flat-scratch -verify-machineinstrs < %s | FileCheck --check-prefixes=GFX10-PAL,GFX1030-PAL %s
10 ; RUN: llc -mtriple=amdgcn--amdpal -mcpu=gfx1100 -mattr=-promote-alloca -mattr=+enable-flat-scratch -verify-machineinstrs < %s | FileCheck --check-prefixes=GFX11-PAL %s
11 ; RUN: llc -mtriple=amdgcn--amdpal -mcpu=gfx1200 -mattr=-promote-alloca -mattr=+enable-flat-scratch -verify-machineinstrs < %s | FileCheck --check-prefixes=GFX12-PAL %s
13 define amdgpu_kernel void @zero_init_kernel() {
14 ; GFX9-LABEL: zero_init_kernel:
16 ; GFX9-NEXT: s_mov_b32 s0, 0
17 ; GFX9-NEXT: s_add_u32 flat_scratch_lo, s6, s11
18 ; GFX9-NEXT: s_mov_b32 s1, s0
19 ; GFX9-NEXT: s_mov_b32 s2, s0
20 ; GFX9-NEXT: s_mov_b32 s3, s0
21 ; GFX9-NEXT: v_mov_b32_e32 v0, s0
22 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s7, 0
23 ; GFX9-NEXT: v_mov_b32_e32 v1, s1
24 ; GFX9-NEXT: v_mov_b32_e32 v2, s2
25 ; GFX9-NEXT: v_mov_b32_e32 v3, s3
26 ; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:48
27 ; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:32
28 ; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:16
29 ; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0
32 ; GFX10-LABEL: zero_init_kernel:
34 ; GFX10-NEXT: s_add_u32 s6, s6, s11
35 ; GFX10-NEXT: s_addc_u32 s7, s7, 0
36 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6
37 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7
38 ; GFX10-NEXT: s_mov_b32 s0, 0
39 ; GFX10-NEXT: s_mov_b32 s1, s0
40 ; GFX10-NEXT: s_mov_b32 s2, s0
41 ; GFX10-NEXT: s_mov_b32 s3, s0
42 ; GFX10-NEXT: v_mov_b32_e32 v0, s0
43 ; GFX10-NEXT: v_mov_b32_e32 v1, s1
44 ; GFX10-NEXT: v_mov_b32_e32 v2, s2
45 ; GFX10-NEXT: v_mov_b32_e32 v3, s3
46 ; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:48
47 ; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:32
48 ; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:16
49 ; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], off
50 ; GFX10-NEXT: s_endpgm
52 ; GFX11-LABEL: zero_init_kernel:
54 ; GFX11-NEXT: s_mov_b32 s0, 0
55 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
56 ; GFX11-NEXT: s_mov_b32 s1, s0
57 ; GFX11-NEXT: s_mov_b32 s2, s0
58 ; GFX11-NEXT: s_mov_b32 s3, s0
59 ; GFX11-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
60 ; GFX11-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
61 ; GFX11-NEXT: s_clause 0x3
62 ; GFX11-NEXT: scratch_store_b128 off, v[0:3], off offset:48
63 ; GFX11-NEXT: scratch_store_b128 off, v[0:3], off offset:32
64 ; GFX11-NEXT: scratch_store_b128 off, v[0:3], off offset:16
65 ; GFX11-NEXT: scratch_store_b128 off, v[0:3], off
66 ; GFX11-NEXT: s_endpgm
68 ; GFX12-LABEL: zero_init_kernel:
70 ; GFX12-NEXT: s_mov_b32 s0, 0
71 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
72 ; GFX12-NEXT: s_mov_b32 s1, s0
73 ; GFX12-NEXT: s_mov_b32 s2, s0
74 ; GFX12-NEXT: s_mov_b32 s3, s0
75 ; GFX12-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
76 ; GFX12-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
77 ; GFX12-NEXT: s_clause 0x3
78 ; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:48
79 ; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:32
80 ; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:16
81 ; GFX12-NEXT: scratch_store_b128 off, v[0:3], off
82 ; GFX12-NEXT: s_endpgm
84 ; GFX9-PAL-LABEL: zero_init_kernel:
86 ; GFX9-PAL-NEXT: s_getpc_b64 s[10:11]
87 ; GFX9-PAL-NEXT: s_mov_b32 s10, s0
88 ; GFX9-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
89 ; GFX9-PAL-NEXT: s_mov_b32 s0, 0
90 ; GFX9-PAL-NEXT: s_mov_b32 s1, s0
91 ; GFX9-PAL-NEXT: s_mov_b32 s2, s0
92 ; GFX9-PAL-NEXT: s_mov_b32 s3, s0
93 ; GFX9-PAL-NEXT: s_waitcnt lgkmcnt(0)
94 ; GFX9-PAL-NEXT: s_and_b32 s11, s11, 0xffff
95 ; GFX9-PAL-NEXT: s_add_u32 flat_scratch_lo, s10, s9
96 ; GFX9-PAL-NEXT: v_mov_b32_e32 v0, s0
97 ; GFX9-PAL-NEXT: s_addc_u32 flat_scratch_hi, s11, 0
98 ; GFX9-PAL-NEXT: v_mov_b32_e32 v1, s1
99 ; GFX9-PAL-NEXT: v_mov_b32_e32 v2, s2
100 ; GFX9-PAL-NEXT: v_mov_b32_e32 v3, s3
101 ; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:48
102 ; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:32
103 ; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:16
104 ; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0
105 ; GFX9-PAL-NEXT: s_endpgm
107 ; GFX940-LABEL: zero_init_kernel:
109 ; GFX940-NEXT: s_mov_b32 s0, 0
110 ; GFX940-NEXT: s_mov_b32 s1, s0
111 ; GFX940-NEXT: s_mov_b32 s2, s0
112 ; GFX940-NEXT: s_mov_b32 s3, s0
113 ; GFX940-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
114 ; GFX940-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
115 ; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:48 sc0 sc1
116 ; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:32 sc0 sc1
117 ; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:16 sc0 sc1
118 ; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], off sc0 sc1
119 ; GFX940-NEXT: s_endpgm
121 ; GFX1010-PAL-LABEL: zero_init_kernel:
122 ; GFX1010-PAL: ; %bb.0:
123 ; GFX1010-PAL-NEXT: s_getpc_b64 s[10:11]
124 ; GFX1010-PAL-NEXT: s_mov_b32 s10, s0
125 ; GFX1010-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
126 ; GFX1010-PAL-NEXT: s_waitcnt lgkmcnt(0)
127 ; GFX1010-PAL-NEXT: s_and_b32 s11, s11, 0xffff
128 ; GFX1010-PAL-NEXT: s_add_u32 s10, s10, s9
129 ; GFX1010-PAL-NEXT: s_addc_u32 s11, s11, 0
130 ; GFX1010-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s10
131 ; GFX1010-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11
132 ; GFX1010-PAL-NEXT: s_mov_b32 s0, 0
133 ; GFX1010-PAL-NEXT: s_mov_b32 s1, s0
134 ; GFX1010-PAL-NEXT: s_mov_b32 s2, s0
135 ; GFX1010-PAL-NEXT: s_mov_b32 s3, s0
136 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v0, s0
137 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v1, s1
138 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v2, s2
139 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v3, s3
140 ; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:48
141 ; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:32
142 ; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:16
143 ; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0
144 ; GFX1010-PAL-NEXT: s_endpgm
146 ; GFX1030-PAL-LABEL: zero_init_kernel:
147 ; GFX1030-PAL: ; %bb.0:
148 ; GFX1030-PAL-NEXT: s_getpc_b64 s[10:11]
149 ; GFX1030-PAL-NEXT: s_mov_b32 s10, s0
150 ; GFX1030-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
151 ; GFX1030-PAL-NEXT: s_waitcnt lgkmcnt(0)
152 ; GFX1030-PAL-NEXT: s_and_b32 s11, s11, 0xffff
153 ; GFX1030-PAL-NEXT: s_add_u32 s10, s10, s9
154 ; GFX1030-PAL-NEXT: s_addc_u32 s11, s11, 0
155 ; GFX1030-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s10
156 ; GFX1030-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11
157 ; GFX1030-PAL-NEXT: s_mov_b32 s0, 0
158 ; GFX1030-PAL-NEXT: s_mov_b32 s1, s0
159 ; GFX1030-PAL-NEXT: s_mov_b32 s2, s0
160 ; GFX1030-PAL-NEXT: s_mov_b32 s3, s0
161 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v0, s0
162 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v1, s1
163 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v2, s2
164 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v3, s3
165 ; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:48
166 ; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:32
167 ; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:16
168 ; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], off
169 ; GFX1030-PAL-NEXT: s_endpgm
171 ; GFX11-PAL-LABEL: zero_init_kernel:
172 ; GFX11-PAL: ; %bb.0:
173 ; GFX11-PAL-NEXT: s_mov_b32 s0, 0
174 ; GFX11-PAL-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
175 ; GFX11-PAL-NEXT: s_mov_b32 s1, s0
176 ; GFX11-PAL-NEXT: s_mov_b32 s2, s0
177 ; GFX11-PAL-NEXT: s_mov_b32 s3, s0
178 ; GFX11-PAL-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
179 ; GFX11-PAL-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
180 ; GFX11-PAL-NEXT: s_clause 0x3
181 ; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:48
182 ; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:32
183 ; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:16
184 ; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], off
185 ; GFX11-PAL-NEXT: s_endpgm
187 ; GFX12-PAL-LABEL: zero_init_kernel:
188 ; GFX12-PAL: ; %bb.0:
189 ; GFX12-PAL-NEXT: s_mov_b32 s0, 0
190 ; GFX12-PAL-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
191 ; GFX12-PAL-NEXT: s_mov_b32 s1, s0
192 ; GFX12-PAL-NEXT: s_mov_b32 s2, s0
193 ; GFX12-PAL-NEXT: s_mov_b32 s3, s0
194 ; GFX12-PAL-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
195 ; GFX12-PAL-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
196 ; GFX12-PAL-NEXT: s_clause 0x3
197 ; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:48
198 ; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:32
199 ; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:16
200 ; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off
201 ; GFX12-PAL-NEXT: s_endpgm
202 %alloca = alloca [32 x i16], align 2, addrspace(5)
203 call void @llvm.memset.p5.i64(ptr addrspace(5) align 2 dereferenceable(64) %alloca, i8 0, i64 64, i1 false)
207 define void @zero_init_foo() {
208 ; GFX9-LABEL: zero_init_foo:
210 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
211 ; GFX9-NEXT: s_mov_b32 s0, 0
212 ; GFX9-NEXT: s_mov_b32 s1, s0
213 ; GFX9-NEXT: s_mov_b32 s2, s0
214 ; GFX9-NEXT: s_mov_b32 s3, s0
215 ; GFX9-NEXT: v_mov_b32_e32 v0, s0
216 ; GFX9-NEXT: v_mov_b32_e32 v1, s1
217 ; GFX9-NEXT: v_mov_b32_e32 v2, s2
218 ; GFX9-NEXT: v_mov_b32_e32 v3, s3
219 ; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:48
220 ; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:32
221 ; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:16
222 ; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s32
223 ; GFX9-NEXT: s_waitcnt vmcnt(0)
224 ; GFX9-NEXT: s_setpc_b64 s[30:31]
226 ; GFX10-LABEL: zero_init_foo:
228 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
229 ; GFX10-NEXT: s_mov_b32 s0, 0
230 ; GFX10-NEXT: s_mov_b32 s1, s0
231 ; GFX10-NEXT: s_mov_b32 s2, s0
232 ; GFX10-NEXT: s_mov_b32 s3, s0
233 ; GFX10-NEXT: v_mov_b32_e32 v0, s0
234 ; GFX10-NEXT: v_mov_b32_e32 v1, s1
235 ; GFX10-NEXT: v_mov_b32_e32 v2, s2
236 ; GFX10-NEXT: v_mov_b32_e32 v3, s3
237 ; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:48
238 ; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:32
239 ; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:16
240 ; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], s32
241 ; GFX10-NEXT: s_setpc_b64 s[30:31]
243 ; GFX11-LABEL: zero_init_foo:
245 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
246 ; GFX11-NEXT: s_mov_b32 s0, 0
247 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
248 ; GFX11-NEXT: s_mov_b32 s1, s0
249 ; GFX11-NEXT: s_mov_b32 s2, s0
250 ; GFX11-NEXT: s_mov_b32 s3, s0
251 ; GFX11-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
252 ; GFX11-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
253 ; GFX11-NEXT: s_clause 0x3
254 ; GFX11-NEXT: scratch_store_b128 off, v[0:3], s32 offset:48
255 ; GFX11-NEXT: scratch_store_b128 off, v[0:3], s32 offset:32
256 ; GFX11-NEXT: scratch_store_b128 off, v[0:3], s32 offset:16
257 ; GFX11-NEXT: scratch_store_b128 off, v[0:3], s32
258 ; GFX11-NEXT: s_setpc_b64 s[30:31]
260 ; GFX12-LABEL: zero_init_foo:
262 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
263 ; GFX12-NEXT: s_wait_expcnt 0x0
264 ; GFX12-NEXT: s_wait_samplecnt 0x0
265 ; GFX12-NEXT: s_wait_bvhcnt 0x0
266 ; GFX12-NEXT: s_wait_kmcnt 0x0
267 ; GFX12-NEXT: s_mov_b32 s0, 0
268 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
269 ; GFX12-NEXT: s_mov_b32 s1, s0
270 ; GFX12-NEXT: s_mov_b32 s2, s0
271 ; GFX12-NEXT: s_mov_b32 s3, s0
272 ; GFX12-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
273 ; GFX12-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
274 ; GFX12-NEXT: s_clause 0x3
275 ; GFX12-NEXT: scratch_store_b128 off, v[0:3], s32 offset:48
276 ; GFX12-NEXT: scratch_store_b128 off, v[0:3], s32 offset:32
277 ; GFX12-NEXT: scratch_store_b128 off, v[0:3], s32 offset:16
278 ; GFX12-NEXT: scratch_store_b128 off, v[0:3], s32
279 ; GFX12-NEXT: s_setpc_b64 s[30:31]
281 ; GFX9-PAL-LABEL: zero_init_foo:
283 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
284 ; GFX9-PAL-NEXT: s_mov_b32 s0, 0
285 ; GFX9-PAL-NEXT: s_mov_b32 s1, s0
286 ; GFX9-PAL-NEXT: s_mov_b32 s2, s0
287 ; GFX9-PAL-NEXT: s_mov_b32 s3, s0
288 ; GFX9-PAL-NEXT: v_mov_b32_e32 v0, s0
289 ; GFX9-PAL-NEXT: v_mov_b32_e32 v1, s1
290 ; GFX9-PAL-NEXT: v_mov_b32_e32 v2, s2
291 ; GFX9-PAL-NEXT: v_mov_b32_e32 v3, s3
292 ; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:48
293 ; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:32
294 ; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:16
295 ; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s32
296 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
297 ; GFX9-PAL-NEXT: s_setpc_b64 s[30:31]
299 ; GFX940-LABEL: zero_init_foo:
301 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
302 ; GFX940-NEXT: s_mov_b32 s0, 0
303 ; GFX940-NEXT: s_mov_b32 s1, s0
304 ; GFX940-NEXT: s_mov_b32 s2, s0
305 ; GFX940-NEXT: s_mov_b32 s3, s0
306 ; GFX940-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
307 ; GFX940-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
308 ; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:48 sc0 sc1
309 ; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:32 sc0 sc1
310 ; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:16 sc0 sc1
311 ; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], s32 sc0 sc1
312 ; GFX940-NEXT: s_waitcnt vmcnt(0)
313 ; GFX940-NEXT: s_setpc_b64 s[30:31]
315 ; GFX10-PAL-LABEL: zero_init_foo:
316 ; GFX10-PAL: ; %bb.0:
317 ; GFX10-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
318 ; GFX10-PAL-NEXT: s_mov_b32 s0, 0
319 ; GFX10-PAL-NEXT: s_mov_b32 s1, s0
320 ; GFX10-PAL-NEXT: s_mov_b32 s2, s0
321 ; GFX10-PAL-NEXT: s_mov_b32 s3, s0
322 ; GFX10-PAL-NEXT: v_mov_b32_e32 v0, s0
323 ; GFX10-PAL-NEXT: v_mov_b32_e32 v1, s1
324 ; GFX10-PAL-NEXT: v_mov_b32_e32 v2, s2
325 ; GFX10-PAL-NEXT: v_mov_b32_e32 v3, s3
326 ; GFX10-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:48
327 ; GFX10-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:32
328 ; GFX10-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:16
329 ; GFX10-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s32
330 ; GFX10-PAL-NEXT: s_setpc_b64 s[30:31]
332 ; GFX11-PAL-LABEL: zero_init_foo:
333 ; GFX11-PAL: ; %bb.0:
334 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
335 ; GFX11-PAL-NEXT: s_mov_b32 s0, 0
336 ; GFX11-PAL-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
337 ; GFX11-PAL-NEXT: s_mov_b32 s1, s0
338 ; GFX11-PAL-NEXT: s_mov_b32 s2, s0
339 ; GFX11-PAL-NEXT: s_mov_b32 s3, s0
340 ; GFX11-PAL-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
341 ; GFX11-PAL-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
342 ; GFX11-PAL-NEXT: s_clause 0x3
343 ; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], s32 offset:48
344 ; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], s32 offset:32
345 ; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], s32 offset:16
346 ; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], s32
347 ; GFX11-PAL-NEXT: s_setpc_b64 s[30:31]
349 ; GFX12-PAL-LABEL: zero_init_foo:
350 ; GFX12-PAL: ; %bb.0:
351 ; GFX12-PAL-NEXT: s_wait_loadcnt_dscnt 0x0
352 ; GFX12-PAL-NEXT: s_wait_expcnt 0x0
353 ; GFX12-PAL-NEXT: s_wait_samplecnt 0x0
354 ; GFX12-PAL-NEXT: s_wait_bvhcnt 0x0
355 ; GFX12-PAL-NEXT: s_wait_kmcnt 0x0
356 ; GFX12-PAL-NEXT: s_mov_b32 s0, 0
357 ; GFX12-PAL-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
358 ; GFX12-PAL-NEXT: s_mov_b32 s1, s0
359 ; GFX12-PAL-NEXT: s_mov_b32 s2, s0
360 ; GFX12-PAL-NEXT: s_mov_b32 s3, s0
361 ; GFX12-PAL-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
362 ; GFX12-PAL-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
363 ; GFX12-PAL-NEXT: s_clause 0x3
364 ; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], s32 offset:48
365 ; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], s32 offset:32
366 ; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], s32 offset:16
367 ; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], s32
368 ; GFX12-PAL-NEXT: s_setpc_b64 s[30:31]
369 %alloca = alloca [32 x i16], align 2, addrspace(5)
370 call void @llvm.memset.p5.i64(ptr addrspace(5) align 2 dereferenceable(64) %alloca, i8 0, i64 64, i1 false)
374 define amdgpu_kernel void @store_load_sindex_kernel(i32 %idx) {
375 ; GFX9-LABEL: store_load_sindex_kernel:
376 ; GFX9: ; %bb.0: ; %bb
377 ; GFX9-NEXT: s_load_dword s0, s[2:3], 0x24
378 ; GFX9-NEXT: s_add_u32 flat_scratch_lo, s6, s11
379 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s7, 0
380 ; GFX9-NEXT: v_mov_b32_e32 v0, 15
381 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
382 ; GFX9-NEXT: s_lshl_b32 s1, s0, 2
383 ; GFX9-NEXT: s_and_b32 s0, s0, 15
384 ; GFX9-NEXT: s_add_i32 s1, s1, 0
385 ; GFX9-NEXT: s_lshl_b32 s0, s0, 2
386 ; GFX9-NEXT: scratch_store_dword off, v0, s1
387 ; GFX9-NEXT: s_waitcnt vmcnt(0)
388 ; GFX9-NEXT: s_add_i32 s0, s0, 0
389 ; GFX9-NEXT: scratch_load_dword v0, off, s0 glc
390 ; GFX9-NEXT: s_waitcnt vmcnt(0)
391 ; GFX9-NEXT: s_endpgm
393 ; GFX10-LABEL: store_load_sindex_kernel:
394 ; GFX10: ; %bb.0: ; %bb
395 ; GFX10-NEXT: s_add_u32 s6, s6, s11
396 ; GFX10-NEXT: s_addc_u32 s7, s7, 0
397 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6
398 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7
399 ; GFX10-NEXT: s_load_dword s0, s[2:3], 0x24
400 ; GFX10-NEXT: v_mov_b32_e32 v0, 15
401 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
402 ; GFX10-NEXT: s_and_b32 s1, s0, 15
403 ; GFX10-NEXT: s_lshl_b32 s0, s0, 2
404 ; GFX10-NEXT: s_lshl_b32 s1, s1, 2
405 ; GFX10-NEXT: s_add_i32 s0, s0, 0
406 ; GFX10-NEXT: s_add_i32 s1, s1, 0
407 ; GFX10-NEXT: scratch_store_dword off, v0, s0
408 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
409 ; GFX10-NEXT: scratch_load_dword v0, off, s1 glc dlc
410 ; GFX10-NEXT: s_waitcnt vmcnt(0)
411 ; GFX10-NEXT: s_endpgm
413 ; GFX11-LABEL: store_load_sindex_kernel:
414 ; GFX11: ; %bb.0: ; %bb
415 ; GFX11-NEXT: s_load_b32 s0, s[2:3], 0x24
416 ; GFX11-NEXT: v_mov_b32_e32 v0, 15
417 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
418 ; GFX11-NEXT: s_and_b32 s1, s0, 15
419 ; GFX11-NEXT: s_lshl_b32 s0, s0, 2
420 ; GFX11-NEXT: s_lshl_b32 s1, s1, 2
421 ; GFX11-NEXT: s_add_i32 s0, s0, 0
422 ; GFX11-NEXT: s_add_i32 s1, s1, 0
423 ; GFX11-NEXT: scratch_store_b32 off, v0, s0 dlc
424 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
425 ; GFX11-NEXT: scratch_load_b32 v0, off, s1 glc dlc
426 ; GFX11-NEXT: s_waitcnt vmcnt(0)
427 ; GFX11-NEXT: s_endpgm
429 ; GFX12-LABEL: store_load_sindex_kernel:
430 ; GFX12: ; %bb.0: ; %bb
431 ; GFX12-NEXT: s_load_b32 s0, s[2:3], 0x24
432 ; GFX12-NEXT: v_mov_b32_e32 v0, 15
433 ; GFX12-NEXT: s_wait_kmcnt 0x0
434 ; GFX12-NEXT: s_and_b32 s1, s0, 15
435 ; GFX12-NEXT: s_lshl_b32 s0, s0, 2
436 ; GFX12-NEXT: s_lshl_b32 s1, s1, 2
437 ; GFX12-NEXT: s_add_co_i32 s0, s0, 0
438 ; GFX12-NEXT: s_add_co_i32 s1, s1, 0
439 ; GFX12-NEXT: scratch_store_b32 off, v0, s0 scope:SCOPE_SYS
440 ; GFX12-NEXT: s_wait_storecnt 0x0
441 ; GFX12-NEXT: scratch_load_b32 v0, off, s1 scope:SCOPE_SYS
442 ; GFX12-NEXT: s_wait_loadcnt 0x0
443 ; GFX12-NEXT: s_endpgm
445 ; GFX9-PAL-LABEL: store_load_sindex_kernel:
446 ; GFX9-PAL: ; %bb.0: ; %bb
447 ; GFX9-PAL-NEXT: s_getpc_b64 s[10:11]
448 ; GFX9-PAL-NEXT: s_mov_b32 s10, s0
449 ; GFX9-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
450 ; GFX9-PAL-NEXT: v_mov_b32_e32 v0, 15
451 ; GFX9-PAL-NEXT: s_load_dword s0, s[2:3], 0x0
452 ; GFX9-PAL-NEXT: s_waitcnt lgkmcnt(0)
453 ; GFX9-PAL-NEXT: s_and_b32 s11, s11, 0xffff
454 ; GFX9-PAL-NEXT: s_add_u32 flat_scratch_lo, s10, s9
455 ; GFX9-PAL-NEXT: s_addc_u32 flat_scratch_hi, s11, 0
456 ; GFX9-PAL-NEXT: s_lshl_b32 s1, s0, 2
457 ; GFX9-PAL-NEXT: s_and_b32 s0, s0, 15
458 ; GFX9-PAL-NEXT: s_add_i32 s1, s1, 0
459 ; GFX9-PAL-NEXT: s_lshl_b32 s0, s0, 2
460 ; GFX9-PAL-NEXT: scratch_store_dword off, v0, s1
461 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
462 ; GFX9-PAL-NEXT: s_add_i32 s0, s0, 0
463 ; GFX9-PAL-NEXT: scratch_load_dword v0, off, s0 glc
464 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
465 ; GFX9-PAL-NEXT: s_endpgm
467 ; GFX940-LABEL: store_load_sindex_kernel:
468 ; GFX940: ; %bb.0: ; %bb
469 ; GFX940-NEXT: s_load_dword s0, s[2:3], 0x24
470 ; GFX940-NEXT: v_mov_b32_e32 v0, 15
471 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
472 ; GFX940-NEXT: s_lshl_b32 s1, s0, 2
473 ; GFX940-NEXT: s_and_b32 s0, s0, 15
474 ; GFX940-NEXT: s_add_i32 s1, s1, 0
475 ; GFX940-NEXT: s_lshl_b32 s0, s0, 2
476 ; GFX940-NEXT: scratch_store_dword off, v0, s1 sc0 sc1
477 ; GFX940-NEXT: s_waitcnt vmcnt(0)
478 ; GFX940-NEXT: s_add_i32 s0, s0, 0
479 ; GFX940-NEXT: scratch_load_dword v0, off, s0 sc0 sc1
480 ; GFX940-NEXT: s_waitcnt vmcnt(0)
481 ; GFX940-NEXT: s_endpgm
483 ; GFX10-PAL-LABEL: store_load_sindex_kernel:
484 ; GFX10-PAL: ; %bb.0: ; %bb
485 ; GFX10-PAL-NEXT: s_getpc_b64 s[10:11]
486 ; GFX10-PAL-NEXT: s_mov_b32 s10, s0
487 ; GFX10-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
488 ; GFX10-PAL-NEXT: s_waitcnt lgkmcnt(0)
489 ; GFX10-PAL-NEXT: s_and_b32 s11, s11, 0xffff
490 ; GFX10-PAL-NEXT: s_add_u32 s10, s10, s9
491 ; GFX10-PAL-NEXT: s_addc_u32 s11, s11, 0
492 ; GFX10-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s10
493 ; GFX10-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11
494 ; GFX10-PAL-NEXT: s_load_dword s0, s[2:3], 0x0
495 ; GFX10-PAL-NEXT: v_mov_b32_e32 v0, 15
496 ; GFX10-PAL-NEXT: s_waitcnt lgkmcnt(0)
497 ; GFX10-PAL-NEXT: s_and_b32 s1, s0, 15
498 ; GFX10-PAL-NEXT: s_lshl_b32 s0, s0, 2
499 ; GFX10-PAL-NEXT: s_lshl_b32 s1, s1, 2
500 ; GFX10-PAL-NEXT: s_add_i32 s0, s0, 0
501 ; GFX10-PAL-NEXT: s_add_i32 s1, s1, 0
502 ; GFX10-PAL-NEXT: scratch_store_dword off, v0, s0
503 ; GFX10-PAL-NEXT: s_waitcnt_vscnt null, 0x0
504 ; GFX10-PAL-NEXT: scratch_load_dword v0, off, s1 glc dlc
505 ; GFX10-PAL-NEXT: s_waitcnt vmcnt(0)
506 ; GFX10-PAL-NEXT: s_endpgm
508 ; GFX11-PAL-LABEL: store_load_sindex_kernel:
509 ; GFX11-PAL: ; %bb.0: ; %bb
510 ; GFX11-PAL-NEXT: s_load_b32 s0, s[2:3], 0x0
511 ; GFX11-PAL-NEXT: v_mov_b32_e32 v0, 15
512 ; GFX11-PAL-NEXT: s_waitcnt lgkmcnt(0)
513 ; GFX11-PAL-NEXT: s_and_b32 s1, s0, 15
514 ; GFX11-PAL-NEXT: s_lshl_b32 s0, s0, 2
515 ; GFX11-PAL-NEXT: s_lshl_b32 s1, s1, 2
516 ; GFX11-PAL-NEXT: s_add_i32 s0, s0, 0
517 ; GFX11-PAL-NEXT: s_add_i32 s1, s1, 0
518 ; GFX11-PAL-NEXT: scratch_store_b32 off, v0, s0 dlc
519 ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0
520 ; GFX11-PAL-NEXT: scratch_load_b32 v0, off, s1 glc dlc
521 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
522 ; GFX11-PAL-NEXT: s_endpgm
524 ; GFX12-PAL-LABEL: store_load_sindex_kernel:
525 ; GFX12-PAL: ; %bb.0: ; %bb
526 ; GFX12-PAL-NEXT: s_load_b32 s0, s[2:3], 0x0
527 ; GFX12-PAL-NEXT: v_mov_b32_e32 v0, 15
528 ; GFX12-PAL-NEXT: s_wait_kmcnt 0x0
529 ; GFX12-PAL-NEXT: s_and_b32 s1, s0, 15
530 ; GFX12-PAL-NEXT: s_lshl_b32 s0, s0, 2
531 ; GFX12-PAL-NEXT: s_lshl_b32 s1, s1, 2
532 ; GFX12-PAL-NEXT: s_add_co_i32 s0, s0, 0
533 ; GFX12-PAL-NEXT: s_add_co_i32 s1, s1, 0
534 ; GFX12-PAL-NEXT: scratch_store_b32 off, v0, s0 scope:SCOPE_SYS
535 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
536 ; GFX12-PAL-NEXT: scratch_load_b32 v0, off, s1 scope:SCOPE_SYS
537 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
538 ; GFX12-PAL-NEXT: s_endpgm
540 %i = alloca [32 x float], align 4, addrspace(5)
541 %i7 = getelementptr inbounds [32 x float], ptr addrspace(5) %i, i32 0, i32 %idx
542 store volatile i32 15, ptr addrspace(5) %i7, align 4
543 %i9 = and i32 %idx, 15
544 %i10 = getelementptr inbounds [32 x float], ptr addrspace(5) %i, i32 0, i32 %i9
545 %i12 = load volatile i32, ptr addrspace(5) %i10, align 4
549 define amdgpu_ps void @store_load_sindex_foo(i32 inreg %idx) {
550 ; GFX9-LABEL: store_load_sindex_foo:
551 ; GFX9: ; %bb.0: ; %bb
552 ; GFX9-NEXT: s_add_u32 flat_scratch_lo, s0, s3
553 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s1, 0
554 ; GFX9-NEXT: s_lshl_b32 s0, s2, 2
555 ; GFX9-NEXT: s_add_i32 s0, s0, 0
556 ; GFX9-NEXT: v_mov_b32_e32 v0, 15
557 ; GFX9-NEXT: scratch_store_dword off, v0, s0
558 ; GFX9-NEXT: s_waitcnt vmcnt(0)
559 ; GFX9-NEXT: s_and_b32 s0, s2, 15
560 ; GFX9-NEXT: s_lshl_b32 s0, s0, 2
561 ; GFX9-NEXT: s_add_i32 s0, s0, 0
562 ; GFX9-NEXT: scratch_load_dword v0, off, s0 glc
563 ; GFX9-NEXT: s_waitcnt vmcnt(0)
564 ; GFX9-NEXT: s_endpgm
566 ; GFX10-LABEL: store_load_sindex_foo:
567 ; GFX10: ; %bb.0: ; %bb
568 ; GFX10-NEXT: s_add_u32 s0, s0, s3
569 ; GFX10-NEXT: s_addc_u32 s1, s1, 0
570 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s0
571 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s1
572 ; GFX10-NEXT: v_mov_b32_e32 v0, 15
573 ; GFX10-NEXT: s_and_b32 s0, s2, 15
574 ; GFX10-NEXT: s_lshl_b32 s1, s2, 2
575 ; GFX10-NEXT: s_lshl_b32 s0, s0, 2
576 ; GFX10-NEXT: s_add_i32 s1, s1, 0
577 ; GFX10-NEXT: s_add_i32 s0, s0, 0
578 ; GFX10-NEXT: scratch_store_dword off, v0, s1
579 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
580 ; GFX10-NEXT: scratch_load_dword v0, off, s0 glc dlc
581 ; GFX10-NEXT: s_waitcnt vmcnt(0)
582 ; GFX10-NEXT: s_endpgm
584 ; GFX11-LABEL: store_load_sindex_foo:
585 ; GFX11: ; %bb.0: ; %bb
586 ; GFX11-NEXT: v_mov_b32_e32 v0, 15
587 ; GFX11-NEXT: s_and_b32 s1, s0, 15
588 ; GFX11-NEXT: s_lshl_b32 s0, s0, 2
589 ; GFX11-NEXT: s_lshl_b32 s1, s1, 2
590 ; GFX11-NEXT: s_add_i32 s0, s0, 0
591 ; GFX11-NEXT: s_add_i32 s1, s1, 0
592 ; GFX11-NEXT: scratch_store_b32 off, v0, s0 dlc
593 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
594 ; GFX11-NEXT: scratch_load_b32 v0, off, s1 glc dlc
595 ; GFX11-NEXT: s_waitcnt vmcnt(0)
596 ; GFX11-NEXT: s_endpgm
598 ; GFX12-LABEL: store_load_sindex_foo:
599 ; GFX12: ; %bb.0: ; %bb
600 ; GFX12-NEXT: v_mov_b32_e32 v0, 15
601 ; GFX12-NEXT: s_and_b32 s1, s0, 15
602 ; GFX12-NEXT: s_lshl_b32 s0, s0, 2
603 ; GFX12-NEXT: s_lshl_b32 s1, s1, 2
604 ; GFX12-NEXT: s_add_co_i32 s0, s0, 0
605 ; GFX12-NEXT: s_add_co_i32 s1, s1, 0
606 ; GFX12-NEXT: scratch_store_b32 off, v0, s0 scope:SCOPE_SYS
607 ; GFX12-NEXT: s_wait_storecnt 0x0
608 ; GFX12-NEXT: scratch_load_b32 v0, off, s1 scope:SCOPE_SYS
609 ; GFX12-NEXT: s_wait_loadcnt 0x0
610 ; GFX12-NEXT: s_endpgm
612 ; GFX9-PAL-LABEL: store_load_sindex_foo:
613 ; GFX9-PAL: ; %bb.0: ; %bb
614 ; GFX9-PAL-NEXT: s_getpc_b64 s[2:3]
615 ; GFX9-PAL-NEXT: s_mov_b32 s2, s0
616 ; GFX9-PAL-NEXT: s_load_dwordx2 s[2:3], s[2:3], 0x0
617 ; GFX9-PAL-NEXT: v_mov_b32_e32 v0, 15
618 ; GFX9-PAL-NEXT: s_waitcnt lgkmcnt(0)
619 ; GFX9-PAL-NEXT: s_and_b32 s3, s3, 0xffff
620 ; GFX9-PAL-NEXT: s_add_u32 flat_scratch_lo, s2, s1
621 ; GFX9-PAL-NEXT: s_addc_u32 flat_scratch_hi, s3, 0
622 ; GFX9-PAL-NEXT: s_lshl_b32 s1, s0, 2
623 ; GFX9-PAL-NEXT: s_and_b32 s0, s0, 15
624 ; GFX9-PAL-NEXT: s_add_i32 s1, s1, 0
625 ; GFX9-PAL-NEXT: s_lshl_b32 s0, s0, 2
626 ; GFX9-PAL-NEXT: scratch_store_dword off, v0, s1
627 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
628 ; GFX9-PAL-NEXT: s_add_i32 s0, s0, 0
629 ; GFX9-PAL-NEXT: scratch_load_dword v0, off, s0 glc
630 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
631 ; GFX9-PAL-NEXT: s_endpgm
633 ; GFX940-LABEL: store_load_sindex_foo:
634 ; GFX940: ; %bb.0: ; %bb
635 ; GFX940-NEXT: s_lshl_b32 s1, s0, 2
636 ; GFX940-NEXT: s_and_b32 s0, s0, 15
637 ; GFX940-NEXT: s_add_i32 s1, s1, 0
638 ; GFX940-NEXT: v_mov_b32_e32 v0, 15
639 ; GFX940-NEXT: s_lshl_b32 s0, s0, 2
640 ; GFX940-NEXT: scratch_store_dword off, v0, s1 sc0 sc1
641 ; GFX940-NEXT: s_waitcnt vmcnt(0)
642 ; GFX940-NEXT: s_add_i32 s0, s0, 0
643 ; GFX940-NEXT: scratch_load_dword v0, off, s0 sc0 sc1
644 ; GFX940-NEXT: s_waitcnt vmcnt(0)
645 ; GFX940-NEXT: s_endpgm
647 ; GFX10-PAL-LABEL: store_load_sindex_foo:
648 ; GFX10-PAL: ; %bb.0: ; %bb
649 ; GFX10-PAL-NEXT: s_getpc_b64 s[2:3]
650 ; GFX10-PAL-NEXT: s_mov_b32 s2, s0
651 ; GFX10-PAL-NEXT: s_load_dwordx2 s[2:3], s[2:3], 0x0
652 ; GFX10-PAL-NEXT: s_waitcnt lgkmcnt(0)
653 ; GFX10-PAL-NEXT: s_and_b32 s3, s3, 0xffff
654 ; GFX10-PAL-NEXT: s_add_u32 s2, s2, s1
655 ; GFX10-PAL-NEXT: s_addc_u32 s3, s3, 0
656 ; GFX10-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s2
657 ; GFX10-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s3
658 ; GFX10-PAL-NEXT: v_mov_b32_e32 v0, 15
659 ; GFX10-PAL-NEXT: s_and_b32 s1, s0, 15
660 ; GFX10-PAL-NEXT: s_lshl_b32 s0, s0, 2
661 ; GFX10-PAL-NEXT: s_lshl_b32 s1, s1, 2
662 ; GFX10-PAL-NEXT: s_add_i32 s0, s0, 0
663 ; GFX10-PAL-NEXT: s_add_i32 s1, s1, 0
664 ; GFX10-PAL-NEXT: scratch_store_dword off, v0, s0
665 ; GFX10-PAL-NEXT: s_waitcnt_vscnt null, 0x0
666 ; GFX10-PAL-NEXT: scratch_load_dword v0, off, s1 glc dlc
667 ; GFX10-PAL-NEXT: s_waitcnt vmcnt(0)
668 ; GFX10-PAL-NEXT: s_endpgm
670 ; GFX11-PAL-LABEL: store_load_sindex_foo:
671 ; GFX11-PAL: ; %bb.0: ; %bb
672 ; GFX11-PAL-NEXT: v_mov_b32_e32 v0, 15
673 ; GFX11-PAL-NEXT: s_and_b32 s1, s0, 15
674 ; GFX11-PAL-NEXT: s_lshl_b32 s0, s0, 2
675 ; GFX11-PAL-NEXT: s_lshl_b32 s1, s1, 2
676 ; GFX11-PAL-NEXT: s_add_i32 s0, s0, 0
677 ; GFX11-PAL-NEXT: s_add_i32 s1, s1, 0
678 ; GFX11-PAL-NEXT: scratch_store_b32 off, v0, s0 dlc
679 ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0
680 ; GFX11-PAL-NEXT: scratch_load_b32 v0, off, s1 glc dlc
681 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
682 ; GFX11-PAL-NEXT: s_endpgm
684 ; GFX12-PAL-LABEL: store_load_sindex_foo:
685 ; GFX12-PAL: ; %bb.0: ; %bb
686 ; GFX12-PAL-NEXT: v_mov_b32_e32 v0, 15
687 ; GFX12-PAL-NEXT: s_and_b32 s1, s0, 15
688 ; GFX12-PAL-NEXT: s_lshl_b32 s0, s0, 2
689 ; GFX12-PAL-NEXT: s_lshl_b32 s1, s1, 2
690 ; GFX12-PAL-NEXT: s_add_co_i32 s0, s0, 0
691 ; GFX12-PAL-NEXT: s_add_co_i32 s1, s1, 0
692 ; GFX12-PAL-NEXT: scratch_store_b32 off, v0, s0 scope:SCOPE_SYS
693 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
694 ; GFX12-PAL-NEXT: scratch_load_b32 v0, off, s1 scope:SCOPE_SYS
695 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
696 ; GFX12-PAL-NEXT: s_endpgm
698 %i = alloca [32 x float], align 4, addrspace(5)
699 %i7 = getelementptr inbounds [32 x float], ptr addrspace(5) %i, i32 0, i32 %idx
700 store volatile i32 15, ptr addrspace(5) %i7, align 4
701 %i9 = and i32 %idx, 15
702 %i10 = getelementptr inbounds [32 x float], ptr addrspace(5) %i, i32 0, i32 %i9
703 %i12 = load volatile i32, ptr addrspace(5) %i10, align 4
707 define amdgpu_kernel void @store_load_vindex_kernel() {
708 ; GFX9-LABEL: store_load_vindex_kernel:
709 ; GFX9: ; %bb.0: ; %bb
710 ; GFX9-NEXT: s_add_u32 flat_scratch_lo, s6, s11
711 ; GFX9-NEXT: v_lshlrev_b32_e32 v0, 2, v0
712 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s7, 0
713 ; GFX9-NEXT: v_add_u32_e32 v1, 0, v0
714 ; GFX9-NEXT: v_mov_b32_e32 v2, 15
715 ; GFX9-NEXT: scratch_store_dword v1, v2, off
716 ; GFX9-NEXT: s_waitcnt vmcnt(0)
717 ; GFX9-NEXT: v_sub_u32_e32 v0, 0, v0
718 ; GFX9-NEXT: scratch_load_dword v0, v0, off offset:124 glc
719 ; GFX9-NEXT: s_waitcnt vmcnt(0)
720 ; GFX9-NEXT: s_endpgm
722 ; GFX10-LABEL: store_load_vindex_kernel:
723 ; GFX10: ; %bb.0: ; %bb
724 ; GFX10-NEXT: s_add_u32 s6, s6, s11
725 ; GFX10-NEXT: s_addc_u32 s7, s7, 0
726 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6
727 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7
728 ; GFX10-NEXT: v_lshlrev_b32_e32 v0, 2, v0
729 ; GFX10-NEXT: v_mov_b32_e32 v2, 15
730 ; GFX10-NEXT: v_add_nc_u32_e32 v1, 0, v0
731 ; GFX10-NEXT: v_sub_nc_u32_e32 v0, 0, v0
732 ; GFX10-NEXT: scratch_store_dword v1, v2, off
733 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
734 ; GFX10-NEXT: scratch_load_dword v0, v0, off offset:124 glc dlc
735 ; GFX10-NEXT: s_waitcnt vmcnt(0)
736 ; GFX10-NEXT: s_endpgm
738 ; GFX11-LABEL: store_load_vindex_kernel:
739 ; GFX11: ; %bb.0: ; %bb
740 ; GFX11-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_lshlrev_b32 v0, 2, v0
741 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
742 ; GFX11-NEXT: v_and_b32_e32 v0, 0xffc, v0
743 ; GFX11-NEXT: v_sub_nc_u32_e32 v2, 0, v0
744 ; GFX11-NEXT: scratch_store_b32 v0, v1, off dlc
745 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
746 ; GFX11-NEXT: scratch_load_b32 v0, v2, off offset:124 glc dlc
747 ; GFX11-NEXT: s_waitcnt vmcnt(0)
748 ; GFX11-NEXT: s_endpgm
750 ; GFX12-LABEL: store_load_vindex_kernel:
751 ; GFX12: ; %bb.0: ; %bb
752 ; GFX12-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_lshlrev_b32 v0, 2, v0
753 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
754 ; GFX12-NEXT: v_and_b32_e32 v0, 0xffc, v0
755 ; GFX12-NEXT: v_sub_nc_u32_e32 v2, 0, v0
756 ; GFX12-NEXT: scratch_store_b32 v0, v1, off scope:SCOPE_SYS
757 ; GFX12-NEXT: s_wait_storecnt 0x0
758 ; GFX12-NEXT: scratch_load_b32 v0, v2, off offset:124 scope:SCOPE_SYS
759 ; GFX12-NEXT: s_wait_loadcnt 0x0
760 ; GFX12-NEXT: s_endpgm
762 ; GFX9-PAL-LABEL: store_load_vindex_kernel:
763 ; GFX9-PAL: ; %bb.0: ; %bb
764 ; GFX9-PAL-NEXT: s_getpc_b64 s[10:11]
765 ; GFX9-PAL-NEXT: s_mov_b32 s10, s0
766 ; GFX9-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
767 ; GFX9-PAL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
768 ; GFX9-PAL-NEXT: v_add_u32_e32 v1, 0, v0
769 ; GFX9-PAL-NEXT: v_mov_b32_e32 v2, 15
770 ; GFX9-PAL-NEXT: v_sub_u32_e32 v0, 0, v0
771 ; GFX9-PAL-NEXT: s_waitcnt lgkmcnt(0)
772 ; GFX9-PAL-NEXT: s_and_b32 s11, s11, 0xffff
773 ; GFX9-PAL-NEXT: s_add_u32 flat_scratch_lo, s10, s9
774 ; GFX9-PAL-NEXT: s_addc_u32 flat_scratch_hi, s11, 0
775 ; GFX9-PAL-NEXT: scratch_store_dword v1, v2, off
776 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
777 ; GFX9-PAL-NEXT: scratch_load_dword v0, v0, off offset:124 glc
778 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
779 ; GFX9-PAL-NEXT: s_endpgm
781 ; GFX940-LABEL: store_load_vindex_kernel:
782 ; GFX940: ; %bb.0: ; %bb
783 ; GFX940-NEXT: v_lshlrev_b32_e32 v0, 2, v0
784 ; GFX940-NEXT: v_and_b32_e32 v0, 0xffc, v0
785 ; GFX940-NEXT: v_mov_b32_e32 v1, 15
786 ; GFX940-NEXT: scratch_store_dword v0, v1, off sc0 sc1
787 ; GFX940-NEXT: s_waitcnt vmcnt(0)
788 ; GFX940-NEXT: v_sub_u32_e32 v0, 0, v0
789 ; GFX940-NEXT: scratch_load_dword v0, v0, off offset:124 sc0 sc1
790 ; GFX940-NEXT: s_waitcnt vmcnt(0)
791 ; GFX940-NEXT: s_endpgm
793 ; GFX10-PAL-LABEL: store_load_vindex_kernel:
794 ; GFX10-PAL: ; %bb.0: ; %bb
795 ; GFX10-PAL-NEXT: s_getpc_b64 s[10:11]
796 ; GFX10-PAL-NEXT: s_mov_b32 s10, s0
797 ; GFX10-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
798 ; GFX10-PAL-NEXT: s_waitcnt lgkmcnt(0)
799 ; GFX10-PAL-NEXT: s_and_b32 s11, s11, 0xffff
800 ; GFX10-PAL-NEXT: s_add_u32 s10, s10, s9
801 ; GFX10-PAL-NEXT: s_addc_u32 s11, s11, 0
802 ; GFX10-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s10
803 ; GFX10-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11
804 ; GFX10-PAL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
805 ; GFX10-PAL-NEXT: v_mov_b32_e32 v2, 15
806 ; GFX10-PAL-NEXT: v_add_nc_u32_e32 v1, 0, v0
807 ; GFX10-PAL-NEXT: v_sub_nc_u32_e32 v0, 0, v0
808 ; GFX10-PAL-NEXT: scratch_store_dword v1, v2, off
809 ; GFX10-PAL-NEXT: s_waitcnt_vscnt null, 0x0
810 ; GFX10-PAL-NEXT: scratch_load_dword v0, v0, off offset:124 glc dlc
811 ; GFX10-PAL-NEXT: s_waitcnt vmcnt(0)
812 ; GFX10-PAL-NEXT: s_endpgm
814 ; GFX11-PAL-LABEL: store_load_vindex_kernel:
815 ; GFX11-PAL: ; %bb.0: ; %bb
816 ; GFX11-PAL-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_lshlrev_b32 v0, 2, v0
817 ; GFX11-PAL-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
818 ; GFX11-PAL-NEXT: v_and_b32_e32 v0, 0xffc, v0
819 ; GFX11-PAL-NEXT: v_sub_nc_u32_e32 v2, 0, v0
820 ; GFX11-PAL-NEXT: scratch_store_b32 v0, v1, off dlc
821 ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0
822 ; GFX11-PAL-NEXT: scratch_load_b32 v0, v2, off offset:124 glc dlc
823 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
824 ; GFX11-PAL-NEXT: s_endpgm
826 ; GFX12-PAL-LABEL: store_load_vindex_kernel:
827 ; GFX12-PAL: ; %bb.0: ; %bb
828 ; GFX12-PAL-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_lshlrev_b32 v0, 2, v0
829 ; GFX12-PAL-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
830 ; GFX12-PAL-NEXT: v_and_b32_e32 v0, 0xffc, v0
831 ; GFX12-PAL-NEXT: v_sub_nc_u32_e32 v2, 0, v0
832 ; GFX12-PAL-NEXT: scratch_store_b32 v0, v1, off scope:SCOPE_SYS
833 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
834 ; GFX12-PAL-NEXT: scratch_load_b32 v0, v2, off offset:124 scope:SCOPE_SYS
835 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
836 ; GFX12-PAL-NEXT: s_endpgm
838 %i = alloca [32 x float], align 4, addrspace(5)
839 %i2 = tail call i32 @llvm.amdgcn.workitem.id.x()
840 %i3 = zext i32 %i2 to i64
841 %i7 = getelementptr inbounds [32 x float], ptr addrspace(5) %i, i32 0, i32 %i2
842 store volatile i32 15, ptr addrspace(5) %i7, align 4
843 %i9 = sub nsw i32 31, %i2
844 %i10 = getelementptr inbounds [32 x float], ptr addrspace(5) %i, i32 0, i32 %i9
845 %i12 = load volatile i32, ptr addrspace(5) %i10, align 4
849 define void @store_load_vindex_foo(i32 %idx) {
850 ; GFX9-LABEL: store_load_vindex_foo:
851 ; GFX9: ; %bb.0: ; %bb
852 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
853 ; GFX9-NEXT: v_mov_b32_e32 v1, s32
854 ; GFX9-NEXT: v_lshl_add_u32 v2, v0, 2, v1
855 ; GFX9-NEXT: v_mov_b32_e32 v3, 15
856 ; GFX9-NEXT: v_and_b32_e32 v0, 15, v0
857 ; GFX9-NEXT: scratch_store_dword v2, v3, off
858 ; GFX9-NEXT: s_waitcnt vmcnt(0)
859 ; GFX9-NEXT: v_lshl_add_u32 v0, v0, 2, v1
860 ; GFX9-NEXT: scratch_load_dword v0, v0, off glc
861 ; GFX9-NEXT: s_waitcnt vmcnt(0)
862 ; GFX9-NEXT: s_setpc_b64 s[30:31]
864 ; GFX10-LABEL: store_load_vindex_foo:
865 ; GFX10: ; %bb.0: ; %bb
866 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
867 ; GFX10-NEXT: v_and_b32_e32 v1, 15, v0
868 ; GFX10-NEXT: v_lshl_add_u32 v0, v0, 2, s32
869 ; GFX10-NEXT: v_mov_b32_e32 v2, 15
870 ; GFX10-NEXT: v_lshl_add_u32 v1, v1, 2, s32
871 ; GFX10-NEXT: scratch_store_dword v0, v2, off
872 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
873 ; GFX10-NEXT: scratch_load_dword v0, v1, off glc dlc
874 ; GFX10-NEXT: s_waitcnt vmcnt(0)
875 ; GFX10-NEXT: s_setpc_b64 s[30:31]
877 ; GFX11-LABEL: store_load_vindex_foo:
878 ; GFX11: ; %bb.0: ; %bb
879 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
880 ; GFX11-NEXT: v_dual_mov_b32 v2, 15 :: v_dual_and_b32 v1, 15, v0
881 ; GFX11-NEXT: v_lshl_add_u32 v0, v0, 2, s32
882 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2)
883 ; GFX11-NEXT: v_lshlrev_b32_e32 v1, 2, v1
884 ; GFX11-NEXT: scratch_store_b32 v0, v2, off dlc
885 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
886 ; GFX11-NEXT: scratch_load_b32 v0, v1, s32 glc dlc
887 ; GFX11-NEXT: s_waitcnt vmcnt(0)
888 ; GFX11-NEXT: s_setpc_b64 s[30:31]
890 ; GFX12-LABEL: store_load_vindex_foo:
891 ; GFX12: ; %bb.0: ; %bb
892 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
893 ; GFX12-NEXT: s_wait_expcnt 0x0
894 ; GFX12-NEXT: s_wait_samplecnt 0x0
895 ; GFX12-NEXT: s_wait_bvhcnt 0x0
896 ; GFX12-NEXT: s_wait_kmcnt 0x0
897 ; GFX12-NEXT: v_dual_mov_b32 v2, 15 :: v_dual_and_b32 v1, 15, v0
898 ; GFX12-NEXT: v_lshlrev_b32_e32 v0, 2, v0
899 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2)
900 ; GFX12-NEXT: v_lshlrev_b32_e32 v1, 2, v1
901 ; GFX12-NEXT: s_wait_storecnt 0x0
902 ; GFX12-NEXT: scratch_store_b32 v0, v2, s32 scope:SCOPE_SYS
903 ; GFX12-NEXT: s_wait_storecnt 0x0
904 ; GFX12-NEXT: scratch_load_b32 v0, v1, s32 scope:SCOPE_SYS
905 ; GFX12-NEXT: s_wait_loadcnt 0x0
906 ; GFX12-NEXT: s_setpc_b64 s[30:31]
908 ; GFX9-PAL-LABEL: store_load_vindex_foo:
909 ; GFX9-PAL: ; %bb.0: ; %bb
910 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
911 ; GFX9-PAL-NEXT: v_mov_b32_e32 v1, s32
912 ; GFX9-PAL-NEXT: v_lshl_add_u32 v2, v0, 2, v1
913 ; GFX9-PAL-NEXT: v_mov_b32_e32 v3, 15
914 ; GFX9-PAL-NEXT: v_and_b32_e32 v0, 15, v0
915 ; GFX9-PAL-NEXT: scratch_store_dword v2, v3, off
916 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
917 ; GFX9-PAL-NEXT: v_lshl_add_u32 v0, v0, 2, v1
918 ; GFX9-PAL-NEXT: scratch_load_dword v0, v0, off glc
919 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
920 ; GFX9-PAL-NEXT: s_setpc_b64 s[30:31]
922 ; GFX940-LABEL: store_load_vindex_foo:
923 ; GFX940: ; %bb.0: ; %bb
924 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
925 ; GFX940-NEXT: v_mov_b32_e32 v1, s32
926 ; GFX940-NEXT: v_lshl_add_u32 v1, v0, 2, v1
927 ; GFX940-NEXT: v_mov_b32_e32 v2, 15
928 ; GFX940-NEXT: v_and_b32_e32 v0, 15, v0
929 ; GFX940-NEXT: scratch_store_dword v1, v2, off sc0 sc1
930 ; GFX940-NEXT: s_waitcnt vmcnt(0)
931 ; GFX940-NEXT: v_lshlrev_b32_e32 v0, 2, v0
932 ; GFX940-NEXT: scratch_load_dword v0, v0, s32 sc0 sc1
933 ; GFX940-NEXT: s_waitcnt vmcnt(0)
934 ; GFX940-NEXT: s_setpc_b64 s[30:31]
936 ; GFX10-PAL-LABEL: store_load_vindex_foo:
937 ; GFX10-PAL: ; %bb.0: ; %bb
938 ; GFX10-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
939 ; GFX10-PAL-NEXT: v_and_b32_e32 v1, 15, v0
940 ; GFX10-PAL-NEXT: v_lshl_add_u32 v0, v0, 2, s32
941 ; GFX10-PAL-NEXT: v_mov_b32_e32 v2, 15
942 ; GFX10-PAL-NEXT: v_lshl_add_u32 v1, v1, 2, s32
943 ; GFX10-PAL-NEXT: scratch_store_dword v0, v2, off
944 ; GFX10-PAL-NEXT: s_waitcnt_vscnt null, 0x0
945 ; GFX10-PAL-NEXT: scratch_load_dword v0, v1, off glc dlc
946 ; GFX10-PAL-NEXT: s_waitcnt vmcnt(0)
947 ; GFX10-PAL-NEXT: s_setpc_b64 s[30:31]
949 ; GFX11-PAL-LABEL: store_load_vindex_foo:
950 ; GFX11-PAL: ; %bb.0: ; %bb
951 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
952 ; GFX11-PAL-NEXT: v_dual_mov_b32 v2, 15 :: v_dual_and_b32 v1, 15, v0
953 ; GFX11-PAL-NEXT: v_lshl_add_u32 v0, v0, 2, s32
954 ; GFX11-PAL-NEXT: s_delay_alu instid0(VALU_DEP_2)
955 ; GFX11-PAL-NEXT: v_lshlrev_b32_e32 v1, 2, v1
956 ; GFX11-PAL-NEXT: scratch_store_b32 v0, v2, off dlc
957 ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0
958 ; GFX11-PAL-NEXT: scratch_load_b32 v0, v1, s32 glc dlc
959 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
960 ; GFX11-PAL-NEXT: s_setpc_b64 s[30:31]
962 ; GFX12-PAL-LABEL: store_load_vindex_foo:
963 ; GFX12-PAL: ; %bb.0: ; %bb
964 ; GFX12-PAL-NEXT: s_wait_loadcnt_dscnt 0x0
965 ; GFX12-PAL-NEXT: s_wait_expcnt 0x0
966 ; GFX12-PAL-NEXT: s_wait_samplecnt 0x0
967 ; GFX12-PAL-NEXT: s_wait_bvhcnt 0x0
968 ; GFX12-PAL-NEXT: s_wait_kmcnt 0x0
969 ; GFX12-PAL-NEXT: v_dual_mov_b32 v2, 15 :: v_dual_and_b32 v1, 15, v0
970 ; GFX12-PAL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
971 ; GFX12-PAL-NEXT: s_delay_alu instid0(VALU_DEP_2)
972 ; GFX12-PAL-NEXT: v_lshlrev_b32_e32 v1, 2, v1
973 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
974 ; GFX12-PAL-NEXT: scratch_store_b32 v0, v2, s32 scope:SCOPE_SYS
975 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
976 ; GFX12-PAL-NEXT: scratch_load_b32 v0, v1, s32 scope:SCOPE_SYS
977 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
978 ; GFX12-PAL-NEXT: s_setpc_b64 s[30:31]
980 %i = alloca [32 x float], align 4, addrspace(5)
981 %i7 = getelementptr inbounds [32 x float], ptr addrspace(5) %i, i32 0, i32 %idx
982 store volatile i32 15, ptr addrspace(5) %i7, align 4
983 %i9 = and i32 %idx, 15
984 %i10 = getelementptr inbounds [32 x float], ptr addrspace(5) %i, i32 0, i32 %i9
985 %i12 = load volatile i32, ptr addrspace(5) %i10, align 4
989 define void @private_ptr_foo(ptr addrspace(5) nocapture %arg) {
990 ; GFX9-LABEL: private_ptr_foo:
992 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
993 ; GFX9-NEXT: v_mov_b32_e32 v1, 0x41200000
994 ; GFX9-NEXT: scratch_store_dword v0, v1, off offset:4
995 ; GFX9-NEXT: s_waitcnt vmcnt(0)
996 ; GFX9-NEXT: s_setpc_b64 s[30:31]
998 ; GFX10-LABEL: private_ptr_foo:
1000 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1001 ; GFX10-NEXT: v_mov_b32_e32 v1, 0x41200000
1002 ; GFX10-NEXT: scratch_store_dword v0, v1, off offset:4
1003 ; GFX10-NEXT: s_setpc_b64 s[30:31]
1005 ; GFX11-LABEL: private_ptr_foo:
1007 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1008 ; GFX11-NEXT: v_mov_b32_e32 v1, 0x41200000
1009 ; GFX11-NEXT: scratch_store_b32 v0, v1, off offset:4
1010 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1012 ; GFX12-LABEL: private_ptr_foo:
1014 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
1015 ; GFX12-NEXT: s_wait_expcnt 0x0
1016 ; GFX12-NEXT: s_wait_samplecnt 0x0
1017 ; GFX12-NEXT: s_wait_bvhcnt 0x0
1018 ; GFX12-NEXT: s_wait_kmcnt 0x0
1019 ; GFX12-NEXT: v_mov_b32_e32 v1, 0x41200000
1020 ; GFX12-NEXT: scratch_store_b32 v0, v1, off offset:4
1021 ; GFX12-NEXT: s_setpc_b64 s[30:31]
1023 ; GFX9-PAL-LABEL: private_ptr_foo:
1024 ; GFX9-PAL: ; %bb.0:
1025 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1026 ; GFX9-PAL-NEXT: v_mov_b32_e32 v1, 0x41200000
1027 ; GFX9-PAL-NEXT: scratch_store_dword v0, v1, off offset:4
1028 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
1029 ; GFX9-PAL-NEXT: s_setpc_b64 s[30:31]
1031 ; GFX940-LABEL: private_ptr_foo:
1033 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1034 ; GFX940-NEXT: v_mov_b32_e32 v1, 0x41200000
1035 ; GFX940-NEXT: scratch_store_dword v0, v1, off offset:4 sc0 sc1
1036 ; GFX940-NEXT: s_waitcnt vmcnt(0)
1037 ; GFX940-NEXT: s_setpc_b64 s[30:31]
1039 ; GFX10-PAL-LABEL: private_ptr_foo:
1040 ; GFX10-PAL: ; %bb.0:
1041 ; GFX10-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1042 ; GFX10-PAL-NEXT: v_mov_b32_e32 v1, 0x41200000
1043 ; GFX10-PAL-NEXT: scratch_store_dword v0, v1, off offset:4
1044 ; GFX10-PAL-NEXT: s_setpc_b64 s[30:31]
1046 ; GFX11-PAL-LABEL: private_ptr_foo:
1047 ; GFX11-PAL: ; %bb.0:
1048 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1049 ; GFX11-PAL-NEXT: v_mov_b32_e32 v1, 0x41200000
1050 ; GFX11-PAL-NEXT: scratch_store_b32 v0, v1, off offset:4
1051 ; GFX11-PAL-NEXT: s_setpc_b64 s[30:31]
1053 ; GFX12-PAL-LABEL: private_ptr_foo:
1054 ; GFX12-PAL: ; %bb.0:
1055 ; GFX12-PAL-NEXT: s_wait_loadcnt_dscnt 0x0
1056 ; GFX12-PAL-NEXT: s_wait_expcnt 0x0
1057 ; GFX12-PAL-NEXT: s_wait_samplecnt 0x0
1058 ; GFX12-PAL-NEXT: s_wait_bvhcnt 0x0
1059 ; GFX12-PAL-NEXT: s_wait_kmcnt 0x0
1060 ; GFX12-PAL-NEXT: v_mov_b32_e32 v1, 0x41200000
1061 ; GFX12-PAL-NEXT: scratch_store_b32 v0, v1, off offset:4
1062 ; GFX12-PAL-NEXT: s_setpc_b64 s[30:31]
1063 %gep = getelementptr inbounds float, ptr addrspace(5) %arg, i32 1
1064 store float 1.000000e+01, ptr addrspace(5) %gep, align 4
1068 define amdgpu_kernel void @zero_init_small_offset_kernel() {
1069 ; GFX9-LABEL: zero_init_small_offset_kernel:
1071 ; GFX9-NEXT: s_add_u32 flat_scratch_lo, s6, s11
1072 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s7, 0
1073 ; GFX9-NEXT: s_mov_b32 s0, 0
1074 ; GFX9-NEXT: scratch_load_dword v0, off, s0 glc
1075 ; GFX9-NEXT: s_waitcnt vmcnt(0)
1076 ; GFX9-NEXT: s_mov_b32 s1, s0
1077 ; GFX9-NEXT: s_mov_b32 s2, s0
1078 ; GFX9-NEXT: s_mov_b32 s3, s0
1079 ; GFX9-NEXT: v_mov_b32_e32 v0, s0
1080 ; GFX9-NEXT: v_mov_b32_e32 v1, s1
1081 ; GFX9-NEXT: v_mov_b32_e32 v2, s2
1082 ; GFX9-NEXT: v_mov_b32_e32 v3, s3
1083 ; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:256
1084 ; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:272
1085 ; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:288
1086 ; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:304
1087 ; GFX9-NEXT: s_endpgm
1089 ; GFX10-LABEL: zero_init_small_offset_kernel:
1091 ; GFX10-NEXT: s_add_u32 s6, s6, s11
1092 ; GFX10-NEXT: s_addc_u32 s7, s7, 0
1093 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6
1094 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7
1095 ; GFX10-NEXT: scratch_load_dword v0, off, off glc dlc
1096 ; GFX10-NEXT: s_waitcnt vmcnt(0)
1097 ; GFX10-NEXT: s_mov_b32 s0, 0
1098 ; GFX10-NEXT: s_mov_b32 s1, s0
1099 ; GFX10-NEXT: s_mov_b32 s2, s0
1100 ; GFX10-NEXT: s_mov_b32 s3, s0
1101 ; GFX10-NEXT: v_mov_b32_e32 v0, s0
1102 ; GFX10-NEXT: v_mov_b32_e32 v1, s1
1103 ; GFX10-NEXT: v_mov_b32_e32 v2, s2
1104 ; GFX10-NEXT: v_mov_b32_e32 v3, s3
1105 ; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:256
1106 ; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:272
1107 ; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:288
1108 ; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:304
1109 ; GFX10-NEXT: s_endpgm
1111 ; GFX11-LABEL: zero_init_small_offset_kernel:
1113 ; GFX11-NEXT: scratch_load_b32 v0, off, off glc dlc
1114 ; GFX11-NEXT: s_waitcnt vmcnt(0)
1115 ; GFX11-NEXT: s_mov_b32 s0, 0
1116 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
1117 ; GFX11-NEXT: s_mov_b32 s1, s0
1118 ; GFX11-NEXT: s_mov_b32 s2, s0
1119 ; GFX11-NEXT: s_mov_b32 s3, s0
1120 ; GFX11-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
1121 ; GFX11-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
1122 ; GFX11-NEXT: s_clause 0x3
1123 ; GFX11-NEXT: scratch_store_b128 off, v[0:3], off offset:256
1124 ; GFX11-NEXT: scratch_store_b128 off, v[0:3], off offset:272
1125 ; GFX11-NEXT: scratch_store_b128 off, v[0:3], off offset:288
1126 ; GFX11-NEXT: scratch_store_b128 off, v[0:3], off offset:304
1127 ; GFX11-NEXT: s_endpgm
1129 ; GFX12-LABEL: zero_init_small_offset_kernel:
1131 ; GFX12-NEXT: scratch_load_b32 v0, off, off scope:SCOPE_SYS
1132 ; GFX12-NEXT: s_wait_loadcnt 0x0
1133 ; GFX12-NEXT: s_mov_b32 s0, 0
1134 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
1135 ; GFX12-NEXT: s_mov_b32 s1, s0
1136 ; GFX12-NEXT: s_mov_b32 s2, s0
1137 ; GFX12-NEXT: s_mov_b32 s3, s0
1138 ; GFX12-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
1139 ; GFX12-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
1140 ; GFX12-NEXT: s_clause 0x3
1141 ; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:256
1142 ; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:272
1143 ; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:288
1144 ; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:304
1145 ; GFX12-NEXT: s_endpgm
1147 ; GFX9-PAL-LABEL: zero_init_small_offset_kernel:
1148 ; GFX9-PAL: ; %bb.0:
1149 ; GFX9-PAL-NEXT: s_getpc_b64 s[10:11]
1150 ; GFX9-PAL-NEXT: s_mov_b32 s10, s0
1151 ; GFX9-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
1152 ; GFX9-PAL-NEXT: s_mov_b32 s0, 0
1153 ; GFX9-PAL-NEXT: s_mov_b32 s1, s0
1154 ; GFX9-PAL-NEXT: s_mov_b32 s2, s0
1155 ; GFX9-PAL-NEXT: s_mov_b32 s3, s0
1156 ; GFX9-PAL-NEXT: s_waitcnt lgkmcnt(0)
1157 ; GFX9-PAL-NEXT: s_and_b32 s11, s11, 0xffff
1158 ; GFX9-PAL-NEXT: s_add_u32 flat_scratch_lo, s10, s9
1159 ; GFX9-PAL-NEXT: s_addc_u32 flat_scratch_hi, s11, 0
1160 ; GFX9-PAL-NEXT: scratch_load_dword v0, off, s0 glc
1161 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
1162 ; GFX9-PAL-NEXT: v_mov_b32_e32 v0, s0
1163 ; GFX9-PAL-NEXT: v_mov_b32_e32 v1, s1
1164 ; GFX9-PAL-NEXT: v_mov_b32_e32 v2, s2
1165 ; GFX9-PAL-NEXT: v_mov_b32_e32 v3, s3
1166 ; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:256
1167 ; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:272
1168 ; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:288
1169 ; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:304
1170 ; GFX9-PAL-NEXT: s_endpgm
1172 ; GFX940-LABEL: zero_init_small_offset_kernel:
1174 ; GFX940-NEXT: scratch_load_dword v0, off, off sc0 sc1
1175 ; GFX940-NEXT: s_waitcnt vmcnt(0)
1176 ; GFX940-NEXT: s_mov_b32 s0, 0
1177 ; GFX940-NEXT: s_mov_b32 s1, s0
1178 ; GFX940-NEXT: s_mov_b32 s2, s0
1179 ; GFX940-NEXT: s_mov_b32 s3, s0
1180 ; GFX940-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
1181 ; GFX940-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
1182 ; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:256 sc0 sc1
1183 ; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:272 sc0 sc1
1184 ; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:288 sc0 sc1
1185 ; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:304 sc0 sc1
1186 ; GFX940-NEXT: s_endpgm
1188 ; GFX1010-PAL-LABEL: zero_init_small_offset_kernel:
1189 ; GFX1010-PAL: ; %bb.0:
1190 ; GFX1010-PAL-NEXT: s_getpc_b64 s[10:11]
1191 ; GFX1010-PAL-NEXT: s_mov_b32 s10, s0
1192 ; GFX1010-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
1193 ; GFX1010-PAL-NEXT: s_waitcnt lgkmcnt(0)
1194 ; GFX1010-PAL-NEXT: s_and_b32 s11, s11, 0xffff
1195 ; GFX1010-PAL-NEXT: s_add_u32 s10, s10, s9
1196 ; GFX1010-PAL-NEXT: s_addc_u32 s11, s11, 0
1197 ; GFX1010-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s10
1198 ; GFX1010-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11
1199 ; GFX1010-PAL-NEXT: s_mov_b32 s0, 0
1200 ; GFX1010-PAL-NEXT: scratch_load_dword v0, off, s0 glc dlc
1201 ; GFX1010-PAL-NEXT: s_waitcnt vmcnt(0)
1202 ; GFX1010-PAL-NEXT: s_mov_b32 s1, s0
1203 ; GFX1010-PAL-NEXT: s_mov_b32 s2, s0
1204 ; GFX1010-PAL-NEXT: s_mov_b32 s3, s0
1205 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v0, s0
1206 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v1, s1
1207 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v2, s2
1208 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v3, s3
1209 ; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:256
1210 ; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:272
1211 ; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:288
1212 ; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:304
1213 ; GFX1010-PAL-NEXT: s_endpgm
1215 ; GFX1030-PAL-LABEL: zero_init_small_offset_kernel:
1216 ; GFX1030-PAL: ; %bb.0:
1217 ; GFX1030-PAL-NEXT: s_getpc_b64 s[10:11]
1218 ; GFX1030-PAL-NEXT: s_mov_b32 s10, s0
1219 ; GFX1030-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
1220 ; GFX1030-PAL-NEXT: s_waitcnt lgkmcnt(0)
1221 ; GFX1030-PAL-NEXT: s_and_b32 s11, s11, 0xffff
1222 ; GFX1030-PAL-NEXT: s_add_u32 s10, s10, s9
1223 ; GFX1030-PAL-NEXT: s_addc_u32 s11, s11, 0
1224 ; GFX1030-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s10
1225 ; GFX1030-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11
1226 ; GFX1030-PAL-NEXT: scratch_load_dword v0, off, off glc dlc
1227 ; GFX1030-PAL-NEXT: s_waitcnt vmcnt(0)
1228 ; GFX1030-PAL-NEXT: s_mov_b32 s0, 0
1229 ; GFX1030-PAL-NEXT: s_mov_b32 s1, s0
1230 ; GFX1030-PAL-NEXT: s_mov_b32 s2, s0
1231 ; GFX1030-PAL-NEXT: s_mov_b32 s3, s0
1232 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v0, s0
1233 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v1, s1
1234 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v2, s2
1235 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v3, s3
1236 ; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:256
1237 ; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:272
1238 ; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:288
1239 ; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:304
1240 ; GFX1030-PAL-NEXT: s_endpgm
1242 ; GFX11-PAL-LABEL: zero_init_small_offset_kernel:
1243 ; GFX11-PAL: ; %bb.0:
1244 ; GFX11-PAL-NEXT: scratch_load_b32 v0, off, off glc dlc
1245 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
1246 ; GFX11-PAL-NEXT: s_mov_b32 s0, 0
1247 ; GFX11-PAL-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
1248 ; GFX11-PAL-NEXT: s_mov_b32 s1, s0
1249 ; GFX11-PAL-NEXT: s_mov_b32 s2, s0
1250 ; GFX11-PAL-NEXT: s_mov_b32 s3, s0
1251 ; GFX11-PAL-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
1252 ; GFX11-PAL-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
1253 ; GFX11-PAL-NEXT: s_clause 0x3
1254 ; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:256
1255 ; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:272
1256 ; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:288
1257 ; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:304
1258 ; GFX11-PAL-NEXT: s_endpgm
1260 ; GFX12-PAL-LABEL: zero_init_small_offset_kernel:
1261 ; GFX12-PAL: ; %bb.0:
1262 ; GFX12-PAL-NEXT: scratch_load_b32 v0, off, off scope:SCOPE_SYS
1263 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
1264 ; GFX12-PAL-NEXT: s_mov_b32 s0, 0
1265 ; GFX12-PAL-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
1266 ; GFX12-PAL-NEXT: s_mov_b32 s1, s0
1267 ; GFX12-PAL-NEXT: s_mov_b32 s2, s0
1268 ; GFX12-PAL-NEXT: s_mov_b32 s3, s0
1269 ; GFX12-PAL-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
1270 ; GFX12-PAL-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
1271 ; GFX12-PAL-NEXT: s_clause 0x3
1272 ; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:256
1273 ; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:272
1274 ; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:288
1275 ; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:304
1276 ; GFX12-PAL-NEXT: s_endpgm
1277 %padding = alloca [64 x i32], align 4, addrspace(5)
1278 %alloca = alloca [32 x i16], align 2, addrspace(5)
1279 %pad_gep = getelementptr inbounds [64 x i32], ptr addrspace(5) %padding, i32 0, i32 undef
1280 %pad_load = load volatile i32, ptr addrspace(5) %pad_gep, align 4
1281 call void @llvm.memset.p5.i64(ptr addrspace(5) align 2 dereferenceable(64) %alloca, i8 0, i64 64, i1 false)
1285 define void @zero_init_small_offset_foo() {
1286 ; GFX9-LABEL: zero_init_small_offset_foo:
1288 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1289 ; GFX9-NEXT: scratch_load_dword v0, off, s32 glc
1290 ; GFX9-NEXT: s_waitcnt vmcnt(0)
1291 ; GFX9-NEXT: s_mov_b32 s0, 0
1292 ; GFX9-NEXT: s_mov_b32 s1, s0
1293 ; GFX9-NEXT: s_mov_b32 s2, s0
1294 ; GFX9-NEXT: s_mov_b32 s3, s0
1295 ; GFX9-NEXT: v_mov_b32_e32 v0, s0
1296 ; GFX9-NEXT: v_mov_b32_e32 v1, s1
1297 ; GFX9-NEXT: v_mov_b32_e32 v2, s2
1298 ; GFX9-NEXT: v_mov_b32_e32 v3, s3
1299 ; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:256
1300 ; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:272
1301 ; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:288
1302 ; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:304
1303 ; GFX9-NEXT: s_waitcnt vmcnt(0)
1304 ; GFX9-NEXT: s_setpc_b64 s[30:31]
1306 ; GFX10-LABEL: zero_init_small_offset_foo:
1308 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1309 ; GFX10-NEXT: scratch_load_dword v0, off, s32 glc dlc
1310 ; GFX10-NEXT: s_waitcnt vmcnt(0)
1311 ; GFX10-NEXT: s_mov_b32 s0, 0
1312 ; GFX10-NEXT: s_mov_b32 s1, s0
1313 ; GFX10-NEXT: s_mov_b32 s2, s0
1314 ; GFX10-NEXT: s_mov_b32 s3, s0
1315 ; GFX10-NEXT: v_mov_b32_e32 v0, s0
1316 ; GFX10-NEXT: v_mov_b32_e32 v1, s1
1317 ; GFX10-NEXT: v_mov_b32_e32 v2, s2
1318 ; GFX10-NEXT: v_mov_b32_e32 v3, s3
1319 ; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:256
1320 ; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:272
1321 ; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:288
1322 ; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:304
1323 ; GFX10-NEXT: s_setpc_b64 s[30:31]
1325 ; GFX11-LABEL: zero_init_small_offset_foo:
1327 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1328 ; GFX11-NEXT: scratch_load_b32 v0, off, s32 glc dlc
1329 ; GFX11-NEXT: s_waitcnt vmcnt(0)
1330 ; GFX11-NEXT: s_mov_b32 s0, 0
1331 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
1332 ; GFX11-NEXT: s_mov_b32 s1, s0
1333 ; GFX11-NEXT: s_mov_b32 s2, s0
1334 ; GFX11-NEXT: s_mov_b32 s3, s0
1335 ; GFX11-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
1336 ; GFX11-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
1337 ; GFX11-NEXT: s_clause 0x3
1338 ; GFX11-NEXT: scratch_store_b128 off, v[0:3], s32 offset:256
1339 ; GFX11-NEXT: scratch_store_b128 off, v[0:3], s32 offset:272
1340 ; GFX11-NEXT: scratch_store_b128 off, v[0:3], s32 offset:288
1341 ; GFX11-NEXT: scratch_store_b128 off, v[0:3], s32 offset:304
1342 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1344 ; GFX12-LABEL: zero_init_small_offset_foo:
1346 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
1347 ; GFX12-NEXT: s_wait_expcnt 0x0
1348 ; GFX12-NEXT: s_wait_samplecnt 0x0
1349 ; GFX12-NEXT: s_wait_bvhcnt 0x0
1350 ; GFX12-NEXT: s_wait_kmcnt 0x0
1351 ; GFX12-NEXT: scratch_load_b32 v0, off, s32 scope:SCOPE_SYS
1352 ; GFX12-NEXT: s_wait_loadcnt 0x0
1353 ; GFX12-NEXT: s_mov_b32 s0, 0
1354 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
1355 ; GFX12-NEXT: s_mov_b32 s1, s0
1356 ; GFX12-NEXT: s_mov_b32 s2, s0
1357 ; GFX12-NEXT: s_mov_b32 s3, s0
1358 ; GFX12-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
1359 ; GFX12-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
1360 ; GFX12-NEXT: s_clause 0x3
1361 ; GFX12-NEXT: scratch_store_b128 off, v[0:3], s32 offset:256
1362 ; GFX12-NEXT: scratch_store_b128 off, v[0:3], s32 offset:272
1363 ; GFX12-NEXT: scratch_store_b128 off, v[0:3], s32 offset:288
1364 ; GFX12-NEXT: scratch_store_b128 off, v[0:3], s32 offset:304
1365 ; GFX12-NEXT: s_setpc_b64 s[30:31]
1367 ; GFX9-PAL-LABEL: zero_init_small_offset_foo:
1368 ; GFX9-PAL: ; %bb.0:
1369 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1370 ; GFX9-PAL-NEXT: scratch_load_dword v0, off, s32 glc
1371 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
1372 ; GFX9-PAL-NEXT: s_mov_b32 s0, 0
1373 ; GFX9-PAL-NEXT: s_mov_b32 s1, s0
1374 ; GFX9-PAL-NEXT: s_mov_b32 s2, s0
1375 ; GFX9-PAL-NEXT: s_mov_b32 s3, s0
1376 ; GFX9-PAL-NEXT: v_mov_b32_e32 v0, s0
1377 ; GFX9-PAL-NEXT: v_mov_b32_e32 v1, s1
1378 ; GFX9-PAL-NEXT: v_mov_b32_e32 v2, s2
1379 ; GFX9-PAL-NEXT: v_mov_b32_e32 v3, s3
1380 ; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:256
1381 ; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:272
1382 ; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:288
1383 ; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:304
1384 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
1385 ; GFX9-PAL-NEXT: s_setpc_b64 s[30:31]
1387 ; GFX940-LABEL: zero_init_small_offset_foo:
1389 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1390 ; GFX940-NEXT: scratch_load_dword v0, off, s32 sc0 sc1
1391 ; GFX940-NEXT: s_waitcnt vmcnt(0)
1392 ; GFX940-NEXT: s_mov_b32 s0, 0
1393 ; GFX940-NEXT: s_mov_b32 s1, s0
1394 ; GFX940-NEXT: s_mov_b32 s2, s0
1395 ; GFX940-NEXT: s_mov_b32 s3, s0
1396 ; GFX940-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
1397 ; GFX940-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
1398 ; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:256 sc0 sc1
1399 ; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:272 sc0 sc1
1400 ; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:288 sc0 sc1
1401 ; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:304 sc0 sc1
1402 ; GFX940-NEXT: s_waitcnt vmcnt(0)
1403 ; GFX940-NEXT: s_setpc_b64 s[30:31]
1405 ; GFX10-PAL-LABEL: zero_init_small_offset_foo:
1406 ; GFX10-PAL: ; %bb.0:
1407 ; GFX10-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1408 ; GFX10-PAL-NEXT: scratch_load_dword v0, off, s32 glc dlc
1409 ; GFX10-PAL-NEXT: s_waitcnt vmcnt(0)
1410 ; GFX10-PAL-NEXT: s_mov_b32 s0, 0
1411 ; GFX10-PAL-NEXT: s_mov_b32 s1, s0
1412 ; GFX10-PAL-NEXT: s_mov_b32 s2, s0
1413 ; GFX10-PAL-NEXT: s_mov_b32 s3, s0
1414 ; GFX10-PAL-NEXT: v_mov_b32_e32 v0, s0
1415 ; GFX10-PAL-NEXT: v_mov_b32_e32 v1, s1
1416 ; GFX10-PAL-NEXT: v_mov_b32_e32 v2, s2
1417 ; GFX10-PAL-NEXT: v_mov_b32_e32 v3, s3
1418 ; GFX10-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:256
1419 ; GFX10-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:272
1420 ; GFX10-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:288
1421 ; GFX10-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s32 offset:304
1422 ; GFX10-PAL-NEXT: s_setpc_b64 s[30:31]
1424 ; GFX11-PAL-LABEL: zero_init_small_offset_foo:
1425 ; GFX11-PAL: ; %bb.0:
1426 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1427 ; GFX11-PAL-NEXT: scratch_load_b32 v0, off, s32 glc dlc
1428 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
1429 ; GFX11-PAL-NEXT: s_mov_b32 s0, 0
1430 ; GFX11-PAL-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
1431 ; GFX11-PAL-NEXT: s_mov_b32 s1, s0
1432 ; GFX11-PAL-NEXT: s_mov_b32 s2, s0
1433 ; GFX11-PAL-NEXT: s_mov_b32 s3, s0
1434 ; GFX11-PAL-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
1435 ; GFX11-PAL-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
1436 ; GFX11-PAL-NEXT: s_clause 0x3
1437 ; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], s32 offset:256
1438 ; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], s32 offset:272
1439 ; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], s32 offset:288
1440 ; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], s32 offset:304
1441 ; GFX11-PAL-NEXT: s_setpc_b64 s[30:31]
1443 ; GFX12-PAL-LABEL: zero_init_small_offset_foo:
1444 ; GFX12-PAL: ; %bb.0:
1445 ; GFX12-PAL-NEXT: s_wait_loadcnt_dscnt 0x0
1446 ; GFX12-PAL-NEXT: s_wait_expcnt 0x0
1447 ; GFX12-PAL-NEXT: s_wait_samplecnt 0x0
1448 ; GFX12-PAL-NEXT: s_wait_bvhcnt 0x0
1449 ; GFX12-PAL-NEXT: s_wait_kmcnt 0x0
1450 ; GFX12-PAL-NEXT: scratch_load_b32 v0, off, s32 scope:SCOPE_SYS
1451 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
1452 ; GFX12-PAL-NEXT: s_mov_b32 s0, 0
1453 ; GFX12-PAL-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
1454 ; GFX12-PAL-NEXT: s_mov_b32 s1, s0
1455 ; GFX12-PAL-NEXT: s_mov_b32 s2, s0
1456 ; GFX12-PAL-NEXT: s_mov_b32 s3, s0
1457 ; GFX12-PAL-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
1458 ; GFX12-PAL-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
1459 ; GFX12-PAL-NEXT: s_clause 0x3
1460 ; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], s32 offset:256
1461 ; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], s32 offset:272
1462 ; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], s32 offset:288
1463 ; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], s32 offset:304
1464 ; GFX12-PAL-NEXT: s_setpc_b64 s[30:31]
1465 %padding = alloca [64 x i32], align 4, addrspace(5)
1466 %alloca = alloca [32 x i16], align 2, addrspace(5)
1467 %pad_gep = getelementptr inbounds [64 x i32], ptr addrspace(5) %padding, i32 0, i32 undef
1468 %pad_load = load volatile i32, ptr addrspace(5) %pad_gep, align 4
1469 call void @llvm.memset.p5.i64(ptr addrspace(5) align 2 dereferenceable(64) %alloca, i8 0, i64 64, i1 false)
1473 define amdgpu_kernel void @store_load_sindex_small_offset_kernel(i32 %idx) {
1474 ; GFX9-LABEL: store_load_sindex_small_offset_kernel:
1475 ; GFX9: ; %bb.0: ; %bb
1476 ; GFX9-NEXT: s_load_dword s0, s[2:3], 0x24
1477 ; GFX9-NEXT: s_add_u32 flat_scratch_lo, s6, s11
1478 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s7, 0
1479 ; GFX9-NEXT: s_mov_b32 s1, 0
1480 ; GFX9-NEXT: scratch_load_dword v0, off, s1 glc
1481 ; GFX9-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1482 ; GFX9-NEXT: s_lshl_b32 s1, s0, 2
1483 ; GFX9-NEXT: s_and_b32 s0, s0, 15
1484 ; GFX9-NEXT: v_mov_b32_e32 v0, 15
1485 ; GFX9-NEXT: s_addk_i32 s1, 0x100
1486 ; GFX9-NEXT: s_lshl_b32 s0, s0, 2
1487 ; GFX9-NEXT: scratch_store_dword off, v0, s1
1488 ; GFX9-NEXT: s_waitcnt vmcnt(0)
1489 ; GFX9-NEXT: s_addk_i32 s0, 0x100
1490 ; GFX9-NEXT: scratch_load_dword v0, off, s0 glc
1491 ; GFX9-NEXT: s_waitcnt vmcnt(0)
1492 ; GFX9-NEXT: s_endpgm
1494 ; GFX10-LABEL: store_load_sindex_small_offset_kernel:
1495 ; GFX10: ; %bb.0: ; %bb
1496 ; GFX10-NEXT: s_add_u32 s6, s6, s11
1497 ; GFX10-NEXT: s_addc_u32 s7, s7, 0
1498 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6
1499 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7
1500 ; GFX10-NEXT: s_load_dword s0, s[2:3], 0x24
1501 ; GFX10-NEXT: scratch_load_dword v0, off, off glc dlc
1502 ; GFX10-NEXT: s_waitcnt vmcnt(0)
1503 ; GFX10-NEXT: v_mov_b32_e32 v0, 15
1504 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
1505 ; GFX10-NEXT: s_and_b32 s1, s0, 15
1506 ; GFX10-NEXT: s_lshl_b32 s0, s0, 2
1507 ; GFX10-NEXT: s_lshl_b32 s1, s1, 2
1508 ; GFX10-NEXT: s_addk_i32 s0, 0x100
1509 ; GFX10-NEXT: s_addk_i32 s1, 0x100
1510 ; GFX10-NEXT: scratch_store_dword off, v0, s0
1511 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
1512 ; GFX10-NEXT: scratch_load_dword v0, off, s1 glc dlc
1513 ; GFX10-NEXT: s_waitcnt vmcnt(0)
1514 ; GFX10-NEXT: s_endpgm
1516 ; GFX11-LABEL: store_load_sindex_small_offset_kernel:
1517 ; GFX11: ; %bb.0: ; %bb
1518 ; GFX11-NEXT: s_load_b32 s0, s[2:3], 0x24
1519 ; GFX11-NEXT: scratch_load_b32 v0, off, off glc dlc
1520 ; GFX11-NEXT: s_waitcnt vmcnt(0)
1521 ; GFX11-NEXT: v_mov_b32_e32 v0, 15
1522 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
1523 ; GFX11-NEXT: s_and_b32 s1, s0, 15
1524 ; GFX11-NEXT: s_lshl_b32 s0, s0, 2
1525 ; GFX11-NEXT: s_lshl_b32 s1, s1, 2
1526 ; GFX11-NEXT: s_addk_i32 s0, 0x100
1527 ; GFX11-NEXT: s_addk_i32 s1, 0x100
1528 ; GFX11-NEXT: scratch_store_b32 off, v0, s0 dlc
1529 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
1530 ; GFX11-NEXT: scratch_load_b32 v0, off, s1 glc dlc
1531 ; GFX11-NEXT: s_waitcnt vmcnt(0)
1532 ; GFX11-NEXT: s_endpgm
1534 ; GFX12-LABEL: store_load_sindex_small_offset_kernel:
1535 ; GFX12: ; %bb.0: ; %bb
1536 ; GFX12-NEXT: s_load_b32 s0, s[2:3], 0x24
1537 ; GFX12-NEXT: scratch_load_b32 v0, off, off scope:SCOPE_SYS
1538 ; GFX12-NEXT: s_wait_loadcnt 0x0
1539 ; GFX12-NEXT: v_mov_b32_e32 v0, 15
1540 ; GFX12-NEXT: s_wait_kmcnt 0x0
1541 ; GFX12-NEXT: s_and_b32 s1, s0, 15
1542 ; GFX12-NEXT: s_lshl_b32 s0, s0, 2
1543 ; GFX12-NEXT: s_lshl_b32 s1, s1, 2
1544 ; GFX12-NEXT: s_addk_co_i32 s0, 0x100
1545 ; GFX12-NEXT: s_addk_co_i32 s1, 0x100
1546 ; GFX12-NEXT: scratch_store_b32 off, v0, s0 scope:SCOPE_SYS
1547 ; GFX12-NEXT: s_wait_storecnt 0x0
1548 ; GFX12-NEXT: scratch_load_b32 v0, off, s1 scope:SCOPE_SYS
1549 ; GFX12-NEXT: s_wait_loadcnt 0x0
1550 ; GFX12-NEXT: s_endpgm
1552 ; GFX9-PAL-LABEL: store_load_sindex_small_offset_kernel:
1553 ; GFX9-PAL: ; %bb.0: ; %bb
1554 ; GFX9-PAL-NEXT: s_getpc_b64 s[10:11]
1555 ; GFX9-PAL-NEXT: s_mov_b32 s10, s0
1556 ; GFX9-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
1557 ; GFX9-PAL-NEXT: s_mov_b32 s1, 0
1558 ; GFX9-PAL-NEXT: s_load_dword s0, s[2:3], 0x0
1559 ; GFX9-PAL-NEXT: s_waitcnt lgkmcnt(0)
1560 ; GFX9-PAL-NEXT: s_and_b32 s11, s11, 0xffff
1561 ; GFX9-PAL-NEXT: s_add_u32 flat_scratch_lo, s10, s9
1562 ; GFX9-PAL-NEXT: s_addc_u32 flat_scratch_hi, s11, 0
1563 ; GFX9-PAL-NEXT: scratch_load_dword v0, off, s1 glc
1564 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
1565 ; GFX9-PAL-NEXT: s_lshl_b32 s1, s0, 2
1566 ; GFX9-PAL-NEXT: s_and_b32 s0, s0, 15
1567 ; GFX9-PAL-NEXT: v_mov_b32_e32 v0, 15
1568 ; GFX9-PAL-NEXT: s_addk_i32 s1, 0x100
1569 ; GFX9-PAL-NEXT: s_lshl_b32 s0, s0, 2
1570 ; GFX9-PAL-NEXT: scratch_store_dword off, v0, s1
1571 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
1572 ; GFX9-PAL-NEXT: s_addk_i32 s0, 0x100
1573 ; GFX9-PAL-NEXT: scratch_load_dword v0, off, s0 glc
1574 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
1575 ; GFX9-PAL-NEXT: s_endpgm
1577 ; GFX940-LABEL: store_load_sindex_small_offset_kernel:
1578 ; GFX940: ; %bb.0: ; %bb
1579 ; GFX940-NEXT: s_load_dword s0, s[2:3], 0x24
1580 ; GFX940-NEXT: scratch_load_dword v0, off, off sc0 sc1
1581 ; GFX940-NEXT: s_waitcnt vmcnt(0)
1582 ; GFX940-NEXT: v_mov_b32_e32 v0, 15
1583 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
1584 ; GFX940-NEXT: s_lshl_b32 s1, s0, 2
1585 ; GFX940-NEXT: s_and_b32 s0, s0, 15
1586 ; GFX940-NEXT: s_addk_i32 s1, 0x100
1587 ; GFX940-NEXT: s_lshl_b32 s0, s0, 2
1588 ; GFX940-NEXT: scratch_store_dword off, v0, s1 sc0 sc1
1589 ; GFX940-NEXT: s_waitcnt vmcnt(0)
1590 ; GFX940-NEXT: s_addk_i32 s0, 0x100
1591 ; GFX940-NEXT: scratch_load_dword v0, off, s0 sc0 sc1
1592 ; GFX940-NEXT: s_waitcnt vmcnt(0)
1593 ; GFX940-NEXT: s_endpgm
1595 ; GFX1010-PAL-LABEL: store_load_sindex_small_offset_kernel:
1596 ; GFX1010-PAL: ; %bb.0: ; %bb
1597 ; GFX1010-PAL-NEXT: s_getpc_b64 s[10:11]
1598 ; GFX1010-PAL-NEXT: s_mov_b32 s10, s0
1599 ; GFX1010-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
1600 ; GFX1010-PAL-NEXT: s_waitcnt lgkmcnt(0)
1601 ; GFX1010-PAL-NEXT: s_and_b32 s11, s11, 0xffff
1602 ; GFX1010-PAL-NEXT: s_add_u32 s10, s10, s9
1603 ; GFX1010-PAL-NEXT: s_addc_u32 s11, s11, 0
1604 ; GFX1010-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s10
1605 ; GFX1010-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11
1606 ; GFX1010-PAL-NEXT: s_load_dword s0, s[2:3], 0x0
1607 ; GFX1010-PAL-NEXT: s_mov_b32 s1, 0
1608 ; GFX1010-PAL-NEXT: scratch_load_dword v0, off, s1 glc dlc
1609 ; GFX1010-PAL-NEXT: s_waitcnt vmcnt(0)
1610 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v0, 15
1611 ; GFX1010-PAL-NEXT: s_waitcnt lgkmcnt(0)
1612 ; GFX1010-PAL-NEXT: s_and_b32 s1, s0, 15
1613 ; GFX1010-PAL-NEXT: s_lshl_b32 s0, s0, 2
1614 ; GFX1010-PAL-NEXT: s_lshl_b32 s1, s1, 2
1615 ; GFX1010-PAL-NEXT: s_addk_i32 s0, 0x100
1616 ; GFX1010-PAL-NEXT: s_addk_i32 s1, 0x100
1617 ; GFX1010-PAL-NEXT: scratch_store_dword off, v0, s0
1618 ; GFX1010-PAL-NEXT: s_waitcnt_vscnt null, 0x0
1619 ; GFX1010-PAL-NEXT: scratch_load_dword v0, off, s1 glc dlc
1620 ; GFX1010-PAL-NEXT: s_waitcnt vmcnt(0)
1621 ; GFX1010-PAL-NEXT: s_endpgm
1623 ; GFX1030-PAL-LABEL: store_load_sindex_small_offset_kernel:
1624 ; GFX1030-PAL: ; %bb.0: ; %bb
1625 ; GFX1030-PAL-NEXT: s_getpc_b64 s[10:11]
1626 ; GFX1030-PAL-NEXT: s_mov_b32 s10, s0
1627 ; GFX1030-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
1628 ; GFX1030-PAL-NEXT: s_waitcnt lgkmcnt(0)
1629 ; GFX1030-PAL-NEXT: s_and_b32 s11, s11, 0xffff
1630 ; GFX1030-PAL-NEXT: s_add_u32 s10, s10, s9
1631 ; GFX1030-PAL-NEXT: s_addc_u32 s11, s11, 0
1632 ; GFX1030-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s10
1633 ; GFX1030-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11
1634 ; GFX1030-PAL-NEXT: s_load_dword s0, s[2:3], 0x0
1635 ; GFX1030-PAL-NEXT: scratch_load_dword v0, off, off glc dlc
1636 ; GFX1030-PAL-NEXT: s_waitcnt vmcnt(0)
1637 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v0, 15
1638 ; GFX1030-PAL-NEXT: s_waitcnt lgkmcnt(0)
1639 ; GFX1030-PAL-NEXT: s_and_b32 s1, s0, 15
1640 ; GFX1030-PAL-NEXT: s_lshl_b32 s0, s0, 2
1641 ; GFX1030-PAL-NEXT: s_lshl_b32 s1, s1, 2
1642 ; GFX1030-PAL-NEXT: s_addk_i32 s0, 0x100
1643 ; GFX1030-PAL-NEXT: s_addk_i32 s1, 0x100
1644 ; GFX1030-PAL-NEXT: scratch_store_dword off, v0, s0
1645 ; GFX1030-PAL-NEXT: s_waitcnt_vscnt null, 0x0
1646 ; GFX1030-PAL-NEXT: scratch_load_dword v0, off, s1 glc dlc
1647 ; GFX1030-PAL-NEXT: s_waitcnt vmcnt(0)
1648 ; GFX1030-PAL-NEXT: s_endpgm
1650 ; GFX11-PAL-LABEL: store_load_sindex_small_offset_kernel:
1651 ; GFX11-PAL: ; %bb.0: ; %bb
1652 ; GFX11-PAL-NEXT: s_load_b32 s0, s[2:3], 0x0
1653 ; GFX11-PAL-NEXT: scratch_load_b32 v0, off, off glc dlc
1654 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
1655 ; GFX11-PAL-NEXT: v_mov_b32_e32 v0, 15
1656 ; GFX11-PAL-NEXT: s_waitcnt lgkmcnt(0)
1657 ; GFX11-PAL-NEXT: s_and_b32 s1, s0, 15
1658 ; GFX11-PAL-NEXT: s_lshl_b32 s0, s0, 2
1659 ; GFX11-PAL-NEXT: s_lshl_b32 s1, s1, 2
1660 ; GFX11-PAL-NEXT: s_addk_i32 s0, 0x100
1661 ; GFX11-PAL-NEXT: s_addk_i32 s1, 0x100
1662 ; GFX11-PAL-NEXT: scratch_store_b32 off, v0, s0 dlc
1663 ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0
1664 ; GFX11-PAL-NEXT: scratch_load_b32 v0, off, s1 glc dlc
1665 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
1666 ; GFX11-PAL-NEXT: s_endpgm
1668 ; GFX12-PAL-LABEL: store_load_sindex_small_offset_kernel:
1669 ; GFX12-PAL: ; %bb.0: ; %bb
1670 ; GFX12-PAL-NEXT: s_load_b32 s0, s[2:3], 0x0
1671 ; GFX12-PAL-NEXT: scratch_load_b32 v0, off, off scope:SCOPE_SYS
1672 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
1673 ; GFX12-PAL-NEXT: v_mov_b32_e32 v0, 15
1674 ; GFX12-PAL-NEXT: s_wait_kmcnt 0x0
1675 ; GFX12-PAL-NEXT: s_and_b32 s1, s0, 15
1676 ; GFX12-PAL-NEXT: s_lshl_b32 s0, s0, 2
1677 ; GFX12-PAL-NEXT: s_lshl_b32 s1, s1, 2
1678 ; GFX12-PAL-NEXT: s_addk_co_i32 s0, 0x100
1679 ; GFX12-PAL-NEXT: s_addk_co_i32 s1, 0x100
1680 ; GFX12-PAL-NEXT: scratch_store_b32 off, v0, s0 scope:SCOPE_SYS
1681 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
1682 ; GFX12-PAL-NEXT: scratch_load_b32 v0, off, s1 scope:SCOPE_SYS
1683 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
1684 ; GFX12-PAL-NEXT: s_endpgm
1686 %padding = alloca [64 x i32], align 4, addrspace(5)
1687 %i = alloca [32 x float], align 4, addrspace(5)
1688 %pad_gep = getelementptr inbounds [64 x i32], ptr addrspace(5) %padding, i32 0, i32 undef
1689 %pad_load = load volatile i32, ptr addrspace(5) %pad_gep, align 4
1690 %i7 = getelementptr inbounds [32 x float], ptr addrspace(5) %i, i32 0, i32 %idx
1691 store volatile i32 15, ptr addrspace(5) %i7, align 4
1692 %i9 = and i32 %idx, 15
1693 %i10 = getelementptr inbounds [32 x float], ptr addrspace(5) %i, i32 0, i32 %i9
1694 %i12 = load volatile i32, ptr addrspace(5) %i10, align 4
1698 define amdgpu_ps void @store_load_sindex_small_offset_foo(i32 inreg %idx) {
1699 ; GFX9-LABEL: store_load_sindex_small_offset_foo:
1700 ; GFX9: ; %bb.0: ; %bb
1701 ; GFX9-NEXT: s_add_u32 flat_scratch_lo, s0, s3
1702 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s1, 0
1703 ; GFX9-NEXT: s_mov_b32 s0, 0
1704 ; GFX9-NEXT: scratch_load_dword v0, off, s0 glc
1705 ; GFX9-NEXT: s_waitcnt vmcnt(0)
1706 ; GFX9-NEXT: s_lshl_b32 s0, s2, 2
1707 ; GFX9-NEXT: s_addk_i32 s0, 0x100
1708 ; GFX9-NEXT: v_mov_b32_e32 v0, 15
1709 ; GFX9-NEXT: scratch_store_dword off, v0, s0
1710 ; GFX9-NEXT: s_waitcnt vmcnt(0)
1711 ; GFX9-NEXT: s_and_b32 s0, s2, 15
1712 ; GFX9-NEXT: s_lshl_b32 s0, s0, 2
1713 ; GFX9-NEXT: s_addk_i32 s0, 0x100
1714 ; GFX9-NEXT: scratch_load_dword v0, off, s0 glc
1715 ; GFX9-NEXT: s_waitcnt vmcnt(0)
1716 ; GFX9-NEXT: s_endpgm
1718 ; GFX10-LABEL: store_load_sindex_small_offset_foo:
1719 ; GFX10: ; %bb.0: ; %bb
1720 ; GFX10-NEXT: s_add_u32 s0, s0, s3
1721 ; GFX10-NEXT: s_addc_u32 s1, s1, 0
1722 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s0
1723 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s1
1724 ; GFX10-NEXT: scratch_load_dword v0, off, off glc dlc
1725 ; GFX10-NEXT: s_waitcnt vmcnt(0)
1726 ; GFX10-NEXT: v_mov_b32_e32 v0, 15
1727 ; GFX10-NEXT: s_and_b32 s0, s2, 15
1728 ; GFX10-NEXT: s_lshl_b32 s1, s2, 2
1729 ; GFX10-NEXT: s_lshl_b32 s0, s0, 2
1730 ; GFX10-NEXT: s_addk_i32 s1, 0x100
1731 ; GFX10-NEXT: s_addk_i32 s0, 0x100
1732 ; GFX10-NEXT: scratch_store_dword off, v0, s1
1733 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
1734 ; GFX10-NEXT: scratch_load_dword v0, off, s0 glc dlc
1735 ; GFX10-NEXT: s_waitcnt vmcnt(0)
1736 ; GFX10-NEXT: s_endpgm
1738 ; GFX11-LABEL: store_load_sindex_small_offset_foo:
1739 ; GFX11: ; %bb.0: ; %bb
1740 ; GFX11-NEXT: scratch_load_b32 v0, off, off glc dlc
1741 ; GFX11-NEXT: s_waitcnt vmcnt(0)
1742 ; GFX11-NEXT: v_mov_b32_e32 v0, 15
1743 ; GFX11-NEXT: s_and_b32 s1, s0, 15
1744 ; GFX11-NEXT: s_lshl_b32 s0, s0, 2
1745 ; GFX11-NEXT: s_lshl_b32 s1, s1, 2
1746 ; GFX11-NEXT: s_addk_i32 s0, 0x100
1747 ; GFX11-NEXT: s_addk_i32 s1, 0x100
1748 ; GFX11-NEXT: scratch_store_b32 off, v0, s0 dlc
1749 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
1750 ; GFX11-NEXT: scratch_load_b32 v0, off, s1 glc dlc
1751 ; GFX11-NEXT: s_waitcnt vmcnt(0)
1752 ; GFX11-NEXT: s_endpgm
1754 ; GFX12-LABEL: store_load_sindex_small_offset_foo:
1755 ; GFX12: ; %bb.0: ; %bb
1756 ; GFX12-NEXT: scratch_load_b32 v0, off, off scope:SCOPE_SYS
1757 ; GFX12-NEXT: s_wait_loadcnt 0x0
1758 ; GFX12-NEXT: v_mov_b32_e32 v0, 15
1759 ; GFX12-NEXT: s_and_b32 s1, s0, 15
1760 ; GFX12-NEXT: s_lshl_b32 s0, s0, 2
1761 ; GFX12-NEXT: s_lshl_b32 s1, s1, 2
1762 ; GFX12-NEXT: s_addk_co_i32 s0, 0x100
1763 ; GFX12-NEXT: s_addk_co_i32 s1, 0x100
1764 ; GFX12-NEXT: scratch_store_b32 off, v0, s0 scope:SCOPE_SYS
1765 ; GFX12-NEXT: s_wait_storecnt 0x0
1766 ; GFX12-NEXT: scratch_load_b32 v0, off, s1 scope:SCOPE_SYS
1767 ; GFX12-NEXT: s_wait_loadcnt 0x0
1768 ; GFX12-NEXT: s_endpgm
1770 ; GFX9-PAL-LABEL: store_load_sindex_small_offset_foo:
1771 ; GFX9-PAL: ; %bb.0: ; %bb
1772 ; GFX9-PAL-NEXT: s_getpc_b64 s[2:3]
1773 ; GFX9-PAL-NEXT: s_mov_b32 s2, s0
1774 ; GFX9-PAL-NEXT: s_load_dwordx2 s[2:3], s[2:3], 0x0
1775 ; GFX9-PAL-NEXT: s_waitcnt lgkmcnt(0)
1776 ; GFX9-PAL-NEXT: s_and_b32 s3, s3, 0xffff
1777 ; GFX9-PAL-NEXT: s_add_u32 flat_scratch_lo, s2, s1
1778 ; GFX9-PAL-NEXT: s_addc_u32 flat_scratch_hi, s3, 0
1779 ; GFX9-PAL-NEXT: s_mov_b32 s1, 0
1780 ; GFX9-PAL-NEXT: scratch_load_dword v0, off, s1 glc
1781 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
1782 ; GFX9-PAL-NEXT: s_lshl_b32 s1, s0, 2
1783 ; GFX9-PAL-NEXT: s_and_b32 s0, s0, 15
1784 ; GFX9-PAL-NEXT: s_addk_i32 s1, 0x100
1785 ; GFX9-PAL-NEXT: v_mov_b32_e32 v0, 15
1786 ; GFX9-PAL-NEXT: s_lshl_b32 s0, s0, 2
1787 ; GFX9-PAL-NEXT: scratch_store_dword off, v0, s1
1788 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
1789 ; GFX9-PAL-NEXT: s_addk_i32 s0, 0x100
1790 ; GFX9-PAL-NEXT: scratch_load_dword v0, off, s0 glc
1791 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
1792 ; GFX9-PAL-NEXT: s_endpgm
1794 ; GFX940-LABEL: store_load_sindex_small_offset_foo:
1795 ; GFX940: ; %bb.0: ; %bb
1796 ; GFX940-NEXT: scratch_load_dword v0, off, off sc0 sc1
1797 ; GFX940-NEXT: s_waitcnt vmcnt(0)
1798 ; GFX940-NEXT: s_lshl_b32 s1, s0, 2
1799 ; GFX940-NEXT: s_and_b32 s0, s0, 15
1800 ; GFX940-NEXT: s_addk_i32 s1, 0x100
1801 ; GFX940-NEXT: v_mov_b32_e32 v0, 15
1802 ; GFX940-NEXT: s_lshl_b32 s0, s0, 2
1803 ; GFX940-NEXT: scratch_store_dword off, v0, s1 sc0 sc1
1804 ; GFX940-NEXT: s_waitcnt vmcnt(0)
1805 ; GFX940-NEXT: s_addk_i32 s0, 0x100
1806 ; GFX940-NEXT: scratch_load_dword v0, off, s0 sc0 sc1
1807 ; GFX940-NEXT: s_waitcnt vmcnt(0)
1808 ; GFX940-NEXT: s_endpgm
1810 ; GFX1010-PAL-LABEL: store_load_sindex_small_offset_foo:
1811 ; GFX1010-PAL: ; %bb.0: ; %bb
1812 ; GFX1010-PAL-NEXT: s_getpc_b64 s[2:3]
1813 ; GFX1010-PAL-NEXT: s_mov_b32 s2, s0
1814 ; GFX1010-PAL-NEXT: s_load_dwordx2 s[2:3], s[2:3], 0x0
1815 ; GFX1010-PAL-NEXT: s_waitcnt lgkmcnt(0)
1816 ; GFX1010-PAL-NEXT: s_and_b32 s3, s3, 0xffff
1817 ; GFX1010-PAL-NEXT: s_add_u32 s2, s2, s1
1818 ; GFX1010-PAL-NEXT: s_addc_u32 s3, s3, 0
1819 ; GFX1010-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s2
1820 ; GFX1010-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s3
1821 ; GFX1010-PAL-NEXT: s_mov_b32 s1, 0
1822 ; GFX1010-PAL-NEXT: scratch_load_dword v0, off, s1 glc dlc
1823 ; GFX1010-PAL-NEXT: s_waitcnt vmcnt(0)
1824 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v0, 15
1825 ; GFX1010-PAL-NEXT: s_and_b32 s1, s0, 15
1826 ; GFX1010-PAL-NEXT: s_lshl_b32 s0, s0, 2
1827 ; GFX1010-PAL-NEXT: s_lshl_b32 s1, s1, 2
1828 ; GFX1010-PAL-NEXT: s_addk_i32 s0, 0x100
1829 ; GFX1010-PAL-NEXT: s_addk_i32 s1, 0x100
1830 ; GFX1010-PAL-NEXT: scratch_store_dword off, v0, s0
1831 ; GFX1010-PAL-NEXT: s_waitcnt_vscnt null, 0x0
1832 ; GFX1010-PAL-NEXT: scratch_load_dword v0, off, s1 glc dlc
1833 ; GFX1010-PAL-NEXT: s_waitcnt vmcnt(0)
1834 ; GFX1010-PAL-NEXT: s_endpgm
1836 ; GFX1030-PAL-LABEL: store_load_sindex_small_offset_foo:
1837 ; GFX1030-PAL: ; %bb.0: ; %bb
1838 ; GFX1030-PAL-NEXT: s_getpc_b64 s[2:3]
1839 ; GFX1030-PAL-NEXT: s_mov_b32 s2, s0
1840 ; GFX1030-PAL-NEXT: s_load_dwordx2 s[2:3], s[2:3], 0x0
1841 ; GFX1030-PAL-NEXT: s_waitcnt lgkmcnt(0)
1842 ; GFX1030-PAL-NEXT: s_and_b32 s3, s3, 0xffff
1843 ; GFX1030-PAL-NEXT: s_add_u32 s2, s2, s1
1844 ; GFX1030-PAL-NEXT: s_addc_u32 s3, s3, 0
1845 ; GFX1030-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s2
1846 ; GFX1030-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s3
1847 ; GFX1030-PAL-NEXT: scratch_load_dword v0, off, off glc dlc
1848 ; GFX1030-PAL-NEXT: s_waitcnt vmcnt(0)
1849 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v0, 15
1850 ; GFX1030-PAL-NEXT: s_and_b32 s1, s0, 15
1851 ; GFX1030-PAL-NEXT: s_lshl_b32 s0, s0, 2
1852 ; GFX1030-PAL-NEXT: s_lshl_b32 s1, s1, 2
1853 ; GFX1030-PAL-NEXT: s_addk_i32 s0, 0x100
1854 ; GFX1030-PAL-NEXT: s_addk_i32 s1, 0x100
1855 ; GFX1030-PAL-NEXT: scratch_store_dword off, v0, s0
1856 ; GFX1030-PAL-NEXT: s_waitcnt_vscnt null, 0x0
1857 ; GFX1030-PAL-NEXT: scratch_load_dword v0, off, s1 glc dlc
1858 ; GFX1030-PAL-NEXT: s_waitcnt vmcnt(0)
1859 ; GFX1030-PAL-NEXT: s_endpgm
1861 ; GFX11-PAL-LABEL: store_load_sindex_small_offset_foo:
1862 ; GFX11-PAL: ; %bb.0: ; %bb
1863 ; GFX11-PAL-NEXT: scratch_load_b32 v0, off, off glc dlc
1864 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
1865 ; GFX11-PAL-NEXT: v_mov_b32_e32 v0, 15
1866 ; GFX11-PAL-NEXT: s_and_b32 s1, s0, 15
1867 ; GFX11-PAL-NEXT: s_lshl_b32 s0, s0, 2
1868 ; GFX11-PAL-NEXT: s_lshl_b32 s1, s1, 2
1869 ; GFX11-PAL-NEXT: s_addk_i32 s0, 0x100
1870 ; GFX11-PAL-NEXT: s_addk_i32 s1, 0x100
1871 ; GFX11-PAL-NEXT: scratch_store_b32 off, v0, s0 dlc
1872 ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0
1873 ; GFX11-PAL-NEXT: scratch_load_b32 v0, off, s1 glc dlc
1874 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
1875 ; GFX11-PAL-NEXT: s_endpgm
1877 ; GFX12-PAL-LABEL: store_load_sindex_small_offset_foo:
1878 ; GFX12-PAL: ; %bb.0: ; %bb
1879 ; GFX12-PAL-NEXT: scratch_load_b32 v0, off, off scope:SCOPE_SYS
1880 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
1881 ; GFX12-PAL-NEXT: v_mov_b32_e32 v0, 15
1882 ; GFX12-PAL-NEXT: s_and_b32 s1, s0, 15
1883 ; GFX12-PAL-NEXT: s_lshl_b32 s0, s0, 2
1884 ; GFX12-PAL-NEXT: s_lshl_b32 s1, s1, 2
1885 ; GFX12-PAL-NEXT: s_addk_co_i32 s0, 0x100
1886 ; GFX12-PAL-NEXT: s_addk_co_i32 s1, 0x100
1887 ; GFX12-PAL-NEXT: scratch_store_b32 off, v0, s0 scope:SCOPE_SYS
1888 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
1889 ; GFX12-PAL-NEXT: scratch_load_b32 v0, off, s1 scope:SCOPE_SYS
1890 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
1891 ; GFX12-PAL-NEXT: s_endpgm
1893 %padding = alloca [64 x i32], align 4, addrspace(5)
1894 %i = alloca [32 x float], align 4, addrspace(5)
1895 %pad_gep = getelementptr inbounds [64 x i32], ptr addrspace(5) %padding, i32 0, i32 undef
1896 %pad_load = load volatile i32, ptr addrspace(5) %pad_gep, align 4
1897 %i7 = getelementptr inbounds [32 x float], ptr addrspace(5) %i, i32 0, i32 %idx
1898 store volatile i32 15, ptr addrspace(5) %i7, align 4
1899 %i9 = and i32 %idx, 15
1900 %i10 = getelementptr inbounds [32 x float], ptr addrspace(5) %i, i32 0, i32 %i9
1901 %i12 = load volatile i32, ptr addrspace(5) %i10, align 4
1905 define amdgpu_kernel void @store_load_vindex_small_offset_kernel() {
1906 ; GFX9-LABEL: store_load_vindex_small_offset_kernel:
1907 ; GFX9: ; %bb.0: ; %bb
1908 ; GFX9-NEXT: s_add_u32 flat_scratch_lo, s6, s11
1909 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s7, 0
1910 ; GFX9-NEXT: s_mov_b32 s0, 0
1911 ; GFX9-NEXT: scratch_load_dword v1, off, s0 glc
1912 ; GFX9-NEXT: s_waitcnt vmcnt(0)
1913 ; GFX9-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1914 ; GFX9-NEXT: v_add_u32_e32 v1, 0x100, v0
1915 ; GFX9-NEXT: v_mov_b32_e32 v2, 15
1916 ; GFX9-NEXT: scratch_store_dword v1, v2, off
1917 ; GFX9-NEXT: s_waitcnt vmcnt(0)
1918 ; GFX9-NEXT: v_sub_u32_e32 v0, 0x100, v0
1919 ; GFX9-NEXT: scratch_load_dword v0, v0, off offset:124 glc
1920 ; GFX9-NEXT: s_waitcnt vmcnt(0)
1921 ; GFX9-NEXT: s_endpgm
1923 ; GFX10-LABEL: store_load_vindex_small_offset_kernel:
1924 ; GFX10: ; %bb.0: ; %bb
1925 ; GFX10-NEXT: s_add_u32 s6, s6, s11
1926 ; GFX10-NEXT: s_addc_u32 s7, s7, 0
1927 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6
1928 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7
1929 ; GFX10-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1930 ; GFX10-NEXT: v_mov_b32_e32 v2, 15
1931 ; GFX10-NEXT: scratch_load_dword v3, off, off glc dlc
1932 ; GFX10-NEXT: s_waitcnt vmcnt(0)
1933 ; GFX10-NEXT: v_add_nc_u32_e32 v1, 0x100, v0
1934 ; GFX10-NEXT: v_sub_nc_u32_e32 v0, 0x100, v0
1935 ; GFX10-NEXT: scratch_store_dword v1, v2, off
1936 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
1937 ; GFX10-NEXT: scratch_load_dword v0, v0, off offset:124 glc dlc
1938 ; GFX10-NEXT: s_waitcnt vmcnt(0)
1939 ; GFX10-NEXT: s_endpgm
1941 ; GFX11-LABEL: store_load_vindex_small_offset_kernel:
1942 ; GFX11: ; %bb.0: ; %bb
1943 ; GFX11-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_lshlrev_b32 v0, 2, v0
1944 ; GFX11-NEXT: scratch_load_b32 v3, off, off glc dlc
1945 ; GFX11-NEXT: s_waitcnt vmcnt(0)
1946 ; GFX11-NEXT: v_and_b32_e32 v0, 0xffc, v0
1947 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
1948 ; GFX11-NEXT: v_sub_nc_u32_e32 v2, 0x100, v0
1949 ; GFX11-NEXT: scratch_store_b32 v0, v1, off offset:256 dlc
1950 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
1951 ; GFX11-NEXT: scratch_load_b32 v0, v2, off offset:124 glc dlc
1952 ; GFX11-NEXT: s_waitcnt vmcnt(0)
1953 ; GFX11-NEXT: s_endpgm
1955 ; GFX12-LABEL: store_load_vindex_small_offset_kernel:
1956 ; GFX12: ; %bb.0: ; %bb
1957 ; GFX12-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_lshlrev_b32 v0, 2, v0
1958 ; GFX12-NEXT: scratch_load_b32 v3, off, off scope:SCOPE_SYS
1959 ; GFX12-NEXT: s_wait_loadcnt 0x0
1960 ; GFX12-NEXT: v_and_b32_e32 v0, 0xffc, v0
1961 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
1962 ; GFX12-NEXT: v_sub_nc_u32_e32 v2, 0x100, v0
1963 ; GFX12-NEXT: scratch_store_b32 v0, v1, off offset:256 scope:SCOPE_SYS
1964 ; GFX12-NEXT: s_wait_storecnt 0x0
1965 ; GFX12-NEXT: scratch_load_b32 v0, v2, off offset:124 scope:SCOPE_SYS
1966 ; GFX12-NEXT: s_wait_loadcnt 0x0
1967 ; GFX12-NEXT: s_endpgm
1969 ; GFX9-PAL-LABEL: store_load_vindex_small_offset_kernel:
1970 ; GFX9-PAL: ; %bb.0: ; %bb
1971 ; GFX9-PAL-NEXT: s_getpc_b64 s[10:11]
1972 ; GFX9-PAL-NEXT: s_mov_b32 s10, s0
1973 ; GFX9-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
1974 ; GFX9-PAL-NEXT: s_mov_b32 s0, 0
1975 ; GFX9-PAL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1976 ; GFX9-PAL-NEXT: v_mov_b32_e32 v2, 15
1977 ; GFX9-PAL-NEXT: s_waitcnt lgkmcnt(0)
1978 ; GFX9-PAL-NEXT: s_and_b32 s11, s11, 0xffff
1979 ; GFX9-PAL-NEXT: s_add_u32 flat_scratch_lo, s10, s9
1980 ; GFX9-PAL-NEXT: s_addc_u32 flat_scratch_hi, s11, 0
1981 ; GFX9-PAL-NEXT: scratch_load_dword v1, off, s0 glc
1982 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
1983 ; GFX9-PAL-NEXT: v_add_u32_e32 v1, 0x100, v0
1984 ; GFX9-PAL-NEXT: scratch_store_dword v1, v2, off
1985 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
1986 ; GFX9-PAL-NEXT: v_sub_u32_e32 v0, 0x100, v0
1987 ; GFX9-PAL-NEXT: scratch_load_dword v0, v0, off offset:124 glc
1988 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
1989 ; GFX9-PAL-NEXT: s_endpgm
1991 ; GFX940-LABEL: store_load_vindex_small_offset_kernel:
1992 ; GFX940: ; %bb.0: ; %bb
1993 ; GFX940-NEXT: scratch_load_dword v1, off, off sc0 sc1
1994 ; GFX940-NEXT: s_waitcnt vmcnt(0)
1995 ; GFX940-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1996 ; GFX940-NEXT: v_and_b32_e32 v0, 0xffc, v0
1997 ; GFX940-NEXT: v_mov_b32_e32 v1, 15
1998 ; GFX940-NEXT: scratch_store_dword v0, v1, off offset:256 sc0 sc1
1999 ; GFX940-NEXT: s_waitcnt vmcnt(0)
2000 ; GFX940-NEXT: v_sub_u32_e32 v0, 0x100, v0
2001 ; GFX940-NEXT: scratch_load_dword v0, v0, off offset:124 sc0 sc1
2002 ; GFX940-NEXT: s_waitcnt vmcnt(0)
2003 ; GFX940-NEXT: s_endpgm
2005 ; GFX1010-PAL-LABEL: store_load_vindex_small_offset_kernel:
2006 ; GFX1010-PAL: ; %bb.0: ; %bb
2007 ; GFX1010-PAL-NEXT: s_getpc_b64 s[10:11]
2008 ; GFX1010-PAL-NEXT: s_mov_b32 s10, s0
2009 ; GFX1010-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
2010 ; GFX1010-PAL-NEXT: s_waitcnt lgkmcnt(0)
2011 ; GFX1010-PAL-NEXT: s_and_b32 s11, s11, 0xffff
2012 ; GFX1010-PAL-NEXT: s_add_u32 s10, s10, s9
2013 ; GFX1010-PAL-NEXT: s_addc_u32 s11, s11, 0
2014 ; GFX1010-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s10
2015 ; GFX1010-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11
2016 ; GFX1010-PAL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
2017 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v2, 15
2018 ; GFX1010-PAL-NEXT: s_mov_b32 s0, 0
2019 ; GFX1010-PAL-NEXT: scratch_load_dword v3, off, s0 glc dlc
2020 ; GFX1010-PAL-NEXT: s_waitcnt vmcnt(0)
2021 ; GFX1010-PAL-NEXT: v_add_nc_u32_e32 v1, 0x100, v0
2022 ; GFX1010-PAL-NEXT: v_sub_nc_u32_e32 v0, 0x100, v0
2023 ; GFX1010-PAL-NEXT: scratch_store_dword v1, v2, off
2024 ; GFX1010-PAL-NEXT: s_waitcnt_vscnt null, 0x0
2025 ; GFX1010-PAL-NEXT: scratch_load_dword v0, v0, off offset:124 glc dlc
2026 ; GFX1010-PAL-NEXT: s_waitcnt vmcnt(0)
2027 ; GFX1010-PAL-NEXT: s_endpgm
2029 ; GFX1030-PAL-LABEL: store_load_vindex_small_offset_kernel:
2030 ; GFX1030-PAL: ; %bb.0: ; %bb
2031 ; GFX1030-PAL-NEXT: s_getpc_b64 s[10:11]
2032 ; GFX1030-PAL-NEXT: s_mov_b32 s10, s0
2033 ; GFX1030-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
2034 ; GFX1030-PAL-NEXT: s_waitcnt lgkmcnt(0)
2035 ; GFX1030-PAL-NEXT: s_and_b32 s11, s11, 0xffff
2036 ; GFX1030-PAL-NEXT: s_add_u32 s10, s10, s9
2037 ; GFX1030-PAL-NEXT: s_addc_u32 s11, s11, 0
2038 ; GFX1030-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s10
2039 ; GFX1030-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11
2040 ; GFX1030-PAL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
2041 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v2, 15
2042 ; GFX1030-PAL-NEXT: scratch_load_dword v3, off, off glc dlc
2043 ; GFX1030-PAL-NEXT: s_waitcnt vmcnt(0)
2044 ; GFX1030-PAL-NEXT: v_add_nc_u32_e32 v1, 0x100, v0
2045 ; GFX1030-PAL-NEXT: v_sub_nc_u32_e32 v0, 0x100, v0
2046 ; GFX1030-PAL-NEXT: scratch_store_dword v1, v2, off
2047 ; GFX1030-PAL-NEXT: s_waitcnt_vscnt null, 0x0
2048 ; GFX1030-PAL-NEXT: scratch_load_dword v0, v0, off offset:124 glc dlc
2049 ; GFX1030-PAL-NEXT: s_waitcnt vmcnt(0)
2050 ; GFX1030-PAL-NEXT: s_endpgm
2052 ; GFX11-PAL-LABEL: store_load_vindex_small_offset_kernel:
2053 ; GFX11-PAL: ; %bb.0: ; %bb
2054 ; GFX11-PAL-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_lshlrev_b32 v0, 2, v0
2055 ; GFX11-PAL-NEXT: scratch_load_b32 v3, off, off glc dlc
2056 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
2057 ; GFX11-PAL-NEXT: v_and_b32_e32 v0, 0xffc, v0
2058 ; GFX11-PAL-NEXT: s_delay_alu instid0(VALU_DEP_1)
2059 ; GFX11-PAL-NEXT: v_sub_nc_u32_e32 v2, 0x100, v0
2060 ; GFX11-PAL-NEXT: scratch_store_b32 v0, v1, off offset:256 dlc
2061 ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0
2062 ; GFX11-PAL-NEXT: scratch_load_b32 v0, v2, off offset:124 glc dlc
2063 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
2064 ; GFX11-PAL-NEXT: s_endpgm
2066 ; GFX12-PAL-LABEL: store_load_vindex_small_offset_kernel:
2067 ; GFX12-PAL: ; %bb.0: ; %bb
2068 ; GFX12-PAL-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_lshlrev_b32 v0, 2, v0
2069 ; GFX12-PAL-NEXT: scratch_load_b32 v3, off, off scope:SCOPE_SYS
2070 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
2071 ; GFX12-PAL-NEXT: v_and_b32_e32 v0, 0xffc, v0
2072 ; GFX12-PAL-NEXT: s_delay_alu instid0(VALU_DEP_1)
2073 ; GFX12-PAL-NEXT: v_sub_nc_u32_e32 v2, 0x100, v0
2074 ; GFX12-PAL-NEXT: scratch_store_b32 v0, v1, off offset:256 scope:SCOPE_SYS
2075 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
2076 ; GFX12-PAL-NEXT: scratch_load_b32 v0, v2, off offset:124 scope:SCOPE_SYS
2077 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
2078 ; GFX12-PAL-NEXT: s_endpgm
2080 %padding = alloca [64 x i32], align 4, addrspace(5)
2081 %i = alloca [32 x float], align 4, addrspace(5)
2082 %pad_gep = getelementptr inbounds [64 x i32], ptr addrspace(5) %padding, i32 0, i32 undef
2083 %pad_load = load volatile i32, ptr addrspace(5) %pad_gep, align 4
2084 %i2 = tail call i32 @llvm.amdgcn.workitem.id.x()
2085 %i3 = zext i32 %i2 to i64
2086 %i7 = getelementptr inbounds [32 x float], ptr addrspace(5) %i, i32 0, i32 %i2
2087 store volatile i32 15, ptr addrspace(5) %i7, align 4
2088 %i9 = sub nsw i32 31, %i2
2089 %i10 = getelementptr inbounds [32 x float], ptr addrspace(5) %i, i32 0, i32 %i9
2090 %i12 = load volatile i32, ptr addrspace(5) %i10, align 4
2094 define void @store_load_vindex_small_offset_foo(i32 %idx) {
2095 ; GFX9-LABEL: store_load_vindex_small_offset_foo:
2096 ; GFX9: ; %bb.0: ; %bb
2097 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2098 ; GFX9-NEXT: scratch_load_dword v1, off, s32 glc
2099 ; GFX9-NEXT: s_waitcnt vmcnt(0)
2100 ; GFX9-NEXT: s_add_i32 s0, s32, 0x100
2101 ; GFX9-NEXT: v_mov_b32_e32 v1, s0
2102 ; GFX9-NEXT: v_lshl_add_u32 v2, v0, 2, v1
2103 ; GFX9-NEXT: v_mov_b32_e32 v3, 15
2104 ; GFX9-NEXT: v_and_b32_e32 v0, 15, v0
2105 ; GFX9-NEXT: scratch_store_dword v2, v3, off
2106 ; GFX9-NEXT: s_waitcnt vmcnt(0)
2107 ; GFX9-NEXT: v_lshl_add_u32 v0, v0, 2, v1
2108 ; GFX9-NEXT: scratch_load_dword v0, v0, off glc
2109 ; GFX9-NEXT: s_waitcnt vmcnt(0)
2110 ; GFX9-NEXT: s_setpc_b64 s[30:31]
2112 ; GFX10-LABEL: store_load_vindex_small_offset_foo:
2113 ; GFX10: ; %bb.0: ; %bb
2114 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2115 ; GFX10-NEXT: v_and_b32_e32 v1, 15, v0
2116 ; GFX10-NEXT: s_add_i32 s0, s32, 0x100
2117 ; GFX10-NEXT: v_mov_b32_e32 v2, 15
2118 ; GFX10-NEXT: v_lshl_add_u32 v0, v0, 2, s0
2119 ; GFX10-NEXT: s_add_i32 s0, s32, 0x100
2120 ; GFX10-NEXT: scratch_load_dword v3, off, s32 glc dlc
2121 ; GFX10-NEXT: s_waitcnt vmcnt(0)
2122 ; GFX10-NEXT: v_lshl_add_u32 v1, v1, 2, s0
2123 ; GFX10-NEXT: scratch_store_dword v0, v2, off
2124 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
2125 ; GFX10-NEXT: scratch_load_dword v0, v1, off glc dlc
2126 ; GFX10-NEXT: s_waitcnt vmcnt(0)
2127 ; GFX10-NEXT: s_setpc_b64 s[30:31]
2129 ; GFX11-LABEL: store_load_vindex_small_offset_foo:
2130 ; GFX11: ; %bb.0: ; %bb
2131 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2132 ; GFX11-NEXT: v_dual_mov_b32 v2, 15 :: v_dual_and_b32 v1, 15, v0
2133 ; GFX11-NEXT: s_add_i32 s0, s32, 0x100
2134 ; GFX11-NEXT: scratch_load_b32 v3, off, s32 glc dlc
2135 ; GFX11-NEXT: s_waitcnt vmcnt(0)
2136 ; GFX11-NEXT: v_lshl_add_u32 v0, v0, 2, s0
2137 ; GFX11-NEXT: v_lshlrev_b32_e32 v1, 2, v1
2138 ; GFX11-NEXT: scratch_store_b32 v0, v2, off dlc
2139 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
2140 ; GFX11-NEXT: scratch_load_b32 v0, v1, s32 offset:256 glc dlc
2141 ; GFX11-NEXT: s_waitcnt vmcnt(0)
2142 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2144 ; GFX12-LABEL: store_load_vindex_small_offset_foo:
2145 ; GFX12: ; %bb.0: ; %bb
2146 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
2147 ; GFX12-NEXT: s_wait_expcnt 0x0
2148 ; GFX12-NEXT: s_wait_samplecnt 0x0
2149 ; GFX12-NEXT: s_wait_bvhcnt 0x0
2150 ; GFX12-NEXT: s_wait_kmcnt 0x0
2151 ; GFX12-NEXT: v_dual_mov_b32 v2, 15 :: v_dual_and_b32 v1, 15, v0
2152 ; GFX12-NEXT: v_lshlrev_b32_e32 v0, 2, v0
2153 ; GFX12-NEXT: scratch_load_b32 v3, off, s32 scope:SCOPE_SYS
2154 ; GFX12-NEXT: s_wait_loadcnt 0x0
2155 ; GFX12-NEXT: v_lshlrev_b32_e32 v1, 2, v1
2156 ; GFX12-NEXT: s_wait_storecnt 0x0
2157 ; GFX12-NEXT: scratch_store_b32 v0, v2, s32 offset:256 scope:SCOPE_SYS
2158 ; GFX12-NEXT: s_wait_storecnt 0x0
2159 ; GFX12-NEXT: scratch_load_b32 v0, v1, s32 offset:256 scope:SCOPE_SYS
2160 ; GFX12-NEXT: s_wait_loadcnt 0x0
2161 ; GFX12-NEXT: s_setpc_b64 s[30:31]
2163 ; GFX9-PAL-LABEL: store_load_vindex_small_offset_foo:
2164 ; GFX9-PAL: ; %bb.0: ; %bb
2165 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2166 ; GFX9-PAL-NEXT: scratch_load_dword v1, off, s32 glc
2167 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
2168 ; GFX9-PAL-NEXT: s_add_i32 s0, s32, 0x100
2169 ; GFX9-PAL-NEXT: v_mov_b32_e32 v1, s0
2170 ; GFX9-PAL-NEXT: v_lshl_add_u32 v2, v0, 2, v1
2171 ; GFX9-PAL-NEXT: v_mov_b32_e32 v3, 15
2172 ; GFX9-PAL-NEXT: v_and_b32_e32 v0, 15, v0
2173 ; GFX9-PAL-NEXT: scratch_store_dword v2, v3, off
2174 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
2175 ; GFX9-PAL-NEXT: v_lshl_add_u32 v0, v0, 2, v1
2176 ; GFX9-PAL-NEXT: scratch_load_dword v0, v0, off glc
2177 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
2178 ; GFX9-PAL-NEXT: s_setpc_b64 s[30:31]
2180 ; GFX940-LABEL: store_load_vindex_small_offset_foo:
2181 ; GFX940: ; %bb.0: ; %bb
2182 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2183 ; GFX940-NEXT: scratch_load_dword v1, off, s32 sc0 sc1
2184 ; GFX940-NEXT: s_waitcnt vmcnt(0)
2185 ; GFX940-NEXT: s_add_i32 s0, s32, 0x100
2186 ; GFX940-NEXT: v_mov_b32_e32 v1, s0
2187 ; GFX940-NEXT: v_lshl_add_u32 v1, v0, 2, v1
2188 ; GFX940-NEXT: v_mov_b32_e32 v2, 15
2189 ; GFX940-NEXT: v_and_b32_e32 v0, 15, v0
2190 ; GFX940-NEXT: scratch_store_dword v1, v2, off sc0 sc1
2191 ; GFX940-NEXT: s_waitcnt vmcnt(0)
2192 ; GFX940-NEXT: v_lshlrev_b32_e32 v0, 2, v0
2193 ; GFX940-NEXT: scratch_load_dword v0, v0, s32 offset:256 sc0 sc1
2194 ; GFX940-NEXT: s_waitcnt vmcnt(0)
2195 ; GFX940-NEXT: s_setpc_b64 s[30:31]
2197 ; GFX10-PAL-LABEL: store_load_vindex_small_offset_foo:
2198 ; GFX10-PAL: ; %bb.0: ; %bb
2199 ; GFX10-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2200 ; GFX10-PAL-NEXT: v_and_b32_e32 v1, 15, v0
2201 ; GFX10-PAL-NEXT: s_add_i32 s0, s32, 0x100
2202 ; GFX10-PAL-NEXT: v_mov_b32_e32 v2, 15
2203 ; GFX10-PAL-NEXT: v_lshl_add_u32 v0, v0, 2, s0
2204 ; GFX10-PAL-NEXT: s_add_i32 s0, s32, 0x100
2205 ; GFX10-PAL-NEXT: scratch_load_dword v3, off, s32 glc dlc
2206 ; GFX10-PAL-NEXT: s_waitcnt vmcnt(0)
2207 ; GFX10-PAL-NEXT: v_lshl_add_u32 v1, v1, 2, s0
2208 ; GFX10-PAL-NEXT: scratch_store_dword v0, v2, off
2209 ; GFX10-PAL-NEXT: s_waitcnt_vscnt null, 0x0
2210 ; GFX10-PAL-NEXT: scratch_load_dword v0, v1, off glc dlc
2211 ; GFX10-PAL-NEXT: s_waitcnt vmcnt(0)
2212 ; GFX10-PAL-NEXT: s_setpc_b64 s[30:31]
2214 ; GFX11-PAL-LABEL: store_load_vindex_small_offset_foo:
2215 ; GFX11-PAL: ; %bb.0: ; %bb
2216 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2217 ; GFX11-PAL-NEXT: v_dual_mov_b32 v2, 15 :: v_dual_and_b32 v1, 15, v0
2218 ; GFX11-PAL-NEXT: s_add_i32 s0, s32, 0x100
2219 ; GFX11-PAL-NEXT: scratch_load_b32 v3, off, s32 glc dlc
2220 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
2221 ; GFX11-PAL-NEXT: v_lshl_add_u32 v0, v0, 2, s0
2222 ; GFX11-PAL-NEXT: v_lshlrev_b32_e32 v1, 2, v1
2223 ; GFX11-PAL-NEXT: scratch_store_b32 v0, v2, off dlc
2224 ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0
2225 ; GFX11-PAL-NEXT: scratch_load_b32 v0, v1, s32 offset:256 glc dlc
2226 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
2227 ; GFX11-PAL-NEXT: s_setpc_b64 s[30:31]
2229 ; GFX12-PAL-LABEL: store_load_vindex_small_offset_foo:
2230 ; GFX12-PAL: ; %bb.0: ; %bb
2231 ; GFX12-PAL-NEXT: s_wait_loadcnt_dscnt 0x0
2232 ; GFX12-PAL-NEXT: s_wait_expcnt 0x0
2233 ; GFX12-PAL-NEXT: s_wait_samplecnt 0x0
2234 ; GFX12-PAL-NEXT: s_wait_bvhcnt 0x0
2235 ; GFX12-PAL-NEXT: s_wait_kmcnt 0x0
2236 ; GFX12-PAL-NEXT: v_dual_mov_b32 v2, 15 :: v_dual_and_b32 v1, 15, v0
2237 ; GFX12-PAL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
2238 ; GFX12-PAL-NEXT: scratch_load_b32 v3, off, s32 scope:SCOPE_SYS
2239 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
2240 ; GFX12-PAL-NEXT: v_lshlrev_b32_e32 v1, 2, v1
2241 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
2242 ; GFX12-PAL-NEXT: scratch_store_b32 v0, v2, s32 offset:256 scope:SCOPE_SYS
2243 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
2244 ; GFX12-PAL-NEXT: scratch_load_b32 v0, v1, s32 offset:256 scope:SCOPE_SYS
2245 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
2246 ; GFX12-PAL-NEXT: s_setpc_b64 s[30:31]
2248 %padding = alloca [64 x i32], align 4, addrspace(5)
2249 %i = alloca [32 x float], align 4, addrspace(5)
2250 %pad_gep = getelementptr inbounds [64 x i32], ptr addrspace(5) %padding, i32 0, i32 undef
2251 %pad_load = load volatile i32, ptr addrspace(5) %pad_gep, align 4
2252 %i7 = getelementptr inbounds [32 x float], ptr addrspace(5) %i, i32 0, i32 %idx
2253 store volatile i32 15, ptr addrspace(5) %i7, align 4
2254 %i9 = and i32 %idx, 15
2255 %i10 = getelementptr inbounds [32 x float], ptr addrspace(5) %i, i32 0, i32 %i9
2256 %i12 = load volatile i32, ptr addrspace(5) %i10, align 4
2260 define amdgpu_kernel void @zero_init_large_offset_kernel() {
2261 ; GFX9-LABEL: zero_init_large_offset_kernel:
2263 ; GFX9-NEXT: s_add_u32 flat_scratch_lo, s6, s11
2264 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s7, 0
2265 ; GFX9-NEXT: s_mov_b32 s0, 0
2266 ; GFX9-NEXT: scratch_load_dword v0, off, s0 offset:4 glc
2267 ; GFX9-NEXT: s_waitcnt vmcnt(0)
2268 ; GFX9-NEXT: s_mov_b32 s1, s0
2269 ; GFX9-NEXT: s_mov_b32 s2, s0
2270 ; GFX9-NEXT: s_mov_b32 s3, s0
2271 ; GFX9-NEXT: v_mov_b32_e32 v0, s0
2272 ; GFX9-NEXT: v_mov_b32_e32 v1, s1
2273 ; GFX9-NEXT: v_mov_b32_e32 v2, s2
2274 ; GFX9-NEXT: v_mov_b32_e32 v3, s3
2275 ; GFX9-NEXT: s_movk_i32 s0, 0x4004
2276 ; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0
2277 ; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:16
2278 ; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:32
2279 ; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:48
2280 ; GFX9-NEXT: s_endpgm
2282 ; GFX10-LABEL: zero_init_large_offset_kernel:
2284 ; GFX10-NEXT: s_add_u32 s6, s6, s11
2285 ; GFX10-NEXT: s_addc_u32 s7, s7, 0
2286 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6
2287 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7
2288 ; GFX10-NEXT: scratch_load_dword v0, off, off offset:4 glc dlc
2289 ; GFX10-NEXT: s_waitcnt vmcnt(0)
2290 ; GFX10-NEXT: s_mov_b32 s0, 0
2291 ; GFX10-NEXT: s_mov_b32 s1, s0
2292 ; GFX10-NEXT: s_mov_b32 s2, s0
2293 ; GFX10-NEXT: s_mov_b32 s3, s0
2294 ; GFX10-NEXT: v_mov_b32_e32 v0, s0
2295 ; GFX10-NEXT: v_mov_b32_e32 v1, s1
2296 ; GFX10-NEXT: v_mov_b32_e32 v2, s2
2297 ; GFX10-NEXT: v_mov_b32_e32 v3, s3
2298 ; GFX10-NEXT: s_movk_i32 s0, 0x4004
2299 ; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], s0
2300 ; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:16
2301 ; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:32
2302 ; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:48
2303 ; GFX10-NEXT: s_endpgm
2305 ; GFX11-LABEL: zero_init_large_offset_kernel:
2307 ; GFX11-NEXT: scratch_load_b32 v0, off, off offset:4 glc dlc
2308 ; GFX11-NEXT: s_waitcnt vmcnt(0)
2309 ; GFX11-NEXT: s_mov_b32 s0, 0
2310 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
2311 ; GFX11-NEXT: s_mov_b32 s1, s0
2312 ; GFX11-NEXT: s_mov_b32 s2, s0
2313 ; GFX11-NEXT: s_mov_b32 s3, s0
2314 ; GFX11-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2315 ; GFX11-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
2316 ; GFX11-NEXT: s_movk_i32 s0, 0x4004
2317 ; GFX11-NEXT: s_clause 0x3
2318 ; GFX11-NEXT: scratch_store_b128 off, v[0:3], s0
2319 ; GFX11-NEXT: scratch_store_b128 off, v[0:3], s0 offset:16
2320 ; GFX11-NEXT: scratch_store_b128 off, v[0:3], s0 offset:32
2321 ; GFX11-NEXT: scratch_store_b128 off, v[0:3], s0 offset:48
2322 ; GFX11-NEXT: s_endpgm
2324 ; GFX12-LABEL: zero_init_large_offset_kernel:
2326 ; GFX12-NEXT: scratch_load_b32 v0, off, off scope:SCOPE_SYS
2327 ; GFX12-NEXT: s_wait_loadcnt 0x0
2328 ; GFX12-NEXT: s_mov_b32 s0, 0
2329 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
2330 ; GFX12-NEXT: s_mov_b32 s1, s0
2331 ; GFX12-NEXT: s_mov_b32 s2, s0
2332 ; GFX12-NEXT: s_mov_b32 s3, s0
2333 ; GFX12-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2334 ; GFX12-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
2335 ; GFX12-NEXT: s_clause 0x3
2336 ; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:16384
2337 ; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:16400
2338 ; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:16416
2339 ; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:16432
2340 ; GFX12-NEXT: s_endpgm
2342 ; GFX9-PAL-LABEL: zero_init_large_offset_kernel:
2343 ; GFX9-PAL: ; %bb.0:
2344 ; GFX9-PAL-NEXT: s_getpc_b64 s[10:11]
2345 ; GFX9-PAL-NEXT: s_mov_b32 s10, s0
2346 ; GFX9-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
2347 ; GFX9-PAL-NEXT: s_mov_b32 s0, 0
2348 ; GFX9-PAL-NEXT: s_mov_b32 s1, s0
2349 ; GFX9-PAL-NEXT: s_mov_b32 s2, s0
2350 ; GFX9-PAL-NEXT: s_mov_b32 s3, s0
2351 ; GFX9-PAL-NEXT: s_waitcnt lgkmcnt(0)
2352 ; GFX9-PAL-NEXT: s_and_b32 s11, s11, 0xffff
2353 ; GFX9-PAL-NEXT: s_add_u32 flat_scratch_lo, s10, s9
2354 ; GFX9-PAL-NEXT: s_addc_u32 flat_scratch_hi, s11, 0
2355 ; GFX9-PAL-NEXT: scratch_load_dword v0, off, s0 offset:4 glc
2356 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
2357 ; GFX9-PAL-NEXT: v_mov_b32_e32 v0, s0
2358 ; GFX9-PAL-NEXT: v_mov_b32_e32 v1, s1
2359 ; GFX9-PAL-NEXT: v_mov_b32_e32 v2, s2
2360 ; GFX9-PAL-NEXT: v_mov_b32_e32 v3, s3
2361 ; GFX9-PAL-NEXT: s_movk_i32 s0, 0x4004
2362 ; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0
2363 ; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:16
2364 ; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:32
2365 ; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:48
2366 ; GFX9-PAL-NEXT: s_endpgm
2368 ; GFX940-LABEL: zero_init_large_offset_kernel:
2370 ; GFX940-NEXT: scratch_load_dword v0, off, off offset:4 sc0 sc1
2371 ; GFX940-NEXT: s_waitcnt vmcnt(0)
2372 ; GFX940-NEXT: s_mov_b32 s0, 0
2373 ; GFX940-NEXT: s_mov_b32 s1, s0
2374 ; GFX940-NEXT: s_mov_b32 s2, s0
2375 ; GFX940-NEXT: s_mov_b32 s3, s0
2376 ; GFX940-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
2377 ; GFX940-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
2378 ; GFX940-NEXT: s_movk_i32 s0, 0x4004
2379 ; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], s0 sc0 sc1
2380 ; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:16 sc0 sc1
2381 ; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:32 sc0 sc1
2382 ; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:48 sc0 sc1
2383 ; GFX940-NEXT: s_endpgm
2385 ; GFX1010-PAL-LABEL: zero_init_large_offset_kernel:
2386 ; GFX1010-PAL: ; %bb.0:
2387 ; GFX1010-PAL-NEXT: s_getpc_b64 s[10:11]
2388 ; GFX1010-PAL-NEXT: s_mov_b32 s10, s0
2389 ; GFX1010-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
2390 ; GFX1010-PAL-NEXT: s_waitcnt lgkmcnt(0)
2391 ; GFX1010-PAL-NEXT: s_and_b32 s11, s11, 0xffff
2392 ; GFX1010-PAL-NEXT: s_add_u32 s10, s10, s9
2393 ; GFX1010-PAL-NEXT: s_addc_u32 s11, s11, 0
2394 ; GFX1010-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s10
2395 ; GFX1010-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11
2396 ; GFX1010-PAL-NEXT: s_mov_b32 s0, 0
2397 ; GFX1010-PAL-NEXT: scratch_load_dword v0, off, s0 offset:4 glc dlc
2398 ; GFX1010-PAL-NEXT: s_waitcnt vmcnt(0)
2399 ; GFX1010-PAL-NEXT: s_mov_b32 s1, s0
2400 ; GFX1010-PAL-NEXT: s_mov_b32 s2, s0
2401 ; GFX1010-PAL-NEXT: s_mov_b32 s3, s0
2402 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v0, s0
2403 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v1, s1
2404 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v2, s2
2405 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v3, s3
2406 ; GFX1010-PAL-NEXT: s_movk_i32 s0, 0x4004
2407 ; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0
2408 ; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:16
2409 ; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:32
2410 ; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:48
2411 ; GFX1010-PAL-NEXT: s_endpgm
2413 ; GFX1030-PAL-LABEL: zero_init_large_offset_kernel:
2414 ; GFX1030-PAL: ; %bb.0:
2415 ; GFX1030-PAL-NEXT: s_getpc_b64 s[10:11]
2416 ; GFX1030-PAL-NEXT: s_mov_b32 s10, s0
2417 ; GFX1030-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
2418 ; GFX1030-PAL-NEXT: s_waitcnt lgkmcnt(0)
2419 ; GFX1030-PAL-NEXT: s_and_b32 s11, s11, 0xffff
2420 ; GFX1030-PAL-NEXT: s_add_u32 s10, s10, s9
2421 ; GFX1030-PAL-NEXT: s_addc_u32 s11, s11, 0
2422 ; GFX1030-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s10
2423 ; GFX1030-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11
2424 ; GFX1030-PAL-NEXT: scratch_load_dword v0, off, off offset:4 glc dlc
2425 ; GFX1030-PAL-NEXT: s_waitcnt vmcnt(0)
2426 ; GFX1030-PAL-NEXT: s_mov_b32 s0, 0
2427 ; GFX1030-PAL-NEXT: s_mov_b32 s1, s0
2428 ; GFX1030-PAL-NEXT: s_mov_b32 s2, s0
2429 ; GFX1030-PAL-NEXT: s_mov_b32 s3, s0
2430 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v0, s0
2431 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v1, s1
2432 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v2, s2
2433 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v3, s3
2434 ; GFX1030-PAL-NEXT: s_movk_i32 s0, 0x4004
2435 ; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0
2436 ; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:16
2437 ; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:32
2438 ; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:48
2439 ; GFX1030-PAL-NEXT: s_endpgm
2441 ; GFX11-PAL-LABEL: zero_init_large_offset_kernel:
2442 ; GFX11-PAL: ; %bb.0:
2443 ; GFX11-PAL-NEXT: scratch_load_b32 v0, off, off offset:4 glc dlc
2444 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
2445 ; GFX11-PAL-NEXT: s_mov_b32 s0, 0
2446 ; GFX11-PAL-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
2447 ; GFX11-PAL-NEXT: s_mov_b32 s1, s0
2448 ; GFX11-PAL-NEXT: s_mov_b32 s2, s0
2449 ; GFX11-PAL-NEXT: s_mov_b32 s3, s0
2450 ; GFX11-PAL-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2451 ; GFX11-PAL-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
2452 ; GFX11-PAL-NEXT: s_movk_i32 s0, 0x4004
2453 ; GFX11-PAL-NEXT: s_clause 0x3
2454 ; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], s0
2455 ; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], s0 offset:16
2456 ; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], s0 offset:32
2457 ; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], s0 offset:48
2458 ; GFX11-PAL-NEXT: s_endpgm
2460 ; GFX12-PAL-LABEL: zero_init_large_offset_kernel:
2461 ; GFX12-PAL: ; %bb.0:
2462 ; GFX12-PAL-NEXT: scratch_load_b32 v0, off, off scope:SCOPE_SYS
2463 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
2464 ; GFX12-PAL-NEXT: s_mov_b32 s0, 0
2465 ; GFX12-PAL-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
2466 ; GFX12-PAL-NEXT: s_mov_b32 s1, s0
2467 ; GFX12-PAL-NEXT: s_mov_b32 s2, s0
2468 ; GFX12-PAL-NEXT: s_mov_b32 s3, s0
2469 ; GFX12-PAL-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2470 ; GFX12-PAL-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
2471 ; GFX12-PAL-NEXT: s_clause 0x3
2472 ; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:16384
2473 ; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:16400
2474 ; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:16416
2475 ; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:16432
2476 ; GFX12-PAL-NEXT: s_endpgm
2477 %padding = alloca [4096 x i32], align 4, addrspace(5)
2478 %alloca = alloca [32 x i16], align 2, addrspace(5)
2479 %pad_gep = getelementptr inbounds [4096 x i32], ptr addrspace(5) %padding, i32 0, i32 undef
2480 %pad_load = load volatile i32, ptr addrspace(5) %pad_gep, align 4
2481 call void @llvm.memset.p5.i64(ptr addrspace(5) align 2 dereferenceable(64) %alloca, i8 0, i64 64, i1 false)
2485 define void @zero_init_large_offset_foo() {
2486 ; GFX9-LABEL: zero_init_large_offset_foo:
2488 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2489 ; GFX9-NEXT: scratch_load_dword v0, off, s32 offset:4 glc
2490 ; GFX9-NEXT: s_waitcnt vmcnt(0)
2491 ; GFX9-NEXT: s_mov_b32 s0, 0
2492 ; GFX9-NEXT: s_mov_b32 s1, s0
2493 ; GFX9-NEXT: s_mov_b32 s2, s0
2494 ; GFX9-NEXT: s_mov_b32 s3, s0
2495 ; GFX9-NEXT: v_mov_b32_e32 v0, s0
2496 ; GFX9-NEXT: v_mov_b32_e32 v1, s1
2497 ; GFX9-NEXT: v_mov_b32_e32 v2, s2
2498 ; GFX9-NEXT: v_mov_b32_e32 v3, s3
2499 ; GFX9-NEXT: s_add_i32 s0, s32, 0x4004
2500 ; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0
2501 ; GFX9-NEXT: s_add_i32 s0, s32, 0x4004
2502 ; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:16
2503 ; GFX9-NEXT: s_add_i32 s0, s32, 0x4004
2504 ; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:32
2505 ; GFX9-NEXT: s_add_i32 s0, s32, 0x4004
2506 ; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:48
2507 ; GFX9-NEXT: s_waitcnt vmcnt(0)
2508 ; GFX9-NEXT: s_setpc_b64 s[30:31]
2510 ; GFX10-LABEL: zero_init_large_offset_foo:
2512 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2513 ; GFX10-NEXT: scratch_load_dword v0, off, s32 offset:4 glc dlc
2514 ; GFX10-NEXT: s_waitcnt vmcnt(0)
2515 ; GFX10-NEXT: s_mov_b32 s0, 0
2516 ; GFX10-NEXT: s_mov_b32 s1, s0
2517 ; GFX10-NEXT: s_mov_b32 s2, s0
2518 ; GFX10-NEXT: s_mov_b32 s3, s0
2519 ; GFX10-NEXT: v_mov_b32_e32 v0, s0
2520 ; GFX10-NEXT: v_mov_b32_e32 v1, s1
2521 ; GFX10-NEXT: v_mov_b32_e32 v2, s2
2522 ; GFX10-NEXT: v_mov_b32_e32 v3, s3
2523 ; GFX10-NEXT: s_add_i32 s0, s32, 0x4004
2524 ; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], s0
2525 ; GFX10-NEXT: s_add_i32 s0, s32, 0x4004
2526 ; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:16
2527 ; GFX10-NEXT: s_add_i32 s0, s32, 0x4004
2528 ; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:32
2529 ; GFX10-NEXT: s_add_i32 s0, s32, 0x4004
2530 ; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:48
2531 ; GFX10-NEXT: s_setpc_b64 s[30:31]
2533 ; GFX11-LABEL: zero_init_large_offset_foo:
2535 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2536 ; GFX11-NEXT: scratch_load_b32 v0, off, s32 offset:4 glc dlc
2537 ; GFX11-NEXT: s_waitcnt vmcnt(0)
2538 ; GFX11-NEXT: s_mov_b32 s0, 0
2539 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
2540 ; GFX11-NEXT: s_mov_b32 s1, s0
2541 ; GFX11-NEXT: s_mov_b32 s2, s0
2542 ; GFX11-NEXT: s_mov_b32 s3, s0
2543 ; GFX11-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2544 ; GFX11-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
2545 ; GFX11-NEXT: s_add_i32 s0, s32, 0x4004
2546 ; GFX11-NEXT: scratch_store_b128 off, v[0:3], s0
2547 ; GFX11-NEXT: s_add_i32 s0, s32, 0x4004
2548 ; GFX11-NEXT: scratch_store_b128 off, v[0:3], s0 offset:16
2549 ; GFX11-NEXT: s_add_i32 s0, s32, 0x4004
2550 ; GFX11-NEXT: scratch_store_b128 off, v[0:3], s0 offset:32
2551 ; GFX11-NEXT: s_add_i32 s0, s32, 0x4004
2552 ; GFX11-NEXT: scratch_store_b128 off, v[0:3], s0 offset:48
2553 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2555 ; GFX12-LABEL: zero_init_large_offset_foo:
2557 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
2558 ; GFX12-NEXT: s_wait_expcnt 0x0
2559 ; GFX12-NEXT: s_wait_samplecnt 0x0
2560 ; GFX12-NEXT: s_wait_bvhcnt 0x0
2561 ; GFX12-NEXT: s_wait_kmcnt 0x0
2562 ; GFX12-NEXT: scratch_load_b32 v0, off, s32 scope:SCOPE_SYS
2563 ; GFX12-NEXT: s_wait_loadcnt 0x0
2564 ; GFX12-NEXT: s_mov_b32 s0, 0
2565 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
2566 ; GFX12-NEXT: s_mov_b32 s1, s0
2567 ; GFX12-NEXT: s_mov_b32 s2, s0
2568 ; GFX12-NEXT: s_mov_b32 s3, s0
2569 ; GFX12-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2570 ; GFX12-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
2571 ; GFX12-NEXT: s_clause 0x3
2572 ; GFX12-NEXT: scratch_store_b128 off, v[0:3], s32 offset:16384
2573 ; GFX12-NEXT: scratch_store_b128 off, v[0:3], s32 offset:16400
2574 ; GFX12-NEXT: scratch_store_b128 off, v[0:3], s32 offset:16416
2575 ; GFX12-NEXT: scratch_store_b128 off, v[0:3], s32 offset:16432
2576 ; GFX12-NEXT: s_setpc_b64 s[30:31]
2578 ; GFX9-PAL-LABEL: zero_init_large_offset_foo:
2579 ; GFX9-PAL: ; %bb.0:
2580 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2581 ; GFX9-PAL-NEXT: scratch_load_dword v0, off, s32 offset:4 glc
2582 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
2583 ; GFX9-PAL-NEXT: s_mov_b32 s0, 0
2584 ; GFX9-PAL-NEXT: s_mov_b32 s1, s0
2585 ; GFX9-PAL-NEXT: s_mov_b32 s2, s0
2586 ; GFX9-PAL-NEXT: s_mov_b32 s3, s0
2587 ; GFX9-PAL-NEXT: v_mov_b32_e32 v0, s0
2588 ; GFX9-PAL-NEXT: v_mov_b32_e32 v1, s1
2589 ; GFX9-PAL-NEXT: v_mov_b32_e32 v2, s2
2590 ; GFX9-PAL-NEXT: v_mov_b32_e32 v3, s3
2591 ; GFX9-PAL-NEXT: s_add_i32 s0, s32, 0x4004
2592 ; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0
2593 ; GFX9-PAL-NEXT: s_add_i32 s0, s32, 0x4004
2594 ; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:16
2595 ; GFX9-PAL-NEXT: s_add_i32 s0, s32, 0x4004
2596 ; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:32
2597 ; GFX9-PAL-NEXT: s_add_i32 s0, s32, 0x4004
2598 ; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:48
2599 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
2600 ; GFX9-PAL-NEXT: s_setpc_b64 s[30:31]
2602 ; GFX940-LABEL: zero_init_large_offset_foo:
2604 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2605 ; GFX940-NEXT: scratch_load_dword v0, off, s32 offset:4 sc0 sc1
2606 ; GFX940-NEXT: s_waitcnt vmcnt(0)
2607 ; GFX940-NEXT: s_mov_b32 s0, 0
2608 ; GFX940-NEXT: s_mov_b32 s1, s0
2609 ; GFX940-NEXT: s_mov_b32 s2, s0
2610 ; GFX940-NEXT: s_mov_b32 s3, s0
2611 ; GFX940-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
2612 ; GFX940-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
2613 ; GFX940-NEXT: s_add_i32 s0, s32, 0x4004
2614 ; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], s0 sc0 sc1
2615 ; GFX940-NEXT: s_add_i32 s0, s32, 0x4004
2616 ; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:16 sc0 sc1
2617 ; GFX940-NEXT: s_add_i32 s0, s32, 0x4004
2618 ; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:32 sc0 sc1
2619 ; GFX940-NEXT: s_add_i32 s0, s32, 0x4004
2620 ; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:48 sc0 sc1
2621 ; GFX940-NEXT: s_waitcnt vmcnt(0)
2622 ; GFX940-NEXT: s_setpc_b64 s[30:31]
2624 ; GFX1010-PAL-LABEL: zero_init_large_offset_foo:
2625 ; GFX1010-PAL: ; %bb.0:
2626 ; GFX1010-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2627 ; GFX1010-PAL-NEXT: scratch_load_dword v0, off, s32 offset:4 glc dlc
2628 ; GFX1010-PAL-NEXT: s_waitcnt vmcnt(0)
2629 ; GFX1010-PAL-NEXT: s_mov_b32 s0, 0
2630 ; GFX1010-PAL-NEXT: s_mov_b32 s1, s0
2631 ; GFX1010-PAL-NEXT: s_mov_b32 s2, s0
2632 ; GFX1010-PAL-NEXT: s_mov_b32 s3, s0
2633 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v0, s0
2634 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v1, s1
2635 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v2, s2
2636 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v3, s3
2637 ; GFX1010-PAL-NEXT: s_add_i32 s0, s32, 0x4004
2638 ; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0
2639 ; GFX1010-PAL-NEXT: s_waitcnt_depctr 0xffe3
2640 ; GFX1010-PAL-NEXT: s_add_i32 s0, s32, 0x4004
2641 ; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:16
2642 ; GFX1010-PAL-NEXT: s_waitcnt_depctr 0xffe3
2643 ; GFX1010-PAL-NEXT: s_add_i32 s0, s32, 0x4004
2644 ; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:32
2645 ; GFX1010-PAL-NEXT: s_waitcnt_depctr 0xffe3
2646 ; GFX1010-PAL-NEXT: s_add_i32 s0, s32, 0x4004
2647 ; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:48
2648 ; GFX1010-PAL-NEXT: s_setpc_b64 s[30:31]
2650 ; GFX1030-PAL-LABEL: zero_init_large_offset_foo:
2651 ; GFX1030-PAL: ; %bb.0:
2652 ; GFX1030-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2653 ; GFX1030-PAL-NEXT: scratch_load_dword v0, off, s32 offset:4 glc dlc
2654 ; GFX1030-PAL-NEXT: s_waitcnt vmcnt(0)
2655 ; GFX1030-PAL-NEXT: s_mov_b32 s0, 0
2656 ; GFX1030-PAL-NEXT: s_mov_b32 s1, s0
2657 ; GFX1030-PAL-NEXT: s_mov_b32 s2, s0
2658 ; GFX1030-PAL-NEXT: s_mov_b32 s3, s0
2659 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v0, s0
2660 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v1, s1
2661 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v2, s2
2662 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v3, s3
2663 ; GFX1030-PAL-NEXT: s_add_i32 s0, s32, 0x4004
2664 ; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0
2665 ; GFX1030-PAL-NEXT: s_add_i32 s0, s32, 0x4004
2666 ; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:16
2667 ; GFX1030-PAL-NEXT: s_add_i32 s0, s32, 0x4004
2668 ; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:32
2669 ; GFX1030-PAL-NEXT: s_add_i32 s0, s32, 0x4004
2670 ; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:48
2671 ; GFX1030-PAL-NEXT: s_setpc_b64 s[30:31]
2673 ; GFX11-PAL-LABEL: zero_init_large_offset_foo:
2674 ; GFX11-PAL: ; %bb.0:
2675 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2676 ; GFX11-PAL-NEXT: scratch_load_b32 v0, off, s32 offset:4 glc dlc
2677 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
2678 ; GFX11-PAL-NEXT: s_mov_b32 s0, 0
2679 ; GFX11-PAL-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
2680 ; GFX11-PAL-NEXT: s_mov_b32 s1, s0
2681 ; GFX11-PAL-NEXT: s_mov_b32 s2, s0
2682 ; GFX11-PAL-NEXT: s_mov_b32 s3, s0
2683 ; GFX11-PAL-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2684 ; GFX11-PAL-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
2685 ; GFX11-PAL-NEXT: s_add_i32 s0, s32, 0x4004
2686 ; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], s0
2687 ; GFX11-PAL-NEXT: s_add_i32 s0, s32, 0x4004
2688 ; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], s0 offset:16
2689 ; GFX11-PAL-NEXT: s_add_i32 s0, s32, 0x4004
2690 ; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], s0 offset:32
2691 ; GFX11-PAL-NEXT: s_add_i32 s0, s32, 0x4004
2692 ; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], s0 offset:48
2693 ; GFX11-PAL-NEXT: s_setpc_b64 s[30:31]
2695 ; GFX12-PAL-LABEL: zero_init_large_offset_foo:
2696 ; GFX12-PAL: ; %bb.0:
2697 ; GFX12-PAL-NEXT: s_wait_loadcnt_dscnt 0x0
2698 ; GFX12-PAL-NEXT: s_wait_expcnt 0x0
2699 ; GFX12-PAL-NEXT: s_wait_samplecnt 0x0
2700 ; GFX12-PAL-NEXT: s_wait_bvhcnt 0x0
2701 ; GFX12-PAL-NEXT: s_wait_kmcnt 0x0
2702 ; GFX12-PAL-NEXT: scratch_load_b32 v0, off, s32 scope:SCOPE_SYS
2703 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
2704 ; GFX12-PAL-NEXT: s_mov_b32 s0, 0
2705 ; GFX12-PAL-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
2706 ; GFX12-PAL-NEXT: s_mov_b32 s1, s0
2707 ; GFX12-PAL-NEXT: s_mov_b32 s2, s0
2708 ; GFX12-PAL-NEXT: s_mov_b32 s3, s0
2709 ; GFX12-PAL-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2710 ; GFX12-PAL-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
2711 ; GFX12-PAL-NEXT: s_clause 0x3
2712 ; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], s32 offset:16384
2713 ; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], s32 offset:16400
2714 ; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], s32 offset:16416
2715 ; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], s32 offset:16432
2716 ; GFX12-PAL-NEXT: s_setpc_b64 s[30:31]
2717 %padding = alloca [4096 x i32], align 4, addrspace(5)
2718 %alloca = alloca [32 x i16], align 2, addrspace(5)
2719 %pad_gep = getelementptr inbounds [4096 x i32], ptr addrspace(5) %padding, i32 0, i32 undef
2720 %pad_load = load volatile i32, ptr addrspace(5) %pad_gep, align 4
2721 call void @llvm.memset.p5.i64(ptr addrspace(5) align 2 dereferenceable(64) %alloca, i8 0, i64 64, i1 false)
2725 define amdgpu_kernel void @store_load_sindex_large_offset_kernel(i32 %idx) {
2726 ; GFX9-LABEL: store_load_sindex_large_offset_kernel:
2727 ; GFX9: ; %bb.0: ; %bb
2728 ; GFX9-NEXT: s_load_dword s0, s[2:3], 0x24
2729 ; GFX9-NEXT: s_add_u32 flat_scratch_lo, s6, s11
2730 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s7, 0
2731 ; GFX9-NEXT: s_mov_b32 s1, 0
2732 ; GFX9-NEXT: scratch_load_dword v0, off, s1 offset:4 glc
2733 ; GFX9-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2734 ; GFX9-NEXT: s_lshl_b32 s1, s0, 2
2735 ; GFX9-NEXT: s_and_b32 s0, s0, 15
2736 ; GFX9-NEXT: v_mov_b32_e32 v0, 15
2737 ; GFX9-NEXT: s_addk_i32 s1, 0x4004
2738 ; GFX9-NEXT: s_lshl_b32 s0, s0, 2
2739 ; GFX9-NEXT: scratch_store_dword off, v0, s1
2740 ; GFX9-NEXT: s_waitcnt vmcnt(0)
2741 ; GFX9-NEXT: s_addk_i32 s0, 0x4004
2742 ; GFX9-NEXT: scratch_load_dword v0, off, s0 glc
2743 ; GFX9-NEXT: s_waitcnt vmcnt(0)
2744 ; GFX9-NEXT: s_endpgm
2746 ; GFX10-LABEL: store_load_sindex_large_offset_kernel:
2747 ; GFX10: ; %bb.0: ; %bb
2748 ; GFX10-NEXT: s_add_u32 s6, s6, s11
2749 ; GFX10-NEXT: s_addc_u32 s7, s7, 0
2750 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6
2751 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7
2752 ; GFX10-NEXT: s_load_dword s0, s[2:3], 0x24
2753 ; GFX10-NEXT: scratch_load_dword v0, off, off offset:4 glc dlc
2754 ; GFX10-NEXT: s_waitcnt vmcnt(0)
2755 ; GFX10-NEXT: v_mov_b32_e32 v0, 15
2756 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
2757 ; GFX10-NEXT: s_and_b32 s1, s0, 15
2758 ; GFX10-NEXT: s_lshl_b32 s0, s0, 2
2759 ; GFX10-NEXT: s_lshl_b32 s1, s1, 2
2760 ; GFX10-NEXT: s_addk_i32 s0, 0x4004
2761 ; GFX10-NEXT: s_addk_i32 s1, 0x4004
2762 ; GFX10-NEXT: scratch_store_dword off, v0, s0
2763 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
2764 ; GFX10-NEXT: scratch_load_dword v0, off, s1 glc dlc
2765 ; GFX10-NEXT: s_waitcnt vmcnt(0)
2766 ; GFX10-NEXT: s_endpgm
2768 ; GFX11-LABEL: store_load_sindex_large_offset_kernel:
2769 ; GFX11: ; %bb.0: ; %bb
2770 ; GFX11-NEXT: s_load_b32 s0, s[2:3], 0x24
2771 ; GFX11-NEXT: scratch_load_b32 v0, off, off offset:4 glc dlc
2772 ; GFX11-NEXT: s_waitcnt vmcnt(0)
2773 ; GFX11-NEXT: v_mov_b32_e32 v0, 15
2774 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
2775 ; GFX11-NEXT: s_and_b32 s1, s0, 15
2776 ; GFX11-NEXT: s_lshl_b32 s0, s0, 2
2777 ; GFX11-NEXT: s_lshl_b32 s1, s1, 2
2778 ; GFX11-NEXT: s_addk_i32 s0, 0x4004
2779 ; GFX11-NEXT: s_addk_i32 s1, 0x4004
2780 ; GFX11-NEXT: scratch_store_b32 off, v0, s0 dlc
2781 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
2782 ; GFX11-NEXT: scratch_load_b32 v0, off, s1 glc dlc
2783 ; GFX11-NEXT: s_waitcnt vmcnt(0)
2784 ; GFX11-NEXT: s_endpgm
2786 ; GFX12-LABEL: store_load_sindex_large_offset_kernel:
2787 ; GFX12: ; %bb.0: ; %bb
2788 ; GFX12-NEXT: s_load_b32 s0, s[2:3], 0x24
2789 ; GFX12-NEXT: scratch_load_b32 v0, off, off scope:SCOPE_SYS
2790 ; GFX12-NEXT: s_wait_loadcnt 0x0
2791 ; GFX12-NEXT: v_mov_b32_e32 v0, 15
2792 ; GFX12-NEXT: s_wait_kmcnt 0x0
2793 ; GFX12-NEXT: s_and_b32 s1, s0, 15
2794 ; GFX12-NEXT: s_lshl_b32 s0, s0, 2
2795 ; GFX12-NEXT: s_lshl_b32 s1, s1, 2
2796 ; GFX12-NEXT: s_addk_co_i32 s0, 0x4000
2797 ; GFX12-NEXT: s_addk_co_i32 s1, 0x4000
2798 ; GFX12-NEXT: scratch_store_b32 off, v0, s0 scope:SCOPE_SYS
2799 ; GFX12-NEXT: s_wait_storecnt 0x0
2800 ; GFX12-NEXT: scratch_load_b32 v0, off, s1 scope:SCOPE_SYS
2801 ; GFX12-NEXT: s_wait_loadcnt 0x0
2802 ; GFX12-NEXT: s_endpgm
2804 ; GFX9-PAL-LABEL: store_load_sindex_large_offset_kernel:
2805 ; GFX9-PAL: ; %bb.0: ; %bb
2806 ; GFX9-PAL-NEXT: s_getpc_b64 s[10:11]
2807 ; GFX9-PAL-NEXT: s_mov_b32 s10, s0
2808 ; GFX9-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
2809 ; GFX9-PAL-NEXT: s_mov_b32 s1, 0
2810 ; GFX9-PAL-NEXT: s_load_dword s0, s[2:3], 0x0
2811 ; GFX9-PAL-NEXT: s_waitcnt lgkmcnt(0)
2812 ; GFX9-PAL-NEXT: s_and_b32 s11, s11, 0xffff
2813 ; GFX9-PAL-NEXT: s_add_u32 flat_scratch_lo, s10, s9
2814 ; GFX9-PAL-NEXT: s_addc_u32 flat_scratch_hi, s11, 0
2815 ; GFX9-PAL-NEXT: scratch_load_dword v0, off, s1 offset:4 glc
2816 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
2817 ; GFX9-PAL-NEXT: s_lshl_b32 s1, s0, 2
2818 ; GFX9-PAL-NEXT: s_and_b32 s0, s0, 15
2819 ; GFX9-PAL-NEXT: v_mov_b32_e32 v0, 15
2820 ; GFX9-PAL-NEXT: s_addk_i32 s1, 0x4004
2821 ; GFX9-PAL-NEXT: s_lshl_b32 s0, s0, 2
2822 ; GFX9-PAL-NEXT: scratch_store_dword off, v0, s1
2823 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
2824 ; GFX9-PAL-NEXT: s_addk_i32 s0, 0x4004
2825 ; GFX9-PAL-NEXT: scratch_load_dword v0, off, s0 glc
2826 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
2827 ; GFX9-PAL-NEXT: s_endpgm
2829 ; GFX940-LABEL: store_load_sindex_large_offset_kernel:
2830 ; GFX940: ; %bb.0: ; %bb
2831 ; GFX940-NEXT: s_load_dword s0, s[2:3], 0x24
2832 ; GFX940-NEXT: scratch_load_dword v0, off, off offset:4 sc0 sc1
2833 ; GFX940-NEXT: s_waitcnt vmcnt(0)
2834 ; GFX940-NEXT: v_mov_b32_e32 v0, 15
2835 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
2836 ; GFX940-NEXT: s_lshl_b32 s1, s0, 2
2837 ; GFX940-NEXT: s_and_b32 s0, s0, 15
2838 ; GFX940-NEXT: s_addk_i32 s1, 0x4004
2839 ; GFX940-NEXT: s_lshl_b32 s0, s0, 2
2840 ; GFX940-NEXT: scratch_store_dword off, v0, s1 sc0 sc1
2841 ; GFX940-NEXT: s_waitcnt vmcnt(0)
2842 ; GFX940-NEXT: s_addk_i32 s0, 0x4004
2843 ; GFX940-NEXT: scratch_load_dword v0, off, s0 sc0 sc1
2844 ; GFX940-NEXT: s_waitcnt vmcnt(0)
2845 ; GFX940-NEXT: s_endpgm
2847 ; GFX1010-PAL-LABEL: store_load_sindex_large_offset_kernel:
2848 ; GFX1010-PAL: ; %bb.0: ; %bb
2849 ; GFX1010-PAL-NEXT: s_getpc_b64 s[10:11]
2850 ; GFX1010-PAL-NEXT: s_mov_b32 s10, s0
2851 ; GFX1010-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
2852 ; GFX1010-PAL-NEXT: s_waitcnt lgkmcnt(0)
2853 ; GFX1010-PAL-NEXT: s_and_b32 s11, s11, 0xffff
2854 ; GFX1010-PAL-NEXT: s_add_u32 s10, s10, s9
2855 ; GFX1010-PAL-NEXT: s_addc_u32 s11, s11, 0
2856 ; GFX1010-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s10
2857 ; GFX1010-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11
2858 ; GFX1010-PAL-NEXT: s_load_dword s0, s[2:3], 0x0
2859 ; GFX1010-PAL-NEXT: s_mov_b32 s1, 0
2860 ; GFX1010-PAL-NEXT: scratch_load_dword v0, off, s1 offset:4 glc dlc
2861 ; GFX1010-PAL-NEXT: s_waitcnt vmcnt(0)
2862 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v0, 15
2863 ; GFX1010-PAL-NEXT: s_waitcnt lgkmcnt(0)
2864 ; GFX1010-PAL-NEXT: s_and_b32 s1, s0, 15
2865 ; GFX1010-PAL-NEXT: s_lshl_b32 s0, s0, 2
2866 ; GFX1010-PAL-NEXT: s_lshl_b32 s1, s1, 2
2867 ; GFX1010-PAL-NEXT: s_addk_i32 s0, 0x4004
2868 ; GFX1010-PAL-NEXT: s_addk_i32 s1, 0x4004
2869 ; GFX1010-PAL-NEXT: scratch_store_dword off, v0, s0
2870 ; GFX1010-PAL-NEXT: s_waitcnt_vscnt null, 0x0
2871 ; GFX1010-PAL-NEXT: scratch_load_dword v0, off, s1 glc dlc
2872 ; GFX1010-PAL-NEXT: s_waitcnt vmcnt(0)
2873 ; GFX1010-PAL-NEXT: s_endpgm
2875 ; GFX1030-PAL-LABEL: store_load_sindex_large_offset_kernel:
2876 ; GFX1030-PAL: ; %bb.0: ; %bb
2877 ; GFX1030-PAL-NEXT: s_getpc_b64 s[10:11]
2878 ; GFX1030-PAL-NEXT: s_mov_b32 s10, s0
2879 ; GFX1030-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
2880 ; GFX1030-PAL-NEXT: s_waitcnt lgkmcnt(0)
2881 ; GFX1030-PAL-NEXT: s_and_b32 s11, s11, 0xffff
2882 ; GFX1030-PAL-NEXT: s_add_u32 s10, s10, s9
2883 ; GFX1030-PAL-NEXT: s_addc_u32 s11, s11, 0
2884 ; GFX1030-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s10
2885 ; GFX1030-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11
2886 ; GFX1030-PAL-NEXT: s_load_dword s0, s[2:3], 0x0
2887 ; GFX1030-PAL-NEXT: scratch_load_dword v0, off, off offset:4 glc dlc
2888 ; GFX1030-PAL-NEXT: s_waitcnt vmcnt(0)
2889 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v0, 15
2890 ; GFX1030-PAL-NEXT: s_waitcnt lgkmcnt(0)
2891 ; GFX1030-PAL-NEXT: s_and_b32 s1, s0, 15
2892 ; GFX1030-PAL-NEXT: s_lshl_b32 s0, s0, 2
2893 ; GFX1030-PAL-NEXT: s_lshl_b32 s1, s1, 2
2894 ; GFX1030-PAL-NEXT: s_addk_i32 s0, 0x4004
2895 ; GFX1030-PAL-NEXT: s_addk_i32 s1, 0x4004
2896 ; GFX1030-PAL-NEXT: scratch_store_dword off, v0, s0
2897 ; GFX1030-PAL-NEXT: s_waitcnt_vscnt null, 0x0
2898 ; GFX1030-PAL-NEXT: scratch_load_dword v0, off, s1 glc dlc
2899 ; GFX1030-PAL-NEXT: s_waitcnt vmcnt(0)
2900 ; GFX1030-PAL-NEXT: s_endpgm
2902 ; GFX11-PAL-LABEL: store_load_sindex_large_offset_kernel:
2903 ; GFX11-PAL: ; %bb.0: ; %bb
2904 ; GFX11-PAL-NEXT: s_load_b32 s0, s[2:3], 0x0
2905 ; GFX11-PAL-NEXT: scratch_load_b32 v0, off, off offset:4 glc dlc
2906 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
2907 ; GFX11-PAL-NEXT: v_mov_b32_e32 v0, 15
2908 ; GFX11-PAL-NEXT: s_waitcnt lgkmcnt(0)
2909 ; GFX11-PAL-NEXT: s_and_b32 s1, s0, 15
2910 ; GFX11-PAL-NEXT: s_lshl_b32 s0, s0, 2
2911 ; GFX11-PAL-NEXT: s_lshl_b32 s1, s1, 2
2912 ; GFX11-PAL-NEXT: s_addk_i32 s0, 0x4004
2913 ; GFX11-PAL-NEXT: s_addk_i32 s1, 0x4004
2914 ; GFX11-PAL-NEXT: scratch_store_b32 off, v0, s0 dlc
2915 ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0
2916 ; GFX11-PAL-NEXT: scratch_load_b32 v0, off, s1 glc dlc
2917 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
2918 ; GFX11-PAL-NEXT: s_endpgm
2920 ; GFX12-PAL-LABEL: store_load_sindex_large_offset_kernel:
2921 ; GFX12-PAL: ; %bb.0: ; %bb
2922 ; GFX12-PAL-NEXT: s_load_b32 s0, s[2:3], 0x0
2923 ; GFX12-PAL-NEXT: scratch_load_b32 v0, off, off scope:SCOPE_SYS
2924 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
2925 ; GFX12-PAL-NEXT: v_mov_b32_e32 v0, 15
2926 ; GFX12-PAL-NEXT: s_wait_kmcnt 0x0
2927 ; GFX12-PAL-NEXT: s_and_b32 s1, s0, 15
2928 ; GFX12-PAL-NEXT: s_lshl_b32 s0, s0, 2
2929 ; GFX12-PAL-NEXT: s_lshl_b32 s1, s1, 2
2930 ; GFX12-PAL-NEXT: s_addk_co_i32 s0, 0x4000
2931 ; GFX12-PAL-NEXT: s_addk_co_i32 s1, 0x4000
2932 ; GFX12-PAL-NEXT: scratch_store_b32 off, v0, s0 scope:SCOPE_SYS
2933 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
2934 ; GFX12-PAL-NEXT: scratch_load_b32 v0, off, s1 scope:SCOPE_SYS
2935 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
2936 ; GFX12-PAL-NEXT: s_endpgm
2938 %padding = alloca [4096 x i32], align 4, addrspace(5)
2939 %i = alloca [32 x float], align 4, addrspace(5)
2940 %pad_gep = getelementptr inbounds [4096 x i32], ptr addrspace(5) %padding, i32 0, i32 undef
2941 %pad_load = load volatile i32, ptr addrspace(5) %pad_gep, align 4
2942 %i7 = getelementptr inbounds [32 x float], ptr addrspace(5) %i, i32 0, i32 %idx
2943 store volatile i32 15, ptr addrspace(5) %i7, align 4
2944 %i9 = and i32 %idx, 15
2945 %i10 = getelementptr inbounds [32 x float], ptr addrspace(5) %i, i32 0, i32 %i9
2946 %i12 = load volatile i32, ptr addrspace(5) %i10, align 4
2950 define amdgpu_ps void @store_load_sindex_large_offset_foo(i32 inreg %idx) {
2951 ; GFX9-LABEL: store_load_sindex_large_offset_foo:
2952 ; GFX9: ; %bb.0: ; %bb
2953 ; GFX9-NEXT: s_add_u32 flat_scratch_lo, s0, s3
2954 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s1, 0
2955 ; GFX9-NEXT: s_mov_b32 s0, 0
2956 ; GFX9-NEXT: scratch_load_dword v0, off, s0 offset:4 glc
2957 ; GFX9-NEXT: s_waitcnt vmcnt(0)
2958 ; GFX9-NEXT: s_lshl_b32 s0, s2, 2
2959 ; GFX9-NEXT: s_addk_i32 s0, 0x4004
2960 ; GFX9-NEXT: v_mov_b32_e32 v0, 15
2961 ; GFX9-NEXT: scratch_store_dword off, v0, s0
2962 ; GFX9-NEXT: s_waitcnt vmcnt(0)
2963 ; GFX9-NEXT: s_and_b32 s0, s2, 15
2964 ; GFX9-NEXT: s_lshl_b32 s0, s0, 2
2965 ; GFX9-NEXT: s_addk_i32 s0, 0x4004
2966 ; GFX9-NEXT: scratch_load_dword v0, off, s0 glc
2967 ; GFX9-NEXT: s_waitcnt vmcnt(0)
2968 ; GFX9-NEXT: s_endpgm
2970 ; GFX10-LABEL: store_load_sindex_large_offset_foo:
2971 ; GFX10: ; %bb.0: ; %bb
2972 ; GFX10-NEXT: s_add_u32 s0, s0, s3
2973 ; GFX10-NEXT: s_addc_u32 s1, s1, 0
2974 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s0
2975 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s1
2976 ; GFX10-NEXT: scratch_load_dword v0, off, off offset:4 glc dlc
2977 ; GFX10-NEXT: s_waitcnt vmcnt(0)
2978 ; GFX10-NEXT: v_mov_b32_e32 v0, 15
2979 ; GFX10-NEXT: s_and_b32 s0, s2, 15
2980 ; GFX10-NEXT: s_lshl_b32 s1, s2, 2
2981 ; GFX10-NEXT: s_lshl_b32 s0, s0, 2
2982 ; GFX10-NEXT: s_addk_i32 s1, 0x4004
2983 ; GFX10-NEXT: s_addk_i32 s0, 0x4004
2984 ; GFX10-NEXT: scratch_store_dword off, v0, s1
2985 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
2986 ; GFX10-NEXT: scratch_load_dword v0, off, s0 glc dlc
2987 ; GFX10-NEXT: s_waitcnt vmcnt(0)
2988 ; GFX10-NEXT: s_endpgm
2990 ; GFX11-LABEL: store_load_sindex_large_offset_foo:
2991 ; GFX11: ; %bb.0: ; %bb
2992 ; GFX11-NEXT: scratch_load_b32 v0, off, off offset:4 glc dlc
2993 ; GFX11-NEXT: s_waitcnt vmcnt(0)
2994 ; GFX11-NEXT: v_mov_b32_e32 v0, 15
2995 ; GFX11-NEXT: s_and_b32 s1, s0, 15
2996 ; GFX11-NEXT: s_lshl_b32 s0, s0, 2
2997 ; GFX11-NEXT: s_lshl_b32 s1, s1, 2
2998 ; GFX11-NEXT: s_addk_i32 s0, 0x4004
2999 ; GFX11-NEXT: s_addk_i32 s1, 0x4004
3000 ; GFX11-NEXT: scratch_store_b32 off, v0, s0 dlc
3001 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
3002 ; GFX11-NEXT: scratch_load_b32 v0, off, s1 glc dlc
3003 ; GFX11-NEXT: s_waitcnt vmcnt(0)
3004 ; GFX11-NEXT: s_endpgm
3006 ; GFX12-LABEL: store_load_sindex_large_offset_foo:
3007 ; GFX12: ; %bb.0: ; %bb
3008 ; GFX12-NEXT: scratch_load_b32 v0, off, off scope:SCOPE_SYS
3009 ; GFX12-NEXT: s_wait_loadcnt 0x0
3010 ; GFX12-NEXT: v_mov_b32_e32 v0, 15
3011 ; GFX12-NEXT: s_and_b32 s1, s0, 15
3012 ; GFX12-NEXT: s_lshl_b32 s0, s0, 2
3013 ; GFX12-NEXT: s_lshl_b32 s1, s1, 2
3014 ; GFX12-NEXT: s_addk_co_i32 s0, 0x4000
3015 ; GFX12-NEXT: s_addk_co_i32 s1, 0x4000
3016 ; GFX12-NEXT: scratch_store_b32 off, v0, s0 scope:SCOPE_SYS
3017 ; GFX12-NEXT: s_wait_storecnt 0x0
3018 ; GFX12-NEXT: scratch_load_b32 v0, off, s1 scope:SCOPE_SYS
3019 ; GFX12-NEXT: s_wait_loadcnt 0x0
3020 ; GFX12-NEXT: s_endpgm
3022 ; GFX9-PAL-LABEL: store_load_sindex_large_offset_foo:
3023 ; GFX9-PAL: ; %bb.0: ; %bb
3024 ; GFX9-PAL-NEXT: s_getpc_b64 s[2:3]
3025 ; GFX9-PAL-NEXT: s_mov_b32 s2, s0
3026 ; GFX9-PAL-NEXT: s_load_dwordx2 s[2:3], s[2:3], 0x0
3027 ; GFX9-PAL-NEXT: s_waitcnt lgkmcnt(0)
3028 ; GFX9-PAL-NEXT: s_and_b32 s3, s3, 0xffff
3029 ; GFX9-PAL-NEXT: s_add_u32 flat_scratch_lo, s2, s1
3030 ; GFX9-PAL-NEXT: s_addc_u32 flat_scratch_hi, s3, 0
3031 ; GFX9-PAL-NEXT: s_mov_b32 s1, 0
3032 ; GFX9-PAL-NEXT: scratch_load_dword v0, off, s1 offset:4 glc
3033 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
3034 ; GFX9-PAL-NEXT: s_lshl_b32 s1, s0, 2
3035 ; GFX9-PAL-NEXT: s_and_b32 s0, s0, 15
3036 ; GFX9-PAL-NEXT: s_addk_i32 s1, 0x4004
3037 ; GFX9-PAL-NEXT: v_mov_b32_e32 v0, 15
3038 ; GFX9-PAL-NEXT: s_lshl_b32 s0, s0, 2
3039 ; GFX9-PAL-NEXT: scratch_store_dword off, v0, s1
3040 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
3041 ; GFX9-PAL-NEXT: s_addk_i32 s0, 0x4004
3042 ; GFX9-PAL-NEXT: scratch_load_dword v0, off, s0 glc
3043 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
3044 ; GFX9-PAL-NEXT: s_endpgm
3046 ; GFX940-LABEL: store_load_sindex_large_offset_foo:
3047 ; GFX940: ; %bb.0: ; %bb
3048 ; GFX940-NEXT: scratch_load_dword v0, off, off offset:4 sc0 sc1
3049 ; GFX940-NEXT: s_waitcnt vmcnt(0)
3050 ; GFX940-NEXT: s_lshl_b32 s1, s0, 2
3051 ; GFX940-NEXT: s_and_b32 s0, s0, 15
3052 ; GFX940-NEXT: s_addk_i32 s1, 0x4004
3053 ; GFX940-NEXT: v_mov_b32_e32 v0, 15
3054 ; GFX940-NEXT: s_lshl_b32 s0, s0, 2
3055 ; GFX940-NEXT: scratch_store_dword off, v0, s1 sc0 sc1
3056 ; GFX940-NEXT: s_waitcnt vmcnt(0)
3057 ; GFX940-NEXT: s_addk_i32 s0, 0x4004
3058 ; GFX940-NEXT: scratch_load_dword v0, off, s0 sc0 sc1
3059 ; GFX940-NEXT: s_waitcnt vmcnt(0)
3060 ; GFX940-NEXT: s_endpgm
3062 ; GFX1010-PAL-LABEL: store_load_sindex_large_offset_foo:
3063 ; GFX1010-PAL: ; %bb.0: ; %bb
3064 ; GFX1010-PAL-NEXT: s_getpc_b64 s[2:3]
3065 ; GFX1010-PAL-NEXT: s_mov_b32 s2, s0
3066 ; GFX1010-PAL-NEXT: s_load_dwordx2 s[2:3], s[2:3], 0x0
3067 ; GFX1010-PAL-NEXT: s_waitcnt lgkmcnt(0)
3068 ; GFX1010-PAL-NEXT: s_and_b32 s3, s3, 0xffff
3069 ; GFX1010-PAL-NEXT: s_add_u32 s2, s2, s1
3070 ; GFX1010-PAL-NEXT: s_addc_u32 s3, s3, 0
3071 ; GFX1010-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s2
3072 ; GFX1010-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s3
3073 ; GFX1010-PAL-NEXT: s_mov_b32 s1, 0
3074 ; GFX1010-PAL-NEXT: scratch_load_dword v0, off, s1 offset:4 glc dlc
3075 ; GFX1010-PAL-NEXT: s_waitcnt vmcnt(0)
3076 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v0, 15
3077 ; GFX1010-PAL-NEXT: s_and_b32 s1, s0, 15
3078 ; GFX1010-PAL-NEXT: s_lshl_b32 s0, s0, 2
3079 ; GFX1010-PAL-NEXT: s_lshl_b32 s1, s1, 2
3080 ; GFX1010-PAL-NEXT: s_addk_i32 s0, 0x4004
3081 ; GFX1010-PAL-NEXT: s_addk_i32 s1, 0x4004
3082 ; GFX1010-PAL-NEXT: scratch_store_dword off, v0, s0
3083 ; GFX1010-PAL-NEXT: s_waitcnt_vscnt null, 0x0
3084 ; GFX1010-PAL-NEXT: scratch_load_dword v0, off, s1 glc dlc
3085 ; GFX1010-PAL-NEXT: s_waitcnt vmcnt(0)
3086 ; GFX1010-PAL-NEXT: s_endpgm
3088 ; GFX1030-PAL-LABEL: store_load_sindex_large_offset_foo:
3089 ; GFX1030-PAL: ; %bb.0: ; %bb
3090 ; GFX1030-PAL-NEXT: s_getpc_b64 s[2:3]
3091 ; GFX1030-PAL-NEXT: s_mov_b32 s2, s0
3092 ; GFX1030-PAL-NEXT: s_load_dwordx2 s[2:3], s[2:3], 0x0
3093 ; GFX1030-PAL-NEXT: s_waitcnt lgkmcnt(0)
3094 ; GFX1030-PAL-NEXT: s_and_b32 s3, s3, 0xffff
3095 ; GFX1030-PAL-NEXT: s_add_u32 s2, s2, s1
3096 ; GFX1030-PAL-NEXT: s_addc_u32 s3, s3, 0
3097 ; GFX1030-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s2
3098 ; GFX1030-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s3
3099 ; GFX1030-PAL-NEXT: scratch_load_dword v0, off, off offset:4 glc dlc
3100 ; GFX1030-PAL-NEXT: s_waitcnt vmcnt(0)
3101 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v0, 15
3102 ; GFX1030-PAL-NEXT: s_and_b32 s1, s0, 15
3103 ; GFX1030-PAL-NEXT: s_lshl_b32 s0, s0, 2
3104 ; GFX1030-PAL-NEXT: s_lshl_b32 s1, s1, 2
3105 ; GFX1030-PAL-NEXT: s_addk_i32 s0, 0x4004
3106 ; GFX1030-PAL-NEXT: s_addk_i32 s1, 0x4004
3107 ; GFX1030-PAL-NEXT: scratch_store_dword off, v0, s0
3108 ; GFX1030-PAL-NEXT: s_waitcnt_vscnt null, 0x0
3109 ; GFX1030-PAL-NEXT: scratch_load_dword v0, off, s1 glc dlc
3110 ; GFX1030-PAL-NEXT: s_waitcnt vmcnt(0)
3111 ; GFX1030-PAL-NEXT: s_endpgm
3113 ; GFX11-PAL-LABEL: store_load_sindex_large_offset_foo:
3114 ; GFX11-PAL: ; %bb.0: ; %bb
3115 ; GFX11-PAL-NEXT: scratch_load_b32 v0, off, off offset:4 glc dlc
3116 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
3117 ; GFX11-PAL-NEXT: v_mov_b32_e32 v0, 15
3118 ; GFX11-PAL-NEXT: s_and_b32 s1, s0, 15
3119 ; GFX11-PAL-NEXT: s_lshl_b32 s0, s0, 2
3120 ; GFX11-PAL-NEXT: s_lshl_b32 s1, s1, 2
3121 ; GFX11-PAL-NEXT: s_addk_i32 s0, 0x4004
3122 ; GFX11-PAL-NEXT: s_addk_i32 s1, 0x4004
3123 ; GFX11-PAL-NEXT: scratch_store_b32 off, v0, s0 dlc
3124 ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0
3125 ; GFX11-PAL-NEXT: scratch_load_b32 v0, off, s1 glc dlc
3126 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
3127 ; GFX11-PAL-NEXT: s_endpgm
3129 ; GFX12-PAL-LABEL: store_load_sindex_large_offset_foo:
3130 ; GFX12-PAL: ; %bb.0: ; %bb
3131 ; GFX12-PAL-NEXT: scratch_load_b32 v0, off, off scope:SCOPE_SYS
3132 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
3133 ; GFX12-PAL-NEXT: v_mov_b32_e32 v0, 15
3134 ; GFX12-PAL-NEXT: s_and_b32 s1, s0, 15
3135 ; GFX12-PAL-NEXT: s_lshl_b32 s0, s0, 2
3136 ; GFX12-PAL-NEXT: s_lshl_b32 s1, s1, 2
3137 ; GFX12-PAL-NEXT: s_addk_co_i32 s0, 0x4000
3138 ; GFX12-PAL-NEXT: s_addk_co_i32 s1, 0x4000
3139 ; GFX12-PAL-NEXT: scratch_store_b32 off, v0, s0 scope:SCOPE_SYS
3140 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
3141 ; GFX12-PAL-NEXT: scratch_load_b32 v0, off, s1 scope:SCOPE_SYS
3142 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
3143 ; GFX12-PAL-NEXT: s_endpgm
3145 %padding = alloca [4096 x i32], align 4, addrspace(5)
3146 %i = alloca [32 x float], align 4, addrspace(5)
3147 %pad_gep = getelementptr inbounds [4096 x i32], ptr addrspace(5) %padding, i32 0, i32 undef
3148 %pad_load = load volatile i32, ptr addrspace(5) %pad_gep, align 4
3149 %i7 = getelementptr inbounds [32 x float], ptr addrspace(5) %i, i32 0, i32 %idx
3150 store volatile i32 15, ptr addrspace(5) %i7, align 4
3151 %i9 = and i32 %idx, 15
3152 %i10 = getelementptr inbounds [32 x float], ptr addrspace(5) %i, i32 0, i32 %i9
3153 %i12 = load volatile i32, ptr addrspace(5) %i10, align 4
3157 define amdgpu_kernel void @store_load_vindex_large_offset_kernel() {
3158 ; GFX9-LABEL: store_load_vindex_large_offset_kernel:
3159 ; GFX9: ; %bb.0: ; %bb
3160 ; GFX9-NEXT: s_add_u32 flat_scratch_lo, s6, s11
3161 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s7, 0
3162 ; GFX9-NEXT: s_mov_b32 s0, 0
3163 ; GFX9-NEXT: scratch_load_dword v1, off, s0 offset:4 glc
3164 ; GFX9-NEXT: s_waitcnt vmcnt(0)
3165 ; GFX9-NEXT: v_lshlrev_b32_e32 v0, 2, v0
3166 ; GFX9-NEXT: v_add_u32_e32 v1, 0x4004, v0
3167 ; GFX9-NEXT: v_mov_b32_e32 v2, 15
3168 ; GFX9-NEXT: scratch_store_dword v1, v2, off
3169 ; GFX9-NEXT: s_waitcnt vmcnt(0)
3170 ; GFX9-NEXT: v_sub_u32_e32 v0, 0x4004, v0
3171 ; GFX9-NEXT: scratch_load_dword v0, v0, off offset:124 glc
3172 ; GFX9-NEXT: s_waitcnt vmcnt(0)
3173 ; GFX9-NEXT: s_endpgm
3175 ; GFX10-LABEL: store_load_vindex_large_offset_kernel:
3176 ; GFX10: ; %bb.0: ; %bb
3177 ; GFX10-NEXT: s_add_u32 s6, s6, s11
3178 ; GFX10-NEXT: s_addc_u32 s7, s7, 0
3179 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6
3180 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7
3181 ; GFX10-NEXT: v_lshlrev_b32_e32 v0, 2, v0
3182 ; GFX10-NEXT: v_mov_b32_e32 v2, 15
3183 ; GFX10-NEXT: scratch_load_dword v3, off, off offset:4 glc dlc
3184 ; GFX10-NEXT: s_waitcnt vmcnt(0)
3185 ; GFX10-NEXT: v_add_nc_u32_e32 v1, 0x4004, v0
3186 ; GFX10-NEXT: v_sub_nc_u32_e32 v0, 0x4004, v0
3187 ; GFX10-NEXT: scratch_store_dword v1, v2, off
3188 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
3189 ; GFX10-NEXT: scratch_load_dword v0, v0, off offset:124 glc dlc
3190 ; GFX10-NEXT: s_waitcnt vmcnt(0)
3191 ; GFX10-NEXT: s_endpgm
3193 ; GFX11-LABEL: store_load_vindex_large_offset_kernel:
3194 ; GFX11: ; %bb.0: ; %bb
3195 ; GFX11-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_lshlrev_b32 v0, 2, v0
3196 ; GFX11-NEXT: s_movk_i32 s0, 0x4004
3197 ; GFX11-NEXT: scratch_load_b32 v3, off, off offset:4 glc dlc
3198 ; GFX11-NEXT: s_waitcnt vmcnt(0)
3199 ; GFX11-NEXT: v_and_b32_e32 v0, 0xffc, v0
3200 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
3201 ; GFX11-NEXT: v_sub_nc_u32_e32 v2, 0x4004, v0
3202 ; GFX11-NEXT: scratch_store_b32 v0, v1, s0 dlc
3203 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
3204 ; GFX11-NEXT: scratch_load_b32 v0, v2, off offset:124 glc dlc
3205 ; GFX11-NEXT: s_waitcnt vmcnt(0)
3206 ; GFX11-NEXT: s_endpgm
3208 ; GFX12-LABEL: store_load_vindex_large_offset_kernel:
3209 ; GFX12: ; %bb.0: ; %bb
3210 ; GFX12-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_lshlrev_b32 v0, 2, v0
3211 ; GFX12-NEXT: scratch_load_b32 v3, off, off scope:SCOPE_SYS
3212 ; GFX12-NEXT: s_wait_loadcnt 0x0
3213 ; GFX12-NEXT: v_and_b32_e32 v0, 0xffc, v0
3214 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
3215 ; GFX12-NEXT: v_sub_nc_u32_e32 v2, 0x4000, v0
3216 ; GFX12-NEXT: scratch_store_b32 v0, v1, off offset:16384 scope:SCOPE_SYS
3217 ; GFX12-NEXT: s_wait_storecnt 0x0
3218 ; GFX12-NEXT: scratch_load_b32 v0, v2, off offset:124 scope:SCOPE_SYS
3219 ; GFX12-NEXT: s_wait_loadcnt 0x0
3220 ; GFX12-NEXT: s_endpgm
3222 ; GFX9-PAL-LABEL: store_load_vindex_large_offset_kernel:
3223 ; GFX9-PAL: ; %bb.0: ; %bb
3224 ; GFX9-PAL-NEXT: s_getpc_b64 s[10:11]
3225 ; GFX9-PAL-NEXT: s_mov_b32 s10, s0
3226 ; GFX9-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
3227 ; GFX9-PAL-NEXT: s_mov_b32 s0, 0
3228 ; GFX9-PAL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
3229 ; GFX9-PAL-NEXT: v_mov_b32_e32 v2, 15
3230 ; GFX9-PAL-NEXT: s_waitcnt lgkmcnt(0)
3231 ; GFX9-PAL-NEXT: s_and_b32 s11, s11, 0xffff
3232 ; GFX9-PAL-NEXT: s_add_u32 flat_scratch_lo, s10, s9
3233 ; GFX9-PAL-NEXT: s_addc_u32 flat_scratch_hi, s11, 0
3234 ; GFX9-PAL-NEXT: scratch_load_dword v1, off, s0 offset:4 glc
3235 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
3236 ; GFX9-PAL-NEXT: v_add_u32_e32 v1, 0x4004, v0
3237 ; GFX9-PAL-NEXT: scratch_store_dword v1, v2, off
3238 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
3239 ; GFX9-PAL-NEXT: v_sub_u32_e32 v0, 0x4004, v0
3240 ; GFX9-PAL-NEXT: scratch_load_dword v0, v0, off offset:124 glc
3241 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
3242 ; GFX9-PAL-NEXT: s_endpgm
3244 ; GFX940-LABEL: store_load_vindex_large_offset_kernel:
3245 ; GFX940: ; %bb.0: ; %bb
3246 ; GFX940-NEXT: scratch_load_dword v1, off, off offset:4 sc0 sc1
3247 ; GFX940-NEXT: s_waitcnt vmcnt(0)
3248 ; GFX940-NEXT: v_lshlrev_b32_e32 v0, 2, v0
3249 ; GFX940-NEXT: v_and_b32_e32 v0, 0xffc, v0
3250 ; GFX940-NEXT: v_mov_b32_e32 v1, 15
3251 ; GFX940-NEXT: s_movk_i32 s0, 0x4004
3252 ; GFX940-NEXT: scratch_store_dword v0, v1, s0 sc0 sc1
3253 ; GFX940-NEXT: s_waitcnt vmcnt(0)
3254 ; GFX940-NEXT: v_sub_u32_e32 v0, 0x4004, v0
3255 ; GFX940-NEXT: scratch_load_dword v0, v0, off offset:124 sc0 sc1
3256 ; GFX940-NEXT: s_waitcnt vmcnt(0)
3257 ; GFX940-NEXT: s_endpgm
3259 ; GFX1010-PAL-LABEL: store_load_vindex_large_offset_kernel:
3260 ; GFX1010-PAL: ; %bb.0: ; %bb
3261 ; GFX1010-PAL-NEXT: s_getpc_b64 s[10:11]
3262 ; GFX1010-PAL-NEXT: s_mov_b32 s10, s0
3263 ; GFX1010-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
3264 ; GFX1010-PAL-NEXT: s_waitcnt lgkmcnt(0)
3265 ; GFX1010-PAL-NEXT: s_and_b32 s11, s11, 0xffff
3266 ; GFX1010-PAL-NEXT: s_add_u32 s10, s10, s9
3267 ; GFX1010-PAL-NEXT: s_addc_u32 s11, s11, 0
3268 ; GFX1010-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s10
3269 ; GFX1010-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11
3270 ; GFX1010-PAL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
3271 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v2, 15
3272 ; GFX1010-PAL-NEXT: s_mov_b32 s0, 0
3273 ; GFX1010-PAL-NEXT: scratch_load_dword v3, off, s0 offset:4 glc dlc
3274 ; GFX1010-PAL-NEXT: s_waitcnt vmcnt(0)
3275 ; GFX1010-PAL-NEXT: v_add_nc_u32_e32 v1, 0x4004, v0
3276 ; GFX1010-PAL-NEXT: v_sub_nc_u32_e32 v0, 0x4004, v0
3277 ; GFX1010-PAL-NEXT: scratch_store_dword v1, v2, off
3278 ; GFX1010-PAL-NEXT: s_waitcnt_vscnt null, 0x0
3279 ; GFX1010-PAL-NEXT: scratch_load_dword v0, v0, off offset:124 glc dlc
3280 ; GFX1010-PAL-NEXT: s_waitcnt vmcnt(0)
3281 ; GFX1010-PAL-NEXT: s_endpgm
3283 ; GFX1030-PAL-LABEL: store_load_vindex_large_offset_kernel:
3284 ; GFX1030-PAL: ; %bb.0: ; %bb
3285 ; GFX1030-PAL-NEXT: s_getpc_b64 s[10:11]
3286 ; GFX1030-PAL-NEXT: s_mov_b32 s10, s0
3287 ; GFX1030-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
3288 ; GFX1030-PAL-NEXT: s_waitcnt lgkmcnt(0)
3289 ; GFX1030-PAL-NEXT: s_and_b32 s11, s11, 0xffff
3290 ; GFX1030-PAL-NEXT: s_add_u32 s10, s10, s9
3291 ; GFX1030-PAL-NEXT: s_addc_u32 s11, s11, 0
3292 ; GFX1030-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s10
3293 ; GFX1030-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11
3294 ; GFX1030-PAL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
3295 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v2, 15
3296 ; GFX1030-PAL-NEXT: scratch_load_dword v3, off, off offset:4 glc dlc
3297 ; GFX1030-PAL-NEXT: s_waitcnt vmcnt(0)
3298 ; GFX1030-PAL-NEXT: v_add_nc_u32_e32 v1, 0x4004, v0
3299 ; GFX1030-PAL-NEXT: v_sub_nc_u32_e32 v0, 0x4004, v0
3300 ; GFX1030-PAL-NEXT: scratch_store_dword v1, v2, off
3301 ; GFX1030-PAL-NEXT: s_waitcnt_vscnt null, 0x0
3302 ; GFX1030-PAL-NEXT: scratch_load_dword v0, v0, off offset:124 glc dlc
3303 ; GFX1030-PAL-NEXT: s_waitcnt vmcnt(0)
3304 ; GFX1030-PAL-NEXT: s_endpgm
3306 ; GFX11-PAL-LABEL: store_load_vindex_large_offset_kernel:
3307 ; GFX11-PAL: ; %bb.0: ; %bb
3308 ; GFX11-PAL-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_lshlrev_b32 v0, 2, v0
3309 ; GFX11-PAL-NEXT: s_movk_i32 s0, 0x4004
3310 ; GFX11-PAL-NEXT: scratch_load_b32 v3, off, off offset:4 glc dlc
3311 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
3312 ; GFX11-PAL-NEXT: v_and_b32_e32 v0, 0xffc, v0
3313 ; GFX11-PAL-NEXT: s_delay_alu instid0(VALU_DEP_1)
3314 ; GFX11-PAL-NEXT: v_sub_nc_u32_e32 v2, 0x4004, v0
3315 ; GFX11-PAL-NEXT: scratch_store_b32 v0, v1, s0 dlc
3316 ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0
3317 ; GFX11-PAL-NEXT: scratch_load_b32 v0, v2, off offset:124 glc dlc
3318 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
3319 ; GFX11-PAL-NEXT: s_endpgm
3321 ; GFX12-PAL-LABEL: store_load_vindex_large_offset_kernel:
3322 ; GFX12-PAL: ; %bb.0: ; %bb
3323 ; GFX12-PAL-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_lshlrev_b32 v0, 2, v0
3324 ; GFX12-PAL-NEXT: scratch_load_b32 v3, off, off scope:SCOPE_SYS
3325 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
3326 ; GFX12-PAL-NEXT: v_and_b32_e32 v0, 0xffc, v0
3327 ; GFX12-PAL-NEXT: s_delay_alu instid0(VALU_DEP_1)
3328 ; GFX12-PAL-NEXT: v_sub_nc_u32_e32 v2, 0x4000, v0
3329 ; GFX12-PAL-NEXT: scratch_store_b32 v0, v1, off offset:16384 scope:SCOPE_SYS
3330 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
3331 ; GFX12-PAL-NEXT: scratch_load_b32 v0, v2, off offset:124 scope:SCOPE_SYS
3332 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
3333 ; GFX12-PAL-NEXT: s_endpgm
3335 %padding = alloca [4096 x i32], align 4, addrspace(5)
3336 %i = alloca [32 x float], align 4, addrspace(5)
3337 %pad_gep = getelementptr inbounds [4096 x i32], ptr addrspace(5) %padding, i32 0, i32 undef
3338 %pad_load = load volatile i32, ptr addrspace(5) %pad_gep, align 4
3339 %i2 = tail call i32 @llvm.amdgcn.workitem.id.x()
3340 %i3 = zext i32 %i2 to i64
3341 %i7 = getelementptr inbounds [32 x float], ptr addrspace(5) %i, i32 0, i32 %i2
3342 store volatile i32 15, ptr addrspace(5) %i7, align 4
3343 %i9 = sub nsw i32 31, %i2
3344 %i10 = getelementptr inbounds [32 x float], ptr addrspace(5) %i, i32 0, i32 %i9
3345 %i12 = load volatile i32, ptr addrspace(5) %i10, align 4
3349 define void @store_load_vindex_large_offset_foo(i32 %idx) {
3350 ; GFX9-LABEL: store_load_vindex_large_offset_foo:
3351 ; GFX9: ; %bb.0: ; %bb
3352 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3353 ; GFX9-NEXT: scratch_load_dword v1, off, s32 offset:4 glc
3354 ; GFX9-NEXT: s_waitcnt vmcnt(0)
3355 ; GFX9-NEXT: s_add_i32 s0, s32, 0x4004
3356 ; GFX9-NEXT: v_mov_b32_e32 v1, s0
3357 ; GFX9-NEXT: v_lshl_add_u32 v2, v0, 2, v1
3358 ; GFX9-NEXT: v_mov_b32_e32 v3, 15
3359 ; GFX9-NEXT: v_and_b32_e32 v0, 15, v0
3360 ; GFX9-NEXT: scratch_store_dword v2, v3, off
3361 ; GFX9-NEXT: s_waitcnt vmcnt(0)
3362 ; GFX9-NEXT: v_lshl_add_u32 v0, v0, 2, v1
3363 ; GFX9-NEXT: scratch_load_dword v0, v0, off glc
3364 ; GFX9-NEXT: s_waitcnt vmcnt(0)
3365 ; GFX9-NEXT: s_setpc_b64 s[30:31]
3367 ; GFX10-LABEL: store_load_vindex_large_offset_foo:
3368 ; GFX10: ; %bb.0: ; %bb
3369 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3370 ; GFX10-NEXT: v_and_b32_e32 v1, 15, v0
3371 ; GFX10-NEXT: s_add_i32 s0, s32, 0x4004
3372 ; GFX10-NEXT: v_mov_b32_e32 v2, 15
3373 ; GFX10-NEXT: v_lshl_add_u32 v0, v0, 2, s0
3374 ; GFX10-NEXT: s_add_i32 s0, s32, 0x4004
3375 ; GFX10-NEXT: scratch_load_dword v3, off, s32 offset:4 glc dlc
3376 ; GFX10-NEXT: s_waitcnt vmcnt(0)
3377 ; GFX10-NEXT: v_lshl_add_u32 v1, v1, 2, s0
3378 ; GFX10-NEXT: scratch_store_dword v0, v2, off
3379 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
3380 ; GFX10-NEXT: scratch_load_dword v0, v1, off glc dlc
3381 ; GFX10-NEXT: s_waitcnt vmcnt(0)
3382 ; GFX10-NEXT: s_setpc_b64 s[30:31]
3384 ; GFX11-LABEL: store_load_vindex_large_offset_foo:
3385 ; GFX11: ; %bb.0: ; %bb
3386 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3387 ; GFX11-NEXT: v_dual_mov_b32 v2, 15 :: v_dual_and_b32 v1, 15, v0
3388 ; GFX11-NEXT: s_add_i32 s0, s32, 0x4004
3389 ; GFX11-NEXT: scratch_load_b32 v3, off, s32 offset:4 glc dlc
3390 ; GFX11-NEXT: s_waitcnt vmcnt(0)
3391 ; GFX11-NEXT: v_lshl_add_u32 v0, v0, 2, s0
3392 ; GFX11-NEXT: v_lshlrev_b32_e32 v1, 2, v1
3393 ; GFX11-NEXT: s_add_i32 s0, s32, 0x4004
3394 ; GFX11-NEXT: scratch_store_b32 v0, v2, off dlc
3395 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
3396 ; GFX11-NEXT: scratch_load_b32 v0, v1, s0 glc dlc
3397 ; GFX11-NEXT: s_waitcnt vmcnt(0)
3398 ; GFX11-NEXT: s_setpc_b64 s[30:31]
3400 ; GFX12-LABEL: store_load_vindex_large_offset_foo:
3401 ; GFX12: ; %bb.0: ; %bb
3402 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
3403 ; GFX12-NEXT: s_wait_expcnt 0x0
3404 ; GFX12-NEXT: s_wait_samplecnt 0x0
3405 ; GFX12-NEXT: s_wait_bvhcnt 0x0
3406 ; GFX12-NEXT: s_wait_kmcnt 0x0
3407 ; GFX12-NEXT: v_dual_mov_b32 v2, 15 :: v_dual_and_b32 v1, 15, v0
3408 ; GFX12-NEXT: v_lshlrev_b32_e32 v0, 2, v0
3409 ; GFX12-NEXT: scratch_load_b32 v3, off, s32 scope:SCOPE_SYS
3410 ; GFX12-NEXT: s_wait_loadcnt 0x0
3411 ; GFX12-NEXT: v_lshlrev_b32_e32 v1, 2, v1
3412 ; GFX12-NEXT: s_wait_storecnt 0x0
3413 ; GFX12-NEXT: scratch_store_b32 v0, v2, s32 offset:16384 scope:SCOPE_SYS
3414 ; GFX12-NEXT: s_wait_storecnt 0x0
3415 ; GFX12-NEXT: scratch_load_b32 v0, v1, s32 offset:16384 scope:SCOPE_SYS
3416 ; GFX12-NEXT: s_wait_loadcnt 0x0
3417 ; GFX12-NEXT: s_setpc_b64 s[30:31]
3419 ; GFX9-PAL-LABEL: store_load_vindex_large_offset_foo:
3420 ; GFX9-PAL: ; %bb.0: ; %bb
3421 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3422 ; GFX9-PAL-NEXT: scratch_load_dword v1, off, s32 offset:4 glc
3423 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
3424 ; GFX9-PAL-NEXT: s_add_i32 s0, s32, 0x4004
3425 ; GFX9-PAL-NEXT: v_mov_b32_e32 v1, s0
3426 ; GFX9-PAL-NEXT: v_lshl_add_u32 v2, v0, 2, v1
3427 ; GFX9-PAL-NEXT: v_mov_b32_e32 v3, 15
3428 ; GFX9-PAL-NEXT: v_and_b32_e32 v0, 15, v0
3429 ; GFX9-PAL-NEXT: scratch_store_dword v2, v3, off
3430 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
3431 ; GFX9-PAL-NEXT: v_lshl_add_u32 v0, v0, 2, v1
3432 ; GFX9-PAL-NEXT: scratch_load_dword v0, v0, off glc
3433 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
3434 ; GFX9-PAL-NEXT: s_setpc_b64 s[30:31]
3436 ; GFX940-LABEL: store_load_vindex_large_offset_foo:
3437 ; GFX940: ; %bb.0: ; %bb
3438 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3439 ; GFX940-NEXT: scratch_load_dword v1, off, s32 offset:4 sc0 sc1
3440 ; GFX940-NEXT: s_waitcnt vmcnt(0)
3441 ; GFX940-NEXT: s_add_i32 s0, s32, 0x4004
3442 ; GFX940-NEXT: v_mov_b32_e32 v1, s0
3443 ; GFX940-NEXT: v_lshl_add_u32 v1, v0, 2, v1
3444 ; GFX940-NEXT: v_mov_b32_e32 v2, 15
3445 ; GFX940-NEXT: v_and_b32_e32 v0, 15, v0
3446 ; GFX940-NEXT: scratch_store_dword v1, v2, off sc0 sc1
3447 ; GFX940-NEXT: s_waitcnt vmcnt(0)
3448 ; GFX940-NEXT: v_lshlrev_b32_e32 v0, 2, v0
3449 ; GFX940-NEXT: s_add_i32 s0, s32, 0x4004
3450 ; GFX940-NEXT: scratch_load_dword v0, v0, s0 sc0 sc1
3451 ; GFX940-NEXT: s_waitcnt vmcnt(0)
3452 ; GFX940-NEXT: s_setpc_b64 s[30:31]
3454 ; GFX10-PAL-LABEL: store_load_vindex_large_offset_foo:
3455 ; GFX10-PAL: ; %bb.0: ; %bb
3456 ; GFX10-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3457 ; GFX10-PAL-NEXT: v_and_b32_e32 v1, 15, v0
3458 ; GFX10-PAL-NEXT: s_add_i32 s0, s32, 0x4004
3459 ; GFX10-PAL-NEXT: v_mov_b32_e32 v2, 15
3460 ; GFX10-PAL-NEXT: v_lshl_add_u32 v0, v0, 2, s0
3461 ; GFX10-PAL-NEXT: s_add_i32 s0, s32, 0x4004
3462 ; GFX10-PAL-NEXT: scratch_load_dword v3, off, s32 offset:4 glc dlc
3463 ; GFX10-PAL-NEXT: s_waitcnt vmcnt(0)
3464 ; GFX10-PAL-NEXT: v_lshl_add_u32 v1, v1, 2, s0
3465 ; GFX10-PAL-NEXT: scratch_store_dword v0, v2, off
3466 ; GFX10-PAL-NEXT: s_waitcnt_vscnt null, 0x0
3467 ; GFX10-PAL-NEXT: scratch_load_dword v0, v1, off glc dlc
3468 ; GFX10-PAL-NEXT: s_waitcnt vmcnt(0)
3469 ; GFX10-PAL-NEXT: s_setpc_b64 s[30:31]
3471 ; GFX11-PAL-LABEL: store_load_vindex_large_offset_foo:
3472 ; GFX11-PAL: ; %bb.0: ; %bb
3473 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3474 ; GFX11-PAL-NEXT: v_dual_mov_b32 v2, 15 :: v_dual_and_b32 v1, 15, v0
3475 ; GFX11-PAL-NEXT: s_add_i32 s0, s32, 0x4004
3476 ; GFX11-PAL-NEXT: scratch_load_b32 v3, off, s32 offset:4 glc dlc
3477 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
3478 ; GFX11-PAL-NEXT: v_lshl_add_u32 v0, v0, 2, s0
3479 ; GFX11-PAL-NEXT: v_lshlrev_b32_e32 v1, 2, v1
3480 ; GFX11-PAL-NEXT: s_add_i32 s0, s32, 0x4004
3481 ; GFX11-PAL-NEXT: scratch_store_b32 v0, v2, off dlc
3482 ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0
3483 ; GFX11-PAL-NEXT: scratch_load_b32 v0, v1, s0 glc dlc
3484 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
3485 ; GFX11-PAL-NEXT: s_setpc_b64 s[30:31]
3487 ; GFX12-PAL-LABEL: store_load_vindex_large_offset_foo:
3488 ; GFX12-PAL: ; %bb.0: ; %bb
3489 ; GFX12-PAL-NEXT: s_wait_loadcnt_dscnt 0x0
3490 ; GFX12-PAL-NEXT: s_wait_expcnt 0x0
3491 ; GFX12-PAL-NEXT: s_wait_samplecnt 0x0
3492 ; GFX12-PAL-NEXT: s_wait_bvhcnt 0x0
3493 ; GFX12-PAL-NEXT: s_wait_kmcnt 0x0
3494 ; GFX12-PAL-NEXT: v_dual_mov_b32 v2, 15 :: v_dual_and_b32 v1, 15, v0
3495 ; GFX12-PAL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
3496 ; GFX12-PAL-NEXT: scratch_load_b32 v3, off, s32 scope:SCOPE_SYS
3497 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
3498 ; GFX12-PAL-NEXT: v_lshlrev_b32_e32 v1, 2, v1
3499 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
3500 ; GFX12-PAL-NEXT: scratch_store_b32 v0, v2, s32 offset:16384 scope:SCOPE_SYS
3501 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
3502 ; GFX12-PAL-NEXT: scratch_load_b32 v0, v1, s32 offset:16384 scope:SCOPE_SYS
3503 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
3504 ; GFX12-PAL-NEXT: s_setpc_b64 s[30:31]
3506 %padding = alloca [4096 x i32], align 4, addrspace(5)
3507 %i = alloca [32 x float], align 4, addrspace(5)
3508 %pad_gep = getelementptr inbounds [4096 x i32], ptr addrspace(5) %padding, i32 0, i32 undef
3509 %pad_load = load volatile i32, ptr addrspace(5) %pad_gep, align 4
3510 %i7 = getelementptr inbounds [32 x float], ptr addrspace(5) %i, i32 0, i32 %idx
3511 store volatile i32 15, ptr addrspace(5) %i7, align 4
3512 %i9 = and i32 %idx, 15
3513 %i10 = getelementptr inbounds [32 x float], ptr addrspace(5) %i, i32 0, i32 %i9
3514 %i12 = load volatile i32, ptr addrspace(5) %i10, align 4
3518 define amdgpu_kernel void @store_load_large_imm_offset_kernel() {
3519 ; GFX9-LABEL: store_load_large_imm_offset_kernel:
3520 ; GFX9: ; %bb.0: ; %bb
3521 ; GFX9-NEXT: s_add_u32 flat_scratch_lo, s6, s11
3522 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s7, 0
3523 ; GFX9-NEXT: v_mov_b32_e32 v0, 13
3524 ; GFX9-NEXT: s_mov_b32 s0, 0
3525 ; GFX9-NEXT: scratch_store_dword off, v0, s0 offset:4
3526 ; GFX9-NEXT: s_waitcnt vmcnt(0)
3527 ; GFX9-NEXT: s_movk_i32 s0, 0x3000
3528 ; GFX9-NEXT: s_add_i32 s0, s0, 4
3529 ; GFX9-NEXT: v_mov_b32_e32 v0, 15
3530 ; GFX9-NEXT: scratch_store_dword off, v0, s0 offset:3712
3531 ; GFX9-NEXT: s_waitcnt vmcnt(0)
3532 ; GFX9-NEXT: scratch_load_dword v0, off, s0 offset:3712 glc
3533 ; GFX9-NEXT: s_waitcnt vmcnt(0)
3534 ; GFX9-NEXT: s_endpgm
3536 ; GFX10-LABEL: store_load_large_imm_offset_kernel:
3537 ; GFX10: ; %bb.0: ; %bb
3538 ; GFX10-NEXT: s_add_u32 s6, s6, s11
3539 ; GFX10-NEXT: s_addc_u32 s7, s7, 0
3540 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6
3541 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7
3542 ; GFX10-NEXT: v_mov_b32_e32 v0, 13
3543 ; GFX10-NEXT: v_mov_b32_e32 v1, 15
3544 ; GFX10-NEXT: s_movk_i32 s0, 0x3800
3545 ; GFX10-NEXT: s_add_i32 s0, s0, 4
3546 ; GFX10-NEXT: scratch_store_dword off, v0, off offset:4
3547 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
3548 ; GFX10-NEXT: scratch_store_dword off, v1, s0 offset:1664
3549 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
3550 ; GFX10-NEXT: scratch_load_dword v0, off, s0 offset:1664 glc dlc
3551 ; GFX10-NEXT: s_waitcnt vmcnt(0)
3552 ; GFX10-NEXT: s_endpgm
3554 ; GFX11-LABEL: store_load_large_imm_offset_kernel:
3555 ; GFX11: ; %bb.0: ; %bb
3556 ; GFX11-NEXT: v_dual_mov_b32 v0, 13 :: v_dual_mov_b32 v1, 0x3000
3557 ; GFX11-NEXT: v_mov_b32_e32 v2, 15
3558 ; GFX11-NEXT: scratch_store_b32 off, v0, off offset:4 dlc
3559 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
3560 ; GFX11-NEXT: scratch_store_b32 v1, v2, off offset:3716 dlc
3561 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
3562 ; GFX11-NEXT: scratch_load_b32 v0, v1, off offset:3716 glc dlc
3563 ; GFX11-NEXT: s_waitcnt vmcnt(0)
3564 ; GFX11-NEXT: s_endpgm
3566 ; GFX12-LABEL: store_load_large_imm_offset_kernel:
3567 ; GFX12: ; %bb.0: ; %bb
3568 ; GFX12-NEXT: v_dual_mov_b32 v0, 13 :: v_dual_mov_b32 v1, 15
3569 ; GFX12-NEXT: scratch_store_b32 off, v0, off scope:SCOPE_SYS
3570 ; GFX12-NEXT: s_wait_storecnt 0x0
3571 ; GFX12-NEXT: scratch_store_b32 off, v1, off offset:16000 scope:SCOPE_SYS
3572 ; GFX12-NEXT: s_wait_storecnt 0x0
3573 ; GFX12-NEXT: scratch_load_b32 v0, off, off offset:16000 scope:SCOPE_SYS
3574 ; GFX12-NEXT: s_wait_loadcnt 0x0
3575 ; GFX12-NEXT: s_endpgm
3577 ; GFX9-PAL-LABEL: store_load_large_imm_offset_kernel:
3578 ; GFX9-PAL: ; %bb.0: ; %bb
3579 ; GFX9-PAL-NEXT: s_getpc_b64 s[10:11]
3580 ; GFX9-PAL-NEXT: s_mov_b32 s10, s0
3581 ; GFX9-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
3582 ; GFX9-PAL-NEXT: v_mov_b32_e32 v0, 13
3583 ; GFX9-PAL-NEXT: s_mov_b32 s0, 0
3584 ; GFX9-PAL-NEXT: s_waitcnt lgkmcnt(0)
3585 ; GFX9-PAL-NEXT: s_and_b32 s11, s11, 0xffff
3586 ; GFX9-PAL-NEXT: s_add_u32 flat_scratch_lo, s10, s9
3587 ; GFX9-PAL-NEXT: s_addc_u32 flat_scratch_hi, s11, 0
3588 ; GFX9-PAL-NEXT: scratch_store_dword off, v0, s0 offset:4
3589 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
3590 ; GFX9-PAL-NEXT: s_movk_i32 s0, 0x3000
3591 ; GFX9-PAL-NEXT: s_add_i32 s0, s0, 4
3592 ; GFX9-PAL-NEXT: v_mov_b32_e32 v0, 15
3593 ; GFX9-PAL-NEXT: scratch_store_dword off, v0, s0 offset:3712
3594 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
3595 ; GFX9-PAL-NEXT: scratch_load_dword v0, off, s0 offset:3712 glc
3596 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
3597 ; GFX9-PAL-NEXT: s_endpgm
3599 ; GFX940-LABEL: store_load_large_imm_offset_kernel:
3600 ; GFX940: ; %bb.0: ; %bb
3601 ; GFX940-NEXT: v_mov_b32_e32 v0, 13
3602 ; GFX940-NEXT: scratch_store_dword off, v0, off offset:4 sc0 sc1
3603 ; GFX940-NEXT: s_waitcnt vmcnt(0)
3604 ; GFX940-NEXT: v_mov_b32_e32 v0, 0x3000
3605 ; GFX940-NEXT: v_mov_b32_e32 v1, 15
3606 ; GFX940-NEXT: scratch_store_dword v0, v1, off offset:3716 sc0 sc1
3607 ; GFX940-NEXT: s_waitcnt vmcnt(0)
3608 ; GFX940-NEXT: scratch_load_dword v0, v0, off offset:3716 sc0 sc1
3609 ; GFX940-NEXT: s_waitcnt vmcnt(0)
3610 ; GFX940-NEXT: s_endpgm
3612 ; GFX1010-PAL-LABEL: store_load_large_imm_offset_kernel:
3613 ; GFX1010-PAL: ; %bb.0: ; %bb
3614 ; GFX1010-PAL-NEXT: s_getpc_b64 s[10:11]
3615 ; GFX1010-PAL-NEXT: s_mov_b32 s10, s0
3616 ; GFX1010-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
3617 ; GFX1010-PAL-NEXT: s_waitcnt lgkmcnt(0)
3618 ; GFX1010-PAL-NEXT: s_and_b32 s11, s11, 0xffff
3619 ; GFX1010-PAL-NEXT: s_add_u32 s10, s10, s9
3620 ; GFX1010-PAL-NEXT: s_addc_u32 s11, s11, 0
3621 ; GFX1010-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s10
3622 ; GFX1010-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11
3623 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v0, 13
3624 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v1, 15
3625 ; GFX1010-PAL-NEXT: s_movk_i32 s0, 0x3800
3626 ; GFX1010-PAL-NEXT: s_mov_b32 s1, 0
3627 ; GFX1010-PAL-NEXT: s_add_i32 s0, s0, 4
3628 ; GFX1010-PAL-NEXT: scratch_store_dword off, v0, s1 offset:4
3629 ; GFX1010-PAL-NEXT: s_waitcnt_vscnt null, 0x0
3630 ; GFX1010-PAL-NEXT: scratch_store_dword off, v1, s0 offset:1664
3631 ; GFX1010-PAL-NEXT: s_waitcnt_vscnt null, 0x0
3632 ; GFX1010-PAL-NEXT: scratch_load_dword v0, off, s0 offset:1664 glc dlc
3633 ; GFX1010-PAL-NEXT: s_waitcnt vmcnt(0)
3634 ; GFX1010-PAL-NEXT: s_endpgm
3636 ; GFX1030-PAL-LABEL: store_load_large_imm_offset_kernel:
3637 ; GFX1030-PAL: ; %bb.0: ; %bb
3638 ; GFX1030-PAL-NEXT: s_getpc_b64 s[10:11]
3639 ; GFX1030-PAL-NEXT: s_mov_b32 s10, s0
3640 ; GFX1030-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
3641 ; GFX1030-PAL-NEXT: s_waitcnt lgkmcnt(0)
3642 ; GFX1030-PAL-NEXT: s_and_b32 s11, s11, 0xffff
3643 ; GFX1030-PAL-NEXT: s_add_u32 s10, s10, s9
3644 ; GFX1030-PAL-NEXT: s_addc_u32 s11, s11, 0
3645 ; GFX1030-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s10
3646 ; GFX1030-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11
3647 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v0, 13
3648 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v1, 15
3649 ; GFX1030-PAL-NEXT: s_movk_i32 s0, 0x3800
3650 ; GFX1030-PAL-NEXT: s_add_i32 s0, s0, 4
3651 ; GFX1030-PAL-NEXT: scratch_store_dword off, v0, off offset:4
3652 ; GFX1030-PAL-NEXT: s_waitcnt_vscnt null, 0x0
3653 ; GFX1030-PAL-NEXT: scratch_store_dword off, v1, s0 offset:1664
3654 ; GFX1030-PAL-NEXT: s_waitcnt_vscnt null, 0x0
3655 ; GFX1030-PAL-NEXT: scratch_load_dword v0, off, s0 offset:1664 glc dlc
3656 ; GFX1030-PAL-NEXT: s_waitcnt vmcnt(0)
3657 ; GFX1030-PAL-NEXT: s_endpgm
3659 ; GFX11-PAL-LABEL: store_load_large_imm_offset_kernel:
3660 ; GFX11-PAL: ; %bb.0: ; %bb
3661 ; GFX11-PAL-NEXT: v_dual_mov_b32 v0, 13 :: v_dual_mov_b32 v1, 0x3000
3662 ; GFX11-PAL-NEXT: v_mov_b32_e32 v2, 15
3663 ; GFX11-PAL-NEXT: scratch_store_b32 off, v0, off offset:4 dlc
3664 ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0
3665 ; GFX11-PAL-NEXT: scratch_store_b32 v1, v2, off offset:3716 dlc
3666 ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0
3667 ; GFX11-PAL-NEXT: scratch_load_b32 v0, v1, off offset:3716 glc dlc
3668 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
3669 ; GFX11-PAL-NEXT: s_endpgm
3671 ; GFX12-PAL-LABEL: store_load_large_imm_offset_kernel:
3672 ; GFX12-PAL: ; %bb.0: ; %bb
3673 ; GFX12-PAL-NEXT: v_dual_mov_b32 v0, 13 :: v_dual_mov_b32 v1, 15
3674 ; GFX12-PAL-NEXT: scratch_store_b32 off, v0, off scope:SCOPE_SYS
3675 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
3676 ; GFX12-PAL-NEXT: scratch_store_b32 off, v1, off offset:16000 scope:SCOPE_SYS
3677 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
3678 ; GFX12-PAL-NEXT: scratch_load_b32 v0, off, off offset:16000 scope:SCOPE_SYS
3679 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
3680 ; GFX12-PAL-NEXT: s_endpgm
3682 %i = alloca [4096 x i32], align 4, addrspace(5)
3683 %i1 = getelementptr inbounds [4096 x i32], ptr addrspace(5) %i, i32 0, i32 undef
3684 store volatile i32 13, ptr addrspace(5) %i1, align 4
3685 %i7 = getelementptr inbounds [4096 x i32], ptr addrspace(5) %i, i32 0, i32 4000
3686 store volatile i32 15, ptr addrspace(5) %i7, align 4
3687 %i10 = getelementptr inbounds [4096 x i32], ptr addrspace(5) %i, i32 0, i32 4000
3688 %i12 = load volatile i32, ptr addrspace(5) %i10, align 4
3692 define void @store_load_large_imm_offset_foo() {
3693 ; GFX9-LABEL: store_load_large_imm_offset_foo:
3694 ; GFX9: ; %bb.0: ; %bb
3695 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3696 ; GFX9-NEXT: v_mov_b32_e32 v0, 13
3697 ; GFX9-NEXT: s_movk_i32 s0, 0x3000
3698 ; GFX9-NEXT: s_add_i32 s1, s32, 4
3699 ; GFX9-NEXT: scratch_store_dword off, v0, s32 offset:4
3700 ; GFX9-NEXT: s_waitcnt vmcnt(0)
3701 ; GFX9-NEXT: s_add_i32 s0, s0, s1
3702 ; GFX9-NEXT: v_mov_b32_e32 v0, 15
3703 ; GFX9-NEXT: scratch_store_dword off, v0, s0 offset:3712
3704 ; GFX9-NEXT: s_waitcnt vmcnt(0)
3705 ; GFX9-NEXT: scratch_load_dword v0, off, s0 offset:3712 glc
3706 ; GFX9-NEXT: s_waitcnt vmcnt(0)
3707 ; GFX9-NEXT: s_setpc_b64 s[30:31]
3709 ; GFX10-LABEL: store_load_large_imm_offset_foo:
3710 ; GFX10: ; %bb.0: ; %bb
3711 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3712 ; GFX10-NEXT: v_mov_b32_e32 v0, 13
3713 ; GFX10-NEXT: v_mov_b32_e32 v1, 15
3714 ; GFX10-NEXT: s_movk_i32 s0, 0x3800
3715 ; GFX10-NEXT: s_add_i32 s1, s32, 4
3716 ; GFX10-NEXT: s_add_i32 s0, s0, s1
3717 ; GFX10-NEXT: scratch_store_dword off, v0, s32 offset:4
3718 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
3719 ; GFX10-NEXT: scratch_store_dword off, v1, s0 offset:1664
3720 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
3721 ; GFX10-NEXT: scratch_load_dword v0, off, s0 offset:1664 glc dlc
3722 ; GFX10-NEXT: s_waitcnt vmcnt(0)
3723 ; GFX10-NEXT: s_setpc_b64 s[30:31]
3725 ; GFX11-LABEL: store_load_large_imm_offset_foo:
3726 ; GFX11: ; %bb.0: ; %bb
3727 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3728 ; GFX11-NEXT: v_dual_mov_b32 v0, 13 :: v_dual_mov_b32 v1, 0x3000
3729 ; GFX11-NEXT: v_mov_b32_e32 v2, 15
3730 ; GFX11-NEXT: scratch_store_b32 off, v0, s32 offset:4 dlc
3731 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
3732 ; GFX11-NEXT: scratch_store_b32 v1, v2, s32 offset:3716 dlc
3733 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
3734 ; GFX11-NEXT: scratch_load_b32 v0, v1, s32 offset:3716 glc dlc
3735 ; GFX11-NEXT: s_waitcnt vmcnt(0)
3736 ; GFX11-NEXT: s_setpc_b64 s[30:31]
3738 ; GFX12-LABEL: store_load_large_imm_offset_foo:
3739 ; GFX12: ; %bb.0: ; %bb
3740 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
3741 ; GFX12-NEXT: s_wait_expcnt 0x0
3742 ; GFX12-NEXT: s_wait_samplecnt 0x0
3743 ; GFX12-NEXT: s_wait_bvhcnt 0x0
3744 ; GFX12-NEXT: s_wait_kmcnt 0x0
3745 ; GFX12-NEXT: v_dual_mov_b32 v0, 13 :: v_dual_mov_b32 v1, 15
3746 ; GFX12-NEXT: s_wait_storecnt 0x0
3747 ; GFX12-NEXT: scratch_store_b32 off, v0, s32 scope:SCOPE_SYS
3748 ; GFX12-NEXT: s_wait_storecnt 0x0
3749 ; GFX12-NEXT: scratch_store_b32 off, v1, s32 offset:16000 scope:SCOPE_SYS
3750 ; GFX12-NEXT: s_wait_storecnt 0x0
3751 ; GFX12-NEXT: scratch_load_b32 v0, off, s32 offset:16000 scope:SCOPE_SYS
3752 ; GFX12-NEXT: s_wait_loadcnt 0x0
3753 ; GFX12-NEXT: s_setpc_b64 s[30:31]
3755 ; GFX9-PAL-LABEL: store_load_large_imm_offset_foo:
3756 ; GFX9-PAL: ; %bb.0: ; %bb
3757 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3758 ; GFX9-PAL-NEXT: v_mov_b32_e32 v0, 13
3759 ; GFX9-PAL-NEXT: s_movk_i32 s0, 0x3000
3760 ; GFX9-PAL-NEXT: s_add_i32 s1, s32, 4
3761 ; GFX9-PAL-NEXT: scratch_store_dword off, v0, s32 offset:4
3762 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
3763 ; GFX9-PAL-NEXT: s_add_i32 s0, s0, s1
3764 ; GFX9-PAL-NEXT: v_mov_b32_e32 v0, 15
3765 ; GFX9-PAL-NEXT: scratch_store_dword off, v0, s0 offset:3712
3766 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
3767 ; GFX9-PAL-NEXT: scratch_load_dword v0, off, s0 offset:3712 glc
3768 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
3769 ; GFX9-PAL-NEXT: s_setpc_b64 s[30:31]
3771 ; GFX940-LABEL: store_load_large_imm_offset_foo:
3772 ; GFX940: ; %bb.0: ; %bb
3773 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3774 ; GFX940-NEXT: v_mov_b32_e32 v0, 13
3775 ; GFX940-NEXT: scratch_store_dword off, v0, s32 offset:4 sc0 sc1
3776 ; GFX940-NEXT: s_waitcnt vmcnt(0)
3777 ; GFX940-NEXT: v_mov_b32_e32 v0, 0x3000
3778 ; GFX940-NEXT: v_mov_b32_e32 v1, 15
3779 ; GFX940-NEXT: scratch_store_dword v0, v1, s32 offset:3716 sc0 sc1
3780 ; GFX940-NEXT: s_waitcnt vmcnt(0)
3781 ; GFX940-NEXT: scratch_load_dword v0, v0, s32 offset:3716 sc0 sc1
3782 ; GFX940-NEXT: s_waitcnt vmcnt(0)
3783 ; GFX940-NEXT: s_setpc_b64 s[30:31]
3785 ; GFX10-PAL-LABEL: store_load_large_imm_offset_foo:
3786 ; GFX10-PAL: ; %bb.0: ; %bb
3787 ; GFX10-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3788 ; GFX10-PAL-NEXT: v_mov_b32_e32 v0, 13
3789 ; GFX10-PAL-NEXT: v_mov_b32_e32 v1, 15
3790 ; GFX10-PAL-NEXT: s_movk_i32 s0, 0x3800
3791 ; GFX10-PAL-NEXT: s_add_i32 s1, s32, 4
3792 ; GFX10-PAL-NEXT: s_add_i32 s0, s0, s1
3793 ; GFX10-PAL-NEXT: scratch_store_dword off, v0, s32 offset:4
3794 ; GFX10-PAL-NEXT: s_waitcnt_vscnt null, 0x0
3795 ; GFX10-PAL-NEXT: scratch_store_dword off, v1, s0 offset:1664
3796 ; GFX10-PAL-NEXT: s_waitcnt_vscnt null, 0x0
3797 ; GFX10-PAL-NEXT: scratch_load_dword v0, off, s0 offset:1664 glc dlc
3798 ; GFX10-PAL-NEXT: s_waitcnt vmcnt(0)
3799 ; GFX10-PAL-NEXT: s_setpc_b64 s[30:31]
3801 ; GFX11-PAL-LABEL: store_load_large_imm_offset_foo:
3802 ; GFX11-PAL: ; %bb.0: ; %bb
3803 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3804 ; GFX11-PAL-NEXT: v_dual_mov_b32 v0, 13 :: v_dual_mov_b32 v1, 0x3000
3805 ; GFX11-PAL-NEXT: v_mov_b32_e32 v2, 15
3806 ; GFX11-PAL-NEXT: scratch_store_b32 off, v0, s32 offset:4 dlc
3807 ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0
3808 ; GFX11-PAL-NEXT: scratch_store_b32 v1, v2, s32 offset:3716 dlc
3809 ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0
3810 ; GFX11-PAL-NEXT: scratch_load_b32 v0, v1, s32 offset:3716 glc dlc
3811 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
3812 ; GFX11-PAL-NEXT: s_setpc_b64 s[30:31]
3814 ; GFX12-PAL-LABEL: store_load_large_imm_offset_foo:
3815 ; GFX12-PAL: ; %bb.0: ; %bb
3816 ; GFX12-PAL-NEXT: s_wait_loadcnt_dscnt 0x0
3817 ; GFX12-PAL-NEXT: s_wait_expcnt 0x0
3818 ; GFX12-PAL-NEXT: s_wait_samplecnt 0x0
3819 ; GFX12-PAL-NEXT: s_wait_bvhcnt 0x0
3820 ; GFX12-PAL-NEXT: s_wait_kmcnt 0x0
3821 ; GFX12-PAL-NEXT: v_dual_mov_b32 v0, 13 :: v_dual_mov_b32 v1, 15
3822 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
3823 ; GFX12-PAL-NEXT: scratch_store_b32 off, v0, s32 scope:SCOPE_SYS
3824 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
3825 ; GFX12-PAL-NEXT: scratch_store_b32 off, v1, s32 offset:16000 scope:SCOPE_SYS
3826 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
3827 ; GFX12-PAL-NEXT: scratch_load_b32 v0, off, s32 offset:16000 scope:SCOPE_SYS
3828 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
3829 ; GFX12-PAL-NEXT: s_setpc_b64 s[30:31]
3831 %i = alloca [4096 x i32], align 4, addrspace(5)
3832 %i1 = getelementptr inbounds [4096 x i32], ptr addrspace(5) %i, i32 0, i32 undef
3833 store volatile i32 13, ptr addrspace(5) %i1, align 4
3834 %i7 = getelementptr inbounds [4096 x i32], ptr addrspace(5) %i, i32 0, i32 4000
3835 store volatile i32 15, ptr addrspace(5) %i7, align 4
3836 %i10 = getelementptr inbounds [4096 x i32], ptr addrspace(5) %i, i32 0, i32 4000
3837 %i12 = load volatile i32, ptr addrspace(5) %i10, align 4
3841 define amdgpu_kernel void @store_load_vidx_sidx_offset(i32 %sidx) {
3842 ; GFX9-LABEL: store_load_vidx_sidx_offset:
3843 ; GFX9: ; %bb.0: ; %bb
3844 ; GFX9-NEXT: s_load_dword s0, s[2:3], 0x24
3845 ; GFX9-NEXT: s_add_u32 flat_scratch_lo, s6, s11
3846 ; GFX9-NEXT: v_mov_b32_e32 v1, 0
3847 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s7, 0
3848 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
3849 ; GFX9-NEXT: v_add_u32_e32 v0, s0, v0
3850 ; GFX9-NEXT: v_lshl_add_u32 v0, v0, 2, v1
3851 ; GFX9-NEXT: v_mov_b32_e32 v1, 15
3852 ; GFX9-NEXT: scratch_store_dword v0, v1, off offset:1024
3853 ; GFX9-NEXT: s_waitcnt vmcnt(0)
3854 ; GFX9-NEXT: scratch_load_dword v0, v0, off offset:1024 glc
3855 ; GFX9-NEXT: s_waitcnt vmcnt(0)
3856 ; GFX9-NEXT: s_endpgm
3858 ; GFX10-LABEL: store_load_vidx_sidx_offset:
3859 ; GFX10: ; %bb.0: ; %bb
3860 ; GFX10-NEXT: s_add_u32 s6, s6, s11
3861 ; GFX10-NEXT: s_addc_u32 s7, s7, 0
3862 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6
3863 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7
3864 ; GFX10-NEXT: s_load_dword s0, s[2:3], 0x24
3865 ; GFX10-NEXT: v_mov_b32_e32 v1, 15
3866 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
3867 ; GFX10-NEXT: v_add_nc_u32_e32 v0, s0, v0
3868 ; GFX10-NEXT: v_lshl_add_u32 v0, v0, 2, 0
3869 ; GFX10-NEXT: scratch_store_dword v0, v1, off offset:1024
3870 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
3871 ; GFX10-NEXT: scratch_load_dword v0, v0, off offset:1024 glc dlc
3872 ; GFX10-NEXT: s_waitcnt vmcnt(0)
3873 ; GFX10-NEXT: s_endpgm
3875 ; GFX11-LABEL: store_load_vidx_sidx_offset:
3876 ; GFX11: ; %bb.0: ; %bb
3877 ; GFX11-NEXT: s_load_b32 s0, s[2:3], 0x24
3878 ; GFX11-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_and_b32 v0, 0x3ff, v0
3879 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
3880 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
3881 ; GFX11-NEXT: v_add_nc_u32_e32 v0, s0, v0
3882 ; GFX11-NEXT: v_lshl_add_u32 v0, v0, 2, 0
3883 ; GFX11-NEXT: scratch_store_b32 v0, v1, off offset:1024 dlc
3884 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
3885 ; GFX11-NEXT: scratch_load_b32 v0, v0, off offset:1024 glc dlc
3886 ; GFX11-NEXT: s_waitcnt vmcnt(0)
3887 ; GFX11-NEXT: s_endpgm
3889 ; GFX12-LABEL: store_load_vidx_sidx_offset:
3890 ; GFX12: ; %bb.0: ; %bb
3891 ; GFX12-NEXT: s_load_b32 s0, s[2:3], 0x24
3892 ; GFX12-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_and_b32 v0, 0x3ff, v0
3893 ; GFX12-NEXT: s_wait_kmcnt 0x0
3894 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
3895 ; GFX12-NEXT: v_add_lshl_u32 v0, s0, v0, 2
3896 ; GFX12-NEXT: scratch_store_b32 v0, v1, off offset:1024 scope:SCOPE_SYS
3897 ; GFX12-NEXT: s_wait_storecnt 0x0
3898 ; GFX12-NEXT: scratch_load_b32 v0, v0, off offset:1024 scope:SCOPE_SYS
3899 ; GFX12-NEXT: s_wait_loadcnt 0x0
3900 ; GFX12-NEXT: s_endpgm
3902 ; GFX9-PAL-LABEL: store_load_vidx_sidx_offset:
3903 ; GFX9-PAL: ; %bb.0: ; %bb
3904 ; GFX9-PAL-NEXT: s_getpc_b64 s[10:11]
3905 ; GFX9-PAL-NEXT: s_mov_b32 s10, s0
3906 ; GFX9-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
3907 ; GFX9-PAL-NEXT: v_mov_b32_e32 v1, 0
3908 ; GFX9-PAL-NEXT: s_load_dword s0, s[2:3], 0x0
3909 ; GFX9-PAL-NEXT: s_waitcnt lgkmcnt(0)
3910 ; GFX9-PAL-NEXT: s_and_b32 s11, s11, 0xffff
3911 ; GFX9-PAL-NEXT: s_add_u32 flat_scratch_lo, s10, s9
3912 ; GFX9-PAL-NEXT: v_add_u32_e32 v0, s0, v0
3913 ; GFX9-PAL-NEXT: s_addc_u32 flat_scratch_hi, s11, 0
3914 ; GFX9-PAL-NEXT: v_lshl_add_u32 v0, v0, 2, v1
3915 ; GFX9-PAL-NEXT: v_mov_b32_e32 v1, 15
3916 ; GFX9-PAL-NEXT: scratch_store_dword v0, v1, off offset:1024
3917 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
3918 ; GFX9-PAL-NEXT: scratch_load_dword v0, v0, off offset:1024 glc
3919 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
3920 ; GFX9-PAL-NEXT: s_endpgm
3922 ; GFX940-LABEL: store_load_vidx_sidx_offset:
3923 ; GFX940: ; %bb.0: ; %bb
3924 ; GFX940-NEXT: s_load_dword s0, s[2:3], 0x24
3925 ; GFX940-NEXT: v_and_b32_e32 v0, 0x3ff, v0
3926 ; GFX940-NEXT: v_mov_b32_e32 v1, 0
3927 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
3928 ; GFX940-NEXT: v_add_u32_e32 v0, s0, v0
3929 ; GFX940-NEXT: v_lshl_add_u32 v0, v0, 2, v1
3930 ; GFX940-NEXT: v_mov_b32_e32 v1, 15
3931 ; GFX940-NEXT: scratch_store_dword v0, v1, off offset:1024 sc0 sc1
3932 ; GFX940-NEXT: s_waitcnt vmcnt(0)
3933 ; GFX940-NEXT: scratch_load_dword v0, v0, off offset:1024 sc0 sc1
3934 ; GFX940-NEXT: s_waitcnt vmcnt(0)
3935 ; GFX940-NEXT: s_endpgm
3937 ; GFX10-PAL-LABEL: store_load_vidx_sidx_offset:
3938 ; GFX10-PAL: ; %bb.0: ; %bb
3939 ; GFX10-PAL-NEXT: s_getpc_b64 s[10:11]
3940 ; GFX10-PAL-NEXT: s_mov_b32 s10, s0
3941 ; GFX10-PAL-NEXT: s_load_dwordx2 s[10:11], s[10:11], 0x0
3942 ; GFX10-PAL-NEXT: s_waitcnt lgkmcnt(0)
3943 ; GFX10-PAL-NEXT: s_and_b32 s11, s11, 0xffff
3944 ; GFX10-PAL-NEXT: s_add_u32 s10, s10, s9
3945 ; GFX10-PAL-NEXT: s_addc_u32 s11, s11, 0
3946 ; GFX10-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s10
3947 ; GFX10-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11
3948 ; GFX10-PAL-NEXT: s_load_dword s0, s[2:3], 0x0
3949 ; GFX10-PAL-NEXT: v_mov_b32_e32 v1, 15
3950 ; GFX10-PAL-NEXT: s_waitcnt lgkmcnt(0)
3951 ; GFX10-PAL-NEXT: v_add_nc_u32_e32 v0, s0, v0
3952 ; GFX10-PAL-NEXT: v_lshl_add_u32 v0, v0, 2, 0
3953 ; GFX10-PAL-NEXT: scratch_store_dword v0, v1, off offset:1024
3954 ; GFX10-PAL-NEXT: s_waitcnt_vscnt null, 0x0
3955 ; GFX10-PAL-NEXT: scratch_load_dword v0, v0, off offset:1024 glc dlc
3956 ; GFX10-PAL-NEXT: s_waitcnt vmcnt(0)
3957 ; GFX10-PAL-NEXT: s_endpgm
3959 ; GFX11-PAL-LABEL: store_load_vidx_sidx_offset:
3960 ; GFX11-PAL: ; %bb.0: ; %bb
3961 ; GFX11-PAL-NEXT: s_load_b32 s0, s[2:3], 0x0
3962 ; GFX11-PAL-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_and_b32 v0, 0x3ff, v0
3963 ; GFX11-PAL-NEXT: s_waitcnt lgkmcnt(0)
3964 ; GFX11-PAL-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
3965 ; GFX11-PAL-NEXT: v_add_nc_u32_e32 v0, s0, v0
3966 ; GFX11-PAL-NEXT: v_lshl_add_u32 v0, v0, 2, 0
3967 ; GFX11-PAL-NEXT: scratch_store_b32 v0, v1, off offset:1024 dlc
3968 ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0
3969 ; GFX11-PAL-NEXT: scratch_load_b32 v0, v0, off offset:1024 glc dlc
3970 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
3971 ; GFX11-PAL-NEXT: s_endpgm
3973 ; GFX12-PAL-LABEL: store_load_vidx_sidx_offset:
3974 ; GFX12-PAL: ; %bb.0: ; %bb
3975 ; GFX12-PAL-NEXT: s_load_b32 s0, s[2:3], 0x0
3976 ; GFX12-PAL-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_and_b32 v0, 0x3ff, v0
3977 ; GFX12-PAL-NEXT: s_wait_kmcnt 0x0
3978 ; GFX12-PAL-NEXT: s_delay_alu instid0(VALU_DEP_1)
3979 ; GFX12-PAL-NEXT: v_add_lshl_u32 v0, s0, v0, 2
3980 ; GFX12-PAL-NEXT: scratch_store_b32 v0, v1, off offset:1024 scope:SCOPE_SYS
3981 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
3982 ; GFX12-PAL-NEXT: scratch_load_b32 v0, v0, off offset:1024 scope:SCOPE_SYS
3983 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
3984 ; GFX12-PAL-NEXT: s_endpgm
3986 %alloca = alloca [32 x i32], align 4, addrspace(5)
3987 %vidx = tail call i32 @llvm.amdgcn.workitem.id.x()
3988 %add1 = add nsw i32 %sidx, %vidx
3989 %add2 = add nsw i32 %add1, 256
3990 %gep = getelementptr inbounds [32 x i32], ptr addrspace(5) %alloca, i32 0, i32 %add2
3991 store volatile i32 15, ptr addrspace(5) %gep, align 4
3992 %load = load volatile i32, ptr addrspace(5) %gep, align 4
3996 define void @store_load_i64_aligned(ptr addrspace(5) nocapture %arg) {
3997 ; GFX9-LABEL: store_load_i64_aligned:
3998 ; GFX9: ; %bb.0: ; %bb
3999 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4000 ; GFX9-NEXT: v_mov_b32_e32 v1, 15
4001 ; GFX9-NEXT: v_mov_b32_e32 v2, 0
4002 ; GFX9-NEXT: scratch_store_dwordx2 v0, v[1:2], off
4003 ; GFX9-NEXT: s_waitcnt vmcnt(0)
4004 ; GFX9-NEXT: scratch_load_dwordx2 v[0:1], v0, off glc
4005 ; GFX9-NEXT: s_waitcnt vmcnt(0)
4006 ; GFX9-NEXT: s_setpc_b64 s[30:31]
4008 ; GFX10-LABEL: store_load_i64_aligned:
4009 ; GFX10: ; %bb.0: ; %bb
4010 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4011 ; GFX10-NEXT: v_mov_b32_e32 v1, 15
4012 ; GFX10-NEXT: v_mov_b32_e32 v2, 0
4013 ; GFX10-NEXT: scratch_store_dwordx2 v0, v[1:2], off
4014 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
4015 ; GFX10-NEXT: scratch_load_dwordx2 v[0:1], v0, off glc dlc
4016 ; GFX10-NEXT: s_waitcnt vmcnt(0)
4017 ; GFX10-NEXT: s_setpc_b64 s[30:31]
4019 ; GFX11-LABEL: store_load_i64_aligned:
4020 ; GFX11: ; %bb.0: ; %bb
4021 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4022 ; GFX11-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_mov_b32 v2, 0
4023 ; GFX11-NEXT: scratch_store_b64 v0, v[1:2], off dlc
4024 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
4025 ; GFX11-NEXT: scratch_load_b64 v[0:1], v0, off glc dlc
4026 ; GFX11-NEXT: s_waitcnt vmcnt(0)
4027 ; GFX11-NEXT: s_setpc_b64 s[30:31]
4029 ; GFX12-LABEL: store_load_i64_aligned:
4030 ; GFX12: ; %bb.0: ; %bb
4031 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
4032 ; GFX12-NEXT: s_wait_expcnt 0x0
4033 ; GFX12-NEXT: s_wait_samplecnt 0x0
4034 ; GFX12-NEXT: s_wait_bvhcnt 0x0
4035 ; GFX12-NEXT: s_wait_kmcnt 0x0
4036 ; GFX12-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_mov_b32 v2, 0
4037 ; GFX12-NEXT: s_wait_storecnt 0x0
4038 ; GFX12-NEXT: scratch_store_b64 v0, v[1:2], off scope:SCOPE_SYS
4039 ; GFX12-NEXT: s_wait_storecnt 0x0
4040 ; GFX12-NEXT: scratch_load_b64 v[0:1], v0, off scope:SCOPE_SYS
4041 ; GFX12-NEXT: s_wait_loadcnt 0x0
4042 ; GFX12-NEXT: s_setpc_b64 s[30:31]
4044 ; GFX9-PAL-LABEL: store_load_i64_aligned:
4045 ; GFX9-PAL: ; %bb.0: ; %bb
4046 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4047 ; GFX9-PAL-NEXT: v_mov_b32_e32 v1, 15
4048 ; GFX9-PAL-NEXT: v_mov_b32_e32 v2, 0
4049 ; GFX9-PAL-NEXT: scratch_store_dwordx2 v0, v[1:2], off
4050 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
4051 ; GFX9-PAL-NEXT: scratch_load_dwordx2 v[0:1], v0, off glc
4052 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
4053 ; GFX9-PAL-NEXT: s_setpc_b64 s[30:31]
4055 ; GFX940-LABEL: store_load_i64_aligned:
4056 ; GFX940: ; %bb.0: ; %bb
4057 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4058 ; GFX940-NEXT: v_mov_b32_e32 v2, 15
4059 ; GFX940-NEXT: v_mov_b32_e32 v3, 0
4060 ; GFX940-NEXT: scratch_store_dwordx2 v0, v[2:3], off sc0 sc1
4061 ; GFX940-NEXT: s_waitcnt vmcnt(0)
4062 ; GFX940-NEXT: scratch_load_dwordx2 v[0:1], v0, off sc0 sc1
4063 ; GFX940-NEXT: s_waitcnt vmcnt(0)
4064 ; GFX940-NEXT: s_setpc_b64 s[30:31]
4066 ; GFX10-PAL-LABEL: store_load_i64_aligned:
4067 ; GFX10-PAL: ; %bb.0: ; %bb
4068 ; GFX10-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4069 ; GFX10-PAL-NEXT: v_mov_b32_e32 v1, 15
4070 ; GFX10-PAL-NEXT: v_mov_b32_e32 v2, 0
4071 ; GFX10-PAL-NEXT: scratch_store_dwordx2 v0, v[1:2], off
4072 ; GFX10-PAL-NEXT: s_waitcnt_vscnt null, 0x0
4073 ; GFX10-PAL-NEXT: scratch_load_dwordx2 v[0:1], v0, off glc dlc
4074 ; GFX10-PAL-NEXT: s_waitcnt vmcnt(0)
4075 ; GFX10-PAL-NEXT: s_setpc_b64 s[30:31]
4077 ; GFX11-PAL-LABEL: store_load_i64_aligned:
4078 ; GFX11-PAL: ; %bb.0: ; %bb
4079 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4080 ; GFX11-PAL-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_mov_b32 v2, 0
4081 ; GFX11-PAL-NEXT: scratch_store_b64 v0, v[1:2], off dlc
4082 ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0
4083 ; GFX11-PAL-NEXT: scratch_load_b64 v[0:1], v0, off glc dlc
4084 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
4085 ; GFX11-PAL-NEXT: s_setpc_b64 s[30:31]
4087 ; GFX12-PAL-LABEL: store_load_i64_aligned:
4088 ; GFX12-PAL: ; %bb.0: ; %bb
4089 ; GFX12-PAL-NEXT: s_wait_loadcnt_dscnt 0x0
4090 ; GFX12-PAL-NEXT: s_wait_expcnt 0x0
4091 ; GFX12-PAL-NEXT: s_wait_samplecnt 0x0
4092 ; GFX12-PAL-NEXT: s_wait_bvhcnt 0x0
4093 ; GFX12-PAL-NEXT: s_wait_kmcnt 0x0
4094 ; GFX12-PAL-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_mov_b32 v2, 0
4095 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
4096 ; GFX12-PAL-NEXT: scratch_store_b64 v0, v[1:2], off scope:SCOPE_SYS
4097 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
4098 ; GFX12-PAL-NEXT: scratch_load_b64 v[0:1], v0, off scope:SCOPE_SYS
4099 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
4100 ; GFX12-PAL-NEXT: s_setpc_b64 s[30:31]
4102 store volatile i64 15, ptr addrspace(5) %arg, align 8
4103 %load = load volatile i64, ptr addrspace(5) %arg, align 8
4107 define void @store_load_i64_unaligned(ptr addrspace(5) nocapture %arg) {
4108 ; GFX9-LABEL: store_load_i64_unaligned:
4109 ; GFX9: ; %bb.0: ; %bb
4110 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4111 ; GFX9-NEXT: v_mov_b32_e32 v1, 15
4112 ; GFX9-NEXT: v_mov_b32_e32 v2, 0
4113 ; GFX9-NEXT: scratch_store_dwordx2 v0, v[1:2], off
4114 ; GFX9-NEXT: s_waitcnt vmcnt(0)
4115 ; GFX9-NEXT: scratch_load_dwordx2 v[0:1], v0, off glc
4116 ; GFX9-NEXT: s_waitcnt vmcnt(0)
4117 ; GFX9-NEXT: s_setpc_b64 s[30:31]
4119 ; GFX10-LABEL: store_load_i64_unaligned:
4120 ; GFX10: ; %bb.0: ; %bb
4121 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4122 ; GFX10-NEXT: v_mov_b32_e32 v1, 15
4123 ; GFX10-NEXT: v_mov_b32_e32 v2, 0
4124 ; GFX10-NEXT: scratch_store_dwordx2 v0, v[1:2], off
4125 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
4126 ; GFX10-NEXT: scratch_load_dwordx2 v[0:1], v0, off glc dlc
4127 ; GFX10-NEXT: s_waitcnt vmcnt(0)
4128 ; GFX10-NEXT: s_setpc_b64 s[30:31]
4130 ; GFX11-LABEL: store_load_i64_unaligned:
4131 ; GFX11: ; %bb.0: ; %bb
4132 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4133 ; GFX11-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_mov_b32 v2, 0
4134 ; GFX11-NEXT: scratch_store_b64 v0, v[1:2], off dlc
4135 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
4136 ; GFX11-NEXT: scratch_load_b64 v[0:1], v0, off glc dlc
4137 ; GFX11-NEXT: s_waitcnt vmcnt(0)
4138 ; GFX11-NEXT: s_setpc_b64 s[30:31]
4140 ; GFX12-LABEL: store_load_i64_unaligned:
4141 ; GFX12: ; %bb.0: ; %bb
4142 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
4143 ; GFX12-NEXT: s_wait_expcnt 0x0
4144 ; GFX12-NEXT: s_wait_samplecnt 0x0
4145 ; GFX12-NEXT: s_wait_bvhcnt 0x0
4146 ; GFX12-NEXT: s_wait_kmcnt 0x0
4147 ; GFX12-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_mov_b32 v2, 0
4148 ; GFX12-NEXT: s_wait_storecnt 0x0
4149 ; GFX12-NEXT: scratch_store_b64 v0, v[1:2], off scope:SCOPE_SYS
4150 ; GFX12-NEXT: s_wait_storecnt 0x0
4151 ; GFX12-NEXT: scratch_load_b64 v[0:1], v0, off scope:SCOPE_SYS
4152 ; GFX12-NEXT: s_wait_loadcnt 0x0
4153 ; GFX12-NEXT: s_setpc_b64 s[30:31]
4155 ; GFX9-PAL-LABEL: store_load_i64_unaligned:
4156 ; GFX9-PAL: ; %bb.0: ; %bb
4157 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4158 ; GFX9-PAL-NEXT: v_mov_b32_e32 v1, 15
4159 ; GFX9-PAL-NEXT: v_mov_b32_e32 v2, 0
4160 ; GFX9-PAL-NEXT: scratch_store_dwordx2 v0, v[1:2], off
4161 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
4162 ; GFX9-PAL-NEXT: scratch_load_dwordx2 v[0:1], v0, off glc
4163 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
4164 ; GFX9-PAL-NEXT: s_setpc_b64 s[30:31]
4166 ; GFX940-LABEL: store_load_i64_unaligned:
4167 ; GFX940: ; %bb.0: ; %bb
4168 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4169 ; GFX940-NEXT: v_mov_b32_e32 v2, 15
4170 ; GFX940-NEXT: v_mov_b32_e32 v3, 0
4171 ; GFX940-NEXT: scratch_store_dwordx2 v0, v[2:3], off sc0 sc1
4172 ; GFX940-NEXT: s_waitcnt vmcnt(0)
4173 ; GFX940-NEXT: scratch_load_dwordx2 v[0:1], v0, off sc0 sc1
4174 ; GFX940-NEXT: s_waitcnt vmcnt(0)
4175 ; GFX940-NEXT: s_setpc_b64 s[30:31]
4177 ; GFX10-PAL-LABEL: store_load_i64_unaligned:
4178 ; GFX10-PAL: ; %bb.0: ; %bb
4179 ; GFX10-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4180 ; GFX10-PAL-NEXT: v_mov_b32_e32 v1, 15
4181 ; GFX10-PAL-NEXT: v_mov_b32_e32 v2, 0
4182 ; GFX10-PAL-NEXT: scratch_store_dwordx2 v0, v[1:2], off
4183 ; GFX10-PAL-NEXT: s_waitcnt_vscnt null, 0x0
4184 ; GFX10-PAL-NEXT: scratch_load_dwordx2 v[0:1], v0, off glc dlc
4185 ; GFX10-PAL-NEXT: s_waitcnt vmcnt(0)
4186 ; GFX10-PAL-NEXT: s_setpc_b64 s[30:31]
4188 ; GFX11-PAL-LABEL: store_load_i64_unaligned:
4189 ; GFX11-PAL: ; %bb.0: ; %bb
4190 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4191 ; GFX11-PAL-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_mov_b32 v2, 0
4192 ; GFX11-PAL-NEXT: scratch_store_b64 v0, v[1:2], off dlc
4193 ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0
4194 ; GFX11-PAL-NEXT: scratch_load_b64 v[0:1], v0, off glc dlc
4195 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
4196 ; GFX11-PAL-NEXT: s_setpc_b64 s[30:31]
4198 ; GFX12-PAL-LABEL: store_load_i64_unaligned:
4199 ; GFX12-PAL: ; %bb.0: ; %bb
4200 ; GFX12-PAL-NEXT: s_wait_loadcnt_dscnt 0x0
4201 ; GFX12-PAL-NEXT: s_wait_expcnt 0x0
4202 ; GFX12-PAL-NEXT: s_wait_samplecnt 0x0
4203 ; GFX12-PAL-NEXT: s_wait_bvhcnt 0x0
4204 ; GFX12-PAL-NEXT: s_wait_kmcnt 0x0
4205 ; GFX12-PAL-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_mov_b32 v2, 0
4206 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
4207 ; GFX12-PAL-NEXT: scratch_store_b64 v0, v[1:2], off scope:SCOPE_SYS
4208 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
4209 ; GFX12-PAL-NEXT: scratch_load_b64 v[0:1], v0, off scope:SCOPE_SYS
4210 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
4211 ; GFX12-PAL-NEXT: s_setpc_b64 s[30:31]
4213 store volatile i64 15, ptr addrspace(5) %arg, align 1
4214 %load = load volatile i64, ptr addrspace(5) %arg, align 1
4218 define void @store_load_v3i32_unaligned(ptr addrspace(5) nocapture %arg) {
4219 ; GFX9-LABEL: store_load_v3i32_unaligned:
4220 ; GFX9: ; %bb.0: ; %bb
4221 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4222 ; GFX9-NEXT: v_mov_b32_e32 v1, 1
4223 ; GFX9-NEXT: v_mov_b32_e32 v2, 2
4224 ; GFX9-NEXT: v_mov_b32_e32 v3, 3
4225 ; GFX9-NEXT: scratch_store_dwordx3 v0, v[1:3], off
4226 ; GFX9-NEXT: s_waitcnt vmcnt(0)
4227 ; GFX9-NEXT: scratch_load_dwordx3 v[0:2], v0, off glc
4228 ; GFX9-NEXT: s_waitcnt vmcnt(0)
4229 ; GFX9-NEXT: s_setpc_b64 s[30:31]
4231 ; GFX10-LABEL: store_load_v3i32_unaligned:
4232 ; GFX10: ; %bb.0: ; %bb
4233 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4234 ; GFX10-NEXT: v_mov_b32_e32 v1, 1
4235 ; GFX10-NEXT: v_mov_b32_e32 v2, 2
4236 ; GFX10-NEXT: v_mov_b32_e32 v3, 3
4237 ; GFX10-NEXT: scratch_store_dwordx3 v0, v[1:3], off
4238 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
4239 ; GFX10-NEXT: scratch_load_dwordx3 v[0:2], v0, off glc dlc
4240 ; GFX10-NEXT: s_waitcnt vmcnt(0)
4241 ; GFX10-NEXT: s_setpc_b64 s[30:31]
4243 ; GFX11-LABEL: store_load_v3i32_unaligned:
4244 ; GFX11: ; %bb.0: ; %bb
4245 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4246 ; GFX11-NEXT: v_dual_mov_b32 v1, 1 :: v_dual_mov_b32 v2, 2
4247 ; GFX11-NEXT: v_mov_b32_e32 v3, 3
4248 ; GFX11-NEXT: scratch_store_b96 v0, v[1:3], off dlc
4249 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
4250 ; GFX11-NEXT: scratch_load_b96 v[0:2], v0, off glc dlc
4251 ; GFX11-NEXT: s_waitcnt vmcnt(0)
4252 ; GFX11-NEXT: s_setpc_b64 s[30:31]
4254 ; GFX12-LABEL: store_load_v3i32_unaligned:
4255 ; GFX12: ; %bb.0: ; %bb
4256 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
4257 ; GFX12-NEXT: s_wait_expcnt 0x0
4258 ; GFX12-NEXT: s_wait_samplecnt 0x0
4259 ; GFX12-NEXT: s_wait_bvhcnt 0x0
4260 ; GFX12-NEXT: s_wait_kmcnt 0x0
4261 ; GFX12-NEXT: v_dual_mov_b32 v1, 1 :: v_dual_mov_b32 v2, 2
4262 ; GFX12-NEXT: v_mov_b32_e32 v3, 3
4263 ; GFX12-NEXT: s_wait_storecnt 0x0
4264 ; GFX12-NEXT: scratch_store_b96 v0, v[1:3], off scope:SCOPE_SYS
4265 ; GFX12-NEXT: s_wait_storecnt 0x0
4266 ; GFX12-NEXT: scratch_load_b96 v[0:2], v0, off scope:SCOPE_SYS
4267 ; GFX12-NEXT: s_wait_loadcnt 0x0
4268 ; GFX12-NEXT: s_setpc_b64 s[30:31]
4270 ; GFX9-PAL-LABEL: store_load_v3i32_unaligned:
4271 ; GFX9-PAL: ; %bb.0: ; %bb
4272 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4273 ; GFX9-PAL-NEXT: v_mov_b32_e32 v1, 1
4274 ; GFX9-PAL-NEXT: v_mov_b32_e32 v2, 2
4275 ; GFX9-PAL-NEXT: v_mov_b32_e32 v3, 3
4276 ; GFX9-PAL-NEXT: scratch_store_dwordx3 v0, v[1:3], off
4277 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
4278 ; GFX9-PAL-NEXT: scratch_load_dwordx3 v[0:2], v0, off glc
4279 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
4280 ; GFX9-PAL-NEXT: s_setpc_b64 s[30:31]
4282 ; GFX940-LABEL: store_load_v3i32_unaligned:
4283 ; GFX940: ; %bb.0: ; %bb
4284 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4285 ; GFX940-NEXT: v_mov_b32_e32 v2, 1
4286 ; GFX940-NEXT: v_mov_b32_e32 v3, 2
4287 ; GFX940-NEXT: v_mov_b32_e32 v4, 3
4288 ; GFX940-NEXT: scratch_store_dwordx3 v0, v[2:4], off sc0 sc1
4289 ; GFX940-NEXT: s_waitcnt vmcnt(0)
4290 ; GFX940-NEXT: scratch_load_dwordx3 v[0:2], v0, off sc0 sc1
4291 ; GFX940-NEXT: s_waitcnt vmcnt(0)
4292 ; GFX940-NEXT: s_setpc_b64 s[30:31]
4294 ; GFX10-PAL-LABEL: store_load_v3i32_unaligned:
4295 ; GFX10-PAL: ; %bb.0: ; %bb
4296 ; GFX10-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4297 ; GFX10-PAL-NEXT: v_mov_b32_e32 v1, 1
4298 ; GFX10-PAL-NEXT: v_mov_b32_e32 v2, 2
4299 ; GFX10-PAL-NEXT: v_mov_b32_e32 v3, 3
4300 ; GFX10-PAL-NEXT: scratch_store_dwordx3 v0, v[1:3], off
4301 ; GFX10-PAL-NEXT: s_waitcnt_vscnt null, 0x0
4302 ; GFX10-PAL-NEXT: scratch_load_dwordx3 v[0:2], v0, off glc dlc
4303 ; GFX10-PAL-NEXT: s_waitcnt vmcnt(0)
4304 ; GFX10-PAL-NEXT: s_setpc_b64 s[30:31]
4306 ; GFX11-PAL-LABEL: store_load_v3i32_unaligned:
4307 ; GFX11-PAL: ; %bb.0: ; %bb
4308 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4309 ; GFX11-PAL-NEXT: v_dual_mov_b32 v1, 1 :: v_dual_mov_b32 v2, 2
4310 ; GFX11-PAL-NEXT: v_mov_b32_e32 v3, 3
4311 ; GFX11-PAL-NEXT: scratch_store_b96 v0, v[1:3], off dlc
4312 ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0
4313 ; GFX11-PAL-NEXT: scratch_load_b96 v[0:2], v0, off glc dlc
4314 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
4315 ; GFX11-PAL-NEXT: s_setpc_b64 s[30:31]
4317 ; GFX12-PAL-LABEL: store_load_v3i32_unaligned:
4318 ; GFX12-PAL: ; %bb.0: ; %bb
4319 ; GFX12-PAL-NEXT: s_wait_loadcnt_dscnt 0x0
4320 ; GFX12-PAL-NEXT: s_wait_expcnt 0x0
4321 ; GFX12-PAL-NEXT: s_wait_samplecnt 0x0
4322 ; GFX12-PAL-NEXT: s_wait_bvhcnt 0x0
4323 ; GFX12-PAL-NEXT: s_wait_kmcnt 0x0
4324 ; GFX12-PAL-NEXT: v_dual_mov_b32 v1, 1 :: v_dual_mov_b32 v2, 2
4325 ; GFX12-PAL-NEXT: v_mov_b32_e32 v3, 3
4326 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
4327 ; GFX12-PAL-NEXT: scratch_store_b96 v0, v[1:3], off scope:SCOPE_SYS
4328 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
4329 ; GFX12-PAL-NEXT: scratch_load_b96 v[0:2], v0, off scope:SCOPE_SYS
4330 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
4331 ; GFX12-PAL-NEXT: s_setpc_b64 s[30:31]
4333 store volatile <3 x i32> <i32 1, i32 2, i32 3>, ptr addrspace(5) %arg, align 1
4334 %load = load volatile <3 x i32>, ptr addrspace(5) %arg, align 1
4338 define void @store_load_v4i32_unaligned(ptr addrspace(5) nocapture %arg) {
4339 ; GFX9-LABEL: store_load_v4i32_unaligned:
4340 ; GFX9: ; %bb.0: ; %bb
4341 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4342 ; GFX9-NEXT: v_mov_b32_e32 v1, 1
4343 ; GFX9-NEXT: v_mov_b32_e32 v2, 2
4344 ; GFX9-NEXT: v_mov_b32_e32 v3, 3
4345 ; GFX9-NEXT: v_mov_b32_e32 v4, 4
4346 ; GFX9-NEXT: scratch_store_dwordx4 v0, v[1:4], off
4347 ; GFX9-NEXT: s_waitcnt vmcnt(0)
4348 ; GFX9-NEXT: scratch_load_dwordx4 v[0:3], v0, off glc
4349 ; GFX9-NEXT: s_waitcnt vmcnt(0)
4350 ; GFX9-NEXT: s_setpc_b64 s[30:31]
4352 ; GFX10-LABEL: store_load_v4i32_unaligned:
4353 ; GFX10: ; %bb.0: ; %bb
4354 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4355 ; GFX10-NEXT: v_mov_b32_e32 v1, 1
4356 ; GFX10-NEXT: v_mov_b32_e32 v2, 2
4357 ; GFX10-NEXT: v_mov_b32_e32 v3, 3
4358 ; GFX10-NEXT: v_mov_b32_e32 v4, 4
4359 ; GFX10-NEXT: scratch_store_dwordx4 v0, v[1:4], off
4360 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
4361 ; GFX10-NEXT: scratch_load_dwordx4 v[0:3], v0, off glc dlc
4362 ; GFX10-NEXT: s_waitcnt vmcnt(0)
4363 ; GFX10-NEXT: s_setpc_b64 s[30:31]
4365 ; GFX11-LABEL: store_load_v4i32_unaligned:
4366 ; GFX11: ; %bb.0: ; %bb
4367 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4368 ; GFX11-NEXT: v_dual_mov_b32 v1, 1 :: v_dual_mov_b32 v2, 2
4369 ; GFX11-NEXT: v_dual_mov_b32 v3, 3 :: v_dual_mov_b32 v4, 4
4370 ; GFX11-NEXT: scratch_store_b128 v0, v[1:4], off dlc
4371 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
4372 ; GFX11-NEXT: scratch_load_b128 v[0:3], v0, off glc dlc
4373 ; GFX11-NEXT: s_waitcnt vmcnt(0)
4374 ; GFX11-NEXT: s_setpc_b64 s[30:31]
4376 ; GFX12-LABEL: store_load_v4i32_unaligned:
4377 ; GFX12: ; %bb.0: ; %bb
4378 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
4379 ; GFX12-NEXT: s_wait_expcnt 0x0
4380 ; GFX12-NEXT: s_wait_samplecnt 0x0
4381 ; GFX12-NEXT: s_wait_bvhcnt 0x0
4382 ; GFX12-NEXT: s_wait_kmcnt 0x0
4383 ; GFX12-NEXT: v_dual_mov_b32 v1, 1 :: v_dual_mov_b32 v2, 2
4384 ; GFX12-NEXT: v_dual_mov_b32 v3, 3 :: v_dual_mov_b32 v4, 4
4385 ; GFX12-NEXT: s_wait_storecnt 0x0
4386 ; GFX12-NEXT: scratch_store_b128 v0, v[1:4], off scope:SCOPE_SYS
4387 ; GFX12-NEXT: s_wait_storecnt 0x0
4388 ; GFX12-NEXT: scratch_load_b128 v[0:3], v0, off scope:SCOPE_SYS
4389 ; GFX12-NEXT: s_wait_loadcnt 0x0
4390 ; GFX12-NEXT: s_setpc_b64 s[30:31]
4392 ; GFX9-PAL-LABEL: store_load_v4i32_unaligned:
4393 ; GFX9-PAL: ; %bb.0: ; %bb
4394 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4395 ; GFX9-PAL-NEXT: v_mov_b32_e32 v1, 1
4396 ; GFX9-PAL-NEXT: v_mov_b32_e32 v2, 2
4397 ; GFX9-PAL-NEXT: v_mov_b32_e32 v3, 3
4398 ; GFX9-PAL-NEXT: v_mov_b32_e32 v4, 4
4399 ; GFX9-PAL-NEXT: scratch_store_dwordx4 v0, v[1:4], off
4400 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
4401 ; GFX9-PAL-NEXT: scratch_load_dwordx4 v[0:3], v0, off glc
4402 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
4403 ; GFX9-PAL-NEXT: s_setpc_b64 s[30:31]
4405 ; GFX940-LABEL: store_load_v4i32_unaligned:
4406 ; GFX940: ; %bb.0: ; %bb
4407 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4408 ; GFX940-NEXT: v_mov_b32_e32 v2, 1
4409 ; GFX940-NEXT: v_mov_b32_e32 v3, 2
4410 ; GFX940-NEXT: v_mov_b32_e32 v4, 3
4411 ; GFX940-NEXT: v_mov_b32_e32 v5, 4
4412 ; GFX940-NEXT: scratch_store_dwordx4 v0, v[2:5], off sc0 sc1
4413 ; GFX940-NEXT: s_waitcnt vmcnt(0)
4414 ; GFX940-NEXT: scratch_load_dwordx4 v[0:3], v0, off sc0 sc1
4415 ; GFX940-NEXT: s_waitcnt vmcnt(0)
4416 ; GFX940-NEXT: s_setpc_b64 s[30:31]
4418 ; GFX10-PAL-LABEL: store_load_v4i32_unaligned:
4419 ; GFX10-PAL: ; %bb.0: ; %bb
4420 ; GFX10-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4421 ; GFX10-PAL-NEXT: v_mov_b32_e32 v1, 1
4422 ; GFX10-PAL-NEXT: v_mov_b32_e32 v2, 2
4423 ; GFX10-PAL-NEXT: v_mov_b32_e32 v3, 3
4424 ; GFX10-PAL-NEXT: v_mov_b32_e32 v4, 4
4425 ; GFX10-PAL-NEXT: scratch_store_dwordx4 v0, v[1:4], off
4426 ; GFX10-PAL-NEXT: s_waitcnt_vscnt null, 0x0
4427 ; GFX10-PAL-NEXT: scratch_load_dwordx4 v[0:3], v0, off glc dlc
4428 ; GFX10-PAL-NEXT: s_waitcnt vmcnt(0)
4429 ; GFX10-PAL-NEXT: s_setpc_b64 s[30:31]
4431 ; GFX11-PAL-LABEL: store_load_v4i32_unaligned:
4432 ; GFX11-PAL: ; %bb.0: ; %bb
4433 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4434 ; GFX11-PAL-NEXT: v_dual_mov_b32 v1, 1 :: v_dual_mov_b32 v2, 2
4435 ; GFX11-PAL-NEXT: v_dual_mov_b32 v3, 3 :: v_dual_mov_b32 v4, 4
4436 ; GFX11-PAL-NEXT: scratch_store_b128 v0, v[1:4], off dlc
4437 ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0
4438 ; GFX11-PAL-NEXT: scratch_load_b128 v[0:3], v0, off glc dlc
4439 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
4440 ; GFX11-PAL-NEXT: s_setpc_b64 s[30:31]
4442 ; GFX12-PAL-LABEL: store_load_v4i32_unaligned:
4443 ; GFX12-PAL: ; %bb.0: ; %bb
4444 ; GFX12-PAL-NEXT: s_wait_loadcnt_dscnt 0x0
4445 ; GFX12-PAL-NEXT: s_wait_expcnt 0x0
4446 ; GFX12-PAL-NEXT: s_wait_samplecnt 0x0
4447 ; GFX12-PAL-NEXT: s_wait_bvhcnt 0x0
4448 ; GFX12-PAL-NEXT: s_wait_kmcnt 0x0
4449 ; GFX12-PAL-NEXT: v_dual_mov_b32 v1, 1 :: v_dual_mov_b32 v2, 2
4450 ; GFX12-PAL-NEXT: v_dual_mov_b32 v3, 3 :: v_dual_mov_b32 v4, 4
4451 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
4452 ; GFX12-PAL-NEXT: scratch_store_b128 v0, v[1:4], off scope:SCOPE_SYS
4453 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
4454 ; GFX12-PAL-NEXT: scratch_load_b128 v[0:3], v0, off scope:SCOPE_SYS
4455 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
4456 ; GFX12-PAL-NEXT: s_setpc_b64 s[30:31]
4458 store volatile <4 x i32> <i32 1, i32 2, i32 3, i32 4>, ptr addrspace(5) %arg, align 1
4459 %load = load volatile <4 x i32>, ptr addrspace(5) %arg, align 1
4463 define void @store_load_i32_negative_unaligned(ptr addrspace(5) nocapture %arg) {
4464 ; GFX9-LABEL: store_load_i32_negative_unaligned:
4465 ; GFX9: ; %bb.0: ; %bb
4466 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4467 ; GFX9-NEXT: v_add_u32_e32 v0, -1, v0
4468 ; GFX9-NEXT: v_mov_b32_e32 v1, 1
4469 ; GFX9-NEXT: scratch_store_byte v0, v1, off
4470 ; GFX9-NEXT: s_waitcnt vmcnt(0)
4471 ; GFX9-NEXT: scratch_load_ubyte v0, v0, off glc
4472 ; GFX9-NEXT: s_waitcnt vmcnt(0)
4473 ; GFX9-NEXT: s_setpc_b64 s[30:31]
4475 ; GFX10-LABEL: store_load_i32_negative_unaligned:
4476 ; GFX10: ; %bb.0: ; %bb
4477 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4478 ; GFX10-NEXT: v_mov_b32_e32 v1, 1
4479 ; GFX10-NEXT: scratch_store_byte v0, v1, off offset:-1
4480 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
4481 ; GFX10-NEXT: scratch_load_ubyte v0, v0, off offset:-1 glc dlc
4482 ; GFX10-NEXT: s_waitcnt vmcnt(0)
4483 ; GFX10-NEXT: s_setpc_b64 s[30:31]
4485 ; GFX11-LABEL: store_load_i32_negative_unaligned:
4486 ; GFX11: ; %bb.0: ; %bb
4487 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4488 ; GFX11-NEXT: v_mov_b32_e32 v1, 1
4489 ; GFX11-NEXT: scratch_store_b8 v0, v1, off offset:-1 dlc
4490 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
4491 ; GFX11-NEXT: scratch_load_u8 v0, v0, off offset:-1 glc dlc
4492 ; GFX11-NEXT: s_waitcnt vmcnt(0)
4493 ; GFX11-NEXT: s_setpc_b64 s[30:31]
4495 ; GFX12-LABEL: store_load_i32_negative_unaligned:
4496 ; GFX12: ; %bb.0: ; %bb
4497 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
4498 ; GFX12-NEXT: s_wait_expcnt 0x0
4499 ; GFX12-NEXT: s_wait_samplecnt 0x0
4500 ; GFX12-NEXT: s_wait_bvhcnt 0x0
4501 ; GFX12-NEXT: s_wait_kmcnt 0x0
4502 ; GFX12-NEXT: v_mov_b32_e32 v1, 1
4503 ; GFX12-NEXT: s_wait_storecnt 0x0
4504 ; GFX12-NEXT: scratch_store_b8 v0, v1, off offset:-1 scope:SCOPE_SYS
4505 ; GFX12-NEXT: s_wait_storecnt 0x0
4506 ; GFX12-NEXT: scratch_load_u8 v0, v0, off offset:-1 scope:SCOPE_SYS
4507 ; GFX12-NEXT: s_wait_loadcnt 0x0
4508 ; GFX12-NEXT: s_setpc_b64 s[30:31]
4510 ; GFX9-PAL-LABEL: store_load_i32_negative_unaligned:
4511 ; GFX9-PAL: ; %bb.0: ; %bb
4512 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4513 ; GFX9-PAL-NEXT: v_add_u32_e32 v0, -1, v0
4514 ; GFX9-PAL-NEXT: v_mov_b32_e32 v1, 1
4515 ; GFX9-PAL-NEXT: scratch_store_byte v0, v1, off
4516 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
4517 ; GFX9-PAL-NEXT: scratch_load_ubyte v0, v0, off glc
4518 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
4519 ; GFX9-PAL-NEXT: s_setpc_b64 s[30:31]
4521 ; GFX940-LABEL: store_load_i32_negative_unaligned:
4522 ; GFX940: ; %bb.0: ; %bb
4523 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4524 ; GFX940-NEXT: v_add_u32_e32 v0, -1, v0
4525 ; GFX940-NEXT: v_mov_b32_e32 v1, 1
4526 ; GFX940-NEXT: scratch_store_byte v0, v1, off sc0 sc1
4527 ; GFX940-NEXT: s_waitcnt vmcnt(0)
4528 ; GFX940-NEXT: scratch_load_ubyte v0, v0, off sc0 sc1
4529 ; GFX940-NEXT: s_waitcnt vmcnt(0)
4530 ; GFX940-NEXT: s_setpc_b64 s[30:31]
4532 ; GFX1010-PAL-LABEL: store_load_i32_negative_unaligned:
4533 ; GFX1010-PAL: ; %bb.0: ; %bb
4534 ; GFX1010-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4535 ; GFX1010-PAL-NEXT: v_add_nc_u32_e32 v0, -1, v0
4536 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v1, 1
4537 ; GFX1010-PAL-NEXT: scratch_store_byte v0, v1, off
4538 ; GFX1010-PAL-NEXT: s_waitcnt_vscnt null, 0x0
4539 ; GFX1010-PAL-NEXT: scratch_load_ubyte v0, v0, off glc dlc
4540 ; GFX1010-PAL-NEXT: s_waitcnt vmcnt(0)
4541 ; GFX1010-PAL-NEXT: s_setpc_b64 s[30:31]
4543 ; GFX1030-PAL-LABEL: store_load_i32_negative_unaligned:
4544 ; GFX1030-PAL: ; %bb.0: ; %bb
4545 ; GFX1030-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4546 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v1, 1
4547 ; GFX1030-PAL-NEXT: scratch_store_byte v0, v1, off offset:-1
4548 ; GFX1030-PAL-NEXT: s_waitcnt_vscnt null, 0x0
4549 ; GFX1030-PAL-NEXT: scratch_load_ubyte v0, v0, off offset:-1 glc dlc
4550 ; GFX1030-PAL-NEXT: s_waitcnt vmcnt(0)
4551 ; GFX1030-PAL-NEXT: s_setpc_b64 s[30:31]
4553 ; GFX11-PAL-LABEL: store_load_i32_negative_unaligned:
4554 ; GFX11-PAL: ; %bb.0: ; %bb
4555 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4556 ; GFX11-PAL-NEXT: v_mov_b32_e32 v1, 1
4557 ; GFX11-PAL-NEXT: scratch_store_b8 v0, v1, off offset:-1 dlc
4558 ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0
4559 ; GFX11-PAL-NEXT: scratch_load_u8 v0, v0, off offset:-1 glc dlc
4560 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
4561 ; GFX11-PAL-NEXT: s_setpc_b64 s[30:31]
4563 ; GFX12-PAL-LABEL: store_load_i32_negative_unaligned:
4564 ; GFX12-PAL: ; %bb.0: ; %bb
4565 ; GFX12-PAL-NEXT: s_wait_loadcnt_dscnt 0x0
4566 ; GFX12-PAL-NEXT: s_wait_expcnt 0x0
4567 ; GFX12-PAL-NEXT: s_wait_samplecnt 0x0
4568 ; GFX12-PAL-NEXT: s_wait_bvhcnt 0x0
4569 ; GFX12-PAL-NEXT: s_wait_kmcnt 0x0
4570 ; GFX12-PAL-NEXT: v_mov_b32_e32 v1, 1
4571 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
4572 ; GFX12-PAL-NEXT: scratch_store_b8 v0, v1, off offset:-1 scope:SCOPE_SYS
4573 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
4574 ; GFX12-PAL-NEXT: scratch_load_u8 v0, v0, off offset:-1 scope:SCOPE_SYS
4575 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
4576 ; GFX12-PAL-NEXT: s_setpc_b64 s[30:31]
4578 %ptr = getelementptr inbounds i8, ptr addrspace(5) %arg, i32 -1
4579 store volatile i8 1, ptr addrspace(5) %ptr, align 1
4580 %load = load volatile i8, ptr addrspace(5) %ptr, align 1
4584 define void @store_load_i32_large_negative_unaligned(ptr addrspace(5) nocapture %arg) {
4585 ; GFX9-LABEL: store_load_i32_large_negative_unaligned:
4586 ; GFX9: ; %bb.0: ; %bb
4587 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4588 ; GFX9-NEXT: v_add_u32_e32 v0, 0xffffef7f, v0
4589 ; GFX9-NEXT: v_mov_b32_e32 v1, 1
4590 ; GFX9-NEXT: scratch_store_byte v0, v1, off
4591 ; GFX9-NEXT: s_waitcnt vmcnt(0)
4592 ; GFX9-NEXT: scratch_load_ubyte v0, v0, off glc
4593 ; GFX9-NEXT: s_waitcnt vmcnt(0)
4594 ; GFX9-NEXT: s_setpc_b64 s[30:31]
4596 ; GFX10-LABEL: store_load_i32_large_negative_unaligned:
4597 ; GFX10: ; %bb.0: ; %bb
4598 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4599 ; GFX10-NEXT: v_add_nc_u32_e32 v0, 0xfffff000, v0
4600 ; GFX10-NEXT: v_mov_b32_e32 v1, 1
4601 ; GFX10-NEXT: scratch_store_byte v0, v1, off offset:-129
4602 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
4603 ; GFX10-NEXT: scratch_load_ubyte v0, v0, off offset:-129 glc dlc
4604 ; GFX10-NEXT: s_waitcnt vmcnt(0)
4605 ; GFX10-NEXT: s_setpc_b64 s[30:31]
4607 ; GFX11-LABEL: store_load_i32_large_negative_unaligned:
4608 ; GFX11: ; %bb.0: ; %bb
4609 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4610 ; GFX11-NEXT: v_dual_mov_b32 v1, 1 :: v_dual_add_nc_u32 v0, 0xfffff000, v0
4611 ; GFX11-NEXT: scratch_store_b8 v0, v1, off offset:-129 dlc
4612 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
4613 ; GFX11-NEXT: scratch_load_u8 v0, v0, off offset:-129 glc dlc
4614 ; GFX11-NEXT: s_waitcnt vmcnt(0)
4615 ; GFX11-NEXT: s_setpc_b64 s[30:31]
4617 ; GFX12-LABEL: store_load_i32_large_negative_unaligned:
4618 ; GFX12: ; %bb.0: ; %bb
4619 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
4620 ; GFX12-NEXT: s_wait_expcnt 0x0
4621 ; GFX12-NEXT: s_wait_samplecnt 0x0
4622 ; GFX12-NEXT: s_wait_bvhcnt 0x0
4623 ; GFX12-NEXT: s_wait_kmcnt 0x0
4624 ; GFX12-NEXT: v_mov_b32_e32 v1, 1
4625 ; GFX12-NEXT: s_wait_storecnt 0x0
4626 ; GFX12-NEXT: scratch_store_b8 v0, v1, off offset:-4225 scope:SCOPE_SYS
4627 ; GFX12-NEXT: s_wait_storecnt 0x0
4628 ; GFX12-NEXT: scratch_load_u8 v0, v0, off offset:-4225 scope:SCOPE_SYS
4629 ; GFX12-NEXT: s_wait_loadcnt 0x0
4630 ; GFX12-NEXT: s_setpc_b64 s[30:31]
4632 ; GFX9-PAL-LABEL: store_load_i32_large_negative_unaligned:
4633 ; GFX9-PAL: ; %bb.0: ; %bb
4634 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4635 ; GFX9-PAL-NEXT: v_add_u32_e32 v0, 0xffffef7f, v0
4636 ; GFX9-PAL-NEXT: v_mov_b32_e32 v1, 1
4637 ; GFX9-PAL-NEXT: scratch_store_byte v0, v1, off
4638 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
4639 ; GFX9-PAL-NEXT: scratch_load_ubyte v0, v0, off glc
4640 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
4641 ; GFX9-PAL-NEXT: s_setpc_b64 s[30:31]
4643 ; GFX940-LABEL: store_load_i32_large_negative_unaligned:
4644 ; GFX940: ; %bb.0: ; %bb
4645 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4646 ; GFX940-NEXT: v_add_u32_e32 v0, 0xffffef7f, v0
4647 ; GFX940-NEXT: v_mov_b32_e32 v1, 1
4648 ; GFX940-NEXT: scratch_store_byte v0, v1, off sc0 sc1
4649 ; GFX940-NEXT: s_waitcnt vmcnt(0)
4650 ; GFX940-NEXT: scratch_load_ubyte v0, v0, off sc0 sc1
4651 ; GFX940-NEXT: s_waitcnt vmcnt(0)
4652 ; GFX940-NEXT: s_setpc_b64 s[30:31]
4654 ; GFX1010-PAL-LABEL: store_load_i32_large_negative_unaligned:
4655 ; GFX1010-PAL: ; %bb.0: ; %bb
4656 ; GFX1010-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4657 ; GFX1010-PAL-NEXT: v_add_nc_u32_e32 v0, 0xffffefff, v0
4658 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v1, 1
4659 ; GFX1010-PAL-NEXT: scratch_store_byte v0, v1, off offset:-128
4660 ; GFX1010-PAL-NEXT: s_waitcnt_vscnt null, 0x0
4661 ; GFX1010-PAL-NEXT: scratch_load_ubyte v0, v0, off offset:-128 glc dlc
4662 ; GFX1010-PAL-NEXT: s_waitcnt vmcnt(0)
4663 ; GFX1010-PAL-NEXT: s_setpc_b64 s[30:31]
4665 ; GFX1030-PAL-LABEL: store_load_i32_large_negative_unaligned:
4666 ; GFX1030-PAL: ; %bb.0: ; %bb
4667 ; GFX1030-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4668 ; GFX1030-PAL-NEXT: v_add_nc_u32_e32 v0, 0xfffff000, v0
4669 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v1, 1
4670 ; GFX1030-PAL-NEXT: scratch_store_byte v0, v1, off offset:-129
4671 ; GFX1030-PAL-NEXT: s_waitcnt_vscnt null, 0x0
4672 ; GFX1030-PAL-NEXT: scratch_load_ubyte v0, v0, off offset:-129 glc dlc
4673 ; GFX1030-PAL-NEXT: s_waitcnt vmcnt(0)
4674 ; GFX1030-PAL-NEXT: s_setpc_b64 s[30:31]
4676 ; GFX11-PAL-LABEL: store_load_i32_large_negative_unaligned:
4677 ; GFX11-PAL: ; %bb.0: ; %bb
4678 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4679 ; GFX11-PAL-NEXT: v_dual_mov_b32 v1, 1 :: v_dual_add_nc_u32 v0, 0xfffff000, v0
4680 ; GFX11-PAL-NEXT: scratch_store_b8 v0, v1, off offset:-129 dlc
4681 ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0
4682 ; GFX11-PAL-NEXT: scratch_load_u8 v0, v0, off offset:-129 glc dlc
4683 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
4684 ; GFX11-PAL-NEXT: s_setpc_b64 s[30:31]
4686 ; GFX12-PAL-LABEL: store_load_i32_large_negative_unaligned:
4687 ; GFX12-PAL: ; %bb.0: ; %bb
4688 ; GFX12-PAL-NEXT: s_wait_loadcnt_dscnt 0x0
4689 ; GFX12-PAL-NEXT: s_wait_expcnt 0x0
4690 ; GFX12-PAL-NEXT: s_wait_samplecnt 0x0
4691 ; GFX12-PAL-NEXT: s_wait_bvhcnt 0x0
4692 ; GFX12-PAL-NEXT: s_wait_kmcnt 0x0
4693 ; GFX12-PAL-NEXT: v_mov_b32_e32 v1, 1
4694 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
4695 ; GFX12-PAL-NEXT: scratch_store_b8 v0, v1, off offset:-4225 scope:SCOPE_SYS
4696 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
4697 ; GFX12-PAL-NEXT: scratch_load_u8 v0, v0, off offset:-4225 scope:SCOPE_SYS
4698 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
4699 ; GFX12-PAL-NEXT: s_setpc_b64 s[30:31]
4701 %ptr = getelementptr inbounds i8, ptr addrspace(5) %arg, i32 -4225
4702 store volatile i8 1, ptr addrspace(5) %ptr, align 1
4703 %load = load volatile i8, ptr addrspace(5) %ptr, align 1
4707 define amdgpu_ps void @large_offset() {
4708 ; GFX9-LABEL: large_offset:
4709 ; GFX9: ; %bb.0: ; %bb
4710 ; GFX9-NEXT: s_add_u32 flat_scratch_lo, s0, s2
4711 ; GFX9-NEXT: v_mov_b32_e32 v0, 0
4712 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s1, 0
4713 ; GFX9-NEXT: v_mov_b32_e32 v1, v0
4714 ; GFX9-NEXT: v_mov_b32_e32 v2, v0
4715 ; GFX9-NEXT: v_mov_b32_e32 v3, v0
4716 ; GFX9-NEXT: s_mov_b32 s0, 0
4717 ; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:3024
4718 ; GFX9-NEXT: s_waitcnt vmcnt(0)
4719 ; GFX9-NEXT: scratch_load_dwordx4 v[0:3], off, s0 offset:3024 glc
4720 ; GFX9-NEXT: s_waitcnt vmcnt(0)
4721 ; GFX9-NEXT: v_mov_b32_e32 v0, 16
4722 ; GFX9-NEXT: ;;#ASMSTART
4723 ; GFX9-NEXT: ; use v0
4724 ; GFX9-NEXT: ;;#ASMEND
4725 ; GFX9-NEXT: v_mov_b32_e32 v0, 0x810
4726 ; GFX9-NEXT: ;;#ASMSTART
4727 ; GFX9-NEXT: ; use v0
4728 ; GFX9-NEXT: ;;#ASMEND
4729 ; GFX9-NEXT: s_endpgm
4731 ; GFX10-LABEL: large_offset:
4732 ; GFX10: ; %bb.0: ; %bb
4733 ; GFX10-NEXT: s_add_u32 s0, s0, s2
4734 ; GFX10-NEXT: s_addc_u32 s1, s1, 0
4735 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s0
4736 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s1
4737 ; GFX10-NEXT: v_mov_b32_e32 v0, 0
4738 ; GFX10-NEXT: s_movk_i32 s0, 0x810
4739 ; GFX10-NEXT: s_addk_i32 s0, 0x3c0
4740 ; GFX10-NEXT: v_mov_b32_e32 v1, v0
4741 ; GFX10-NEXT: v_mov_b32_e32 v2, v0
4742 ; GFX10-NEXT: v_mov_b32_e32 v3, v0
4743 ; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], s0
4744 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
4745 ; GFX10-NEXT: scratch_load_dwordx4 v[0:3], off, s0 glc dlc
4746 ; GFX10-NEXT: s_waitcnt vmcnt(0)
4747 ; GFX10-NEXT: v_mov_b32_e32 v0, 16
4748 ; GFX10-NEXT: v_mov_b32_e32 v1, 0x810
4749 ; GFX10-NEXT: ;;#ASMSTART
4750 ; GFX10-NEXT: ; use v0
4751 ; GFX10-NEXT: ;;#ASMEND
4752 ; GFX10-NEXT: ;;#ASMSTART
4753 ; GFX10-NEXT: ; use v1
4754 ; GFX10-NEXT: ;;#ASMEND
4755 ; GFX10-NEXT: s_endpgm
4757 ; GFX11-LABEL: large_offset:
4758 ; GFX11: ; %bb.0: ; %bb
4759 ; GFX11-NEXT: v_mov_b32_e32 v0, 0
4760 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
4761 ; GFX11-NEXT: v_mov_b32_e32 v1, v0
4762 ; GFX11-NEXT: v_mov_b32_e32 v2, v0
4763 ; GFX11-NEXT: v_mov_b32_e32 v3, v0
4764 ; GFX11-NEXT: scratch_store_b128 off, v[0:3], off offset:3024 dlc
4765 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
4766 ; GFX11-NEXT: scratch_load_b128 v[0:3], off, off offset:3024 glc dlc
4767 ; GFX11-NEXT: s_waitcnt vmcnt(0)
4768 ; GFX11-NEXT: v_dual_mov_b32 v0, 16 :: v_dual_mov_b32 v1, 0x810
4769 ; GFX11-NEXT: ;;#ASMSTART
4770 ; GFX11-NEXT: ; use v0
4771 ; GFX11-NEXT: ;;#ASMEND
4772 ; GFX11-NEXT: ;;#ASMSTART
4773 ; GFX11-NEXT: ; use v1
4774 ; GFX11-NEXT: ;;#ASMEND
4775 ; GFX11-NEXT: s_endpgm
4777 ; GFX12-LABEL: large_offset:
4778 ; GFX12: ; %bb.0: ; %bb
4779 ; GFX12-NEXT: v_mov_b32_e32 v0, 0
4780 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
4781 ; GFX12-NEXT: v_dual_mov_b32 v1, v0 :: v_dual_mov_b32 v2, v0
4782 ; GFX12-NEXT: v_mov_b32_e32 v3, v0
4783 ; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:3008 scope:SCOPE_SYS
4784 ; GFX12-NEXT: s_wait_storecnt 0x0
4785 ; GFX12-NEXT: scratch_load_b128 v[0:3], off, off offset:3008 scope:SCOPE_SYS
4786 ; GFX12-NEXT: s_wait_loadcnt 0x0
4787 ; GFX12-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, 0x800
4788 ; GFX12-NEXT: ;;#ASMSTART
4789 ; GFX12-NEXT: ; use v0
4790 ; GFX12-NEXT: ;;#ASMEND
4791 ; GFX12-NEXT: ;;#ASMSTART
4792 ; GFX12-NEXT: ; use v1
4793 ; GFX12-NEXT: ;;#ASMEND
4794 ; GFX12-NEXT: s_endpgm
4796 ; GFX9-PAL-LABEL: large_offset:
4797 ; GFX9-PAL: ; %bb.0: ; %bb
4798 ; GFX9-PAL-NEXT: s_getpc_b64 s[2:3]
4799 ; GFX9-PAL-NEXT: s_mov_b32 s2, s0
4800 ; GFX9-PAL-NEXT: s_load_dwordx2 s[2:3], s[2:3], 0x0
4801 ; GFX9-PAL-NEXT: v_mov_b32_e32 v0, 0
4802 ; GFX9-PAL-NEXT: v_mov_b32_e32 v1, v0
4803 ; GFX9-PAL-NEXT: v_mov_b32_e32 v2, v0
4804 ; GFX9-PAL-NEXT: v_mov_b32_e32 v3, v0
4805 ; GFX9-PAL-NEXT: s_waitcnt lgkmcnt(0)
4806 ; GFX9-PAL-NEXT: s_and_b32 s3, s3, 0xffff
4807 ; GFX9-PAL-NEXT: s_add_u32 flat_scratch_lo, s2, s0
4808 ; GFX9-PAL-NEXT: s_addc_u32 flat_scratch_hi, s3, 0
4809 ; GFX9-PAL-NEXT: s_mov_b32 s0, 0
4810 ; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:3024
4811 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
4812 ; GFX9-PAL-NEXT: scratch_load_dwordx4 v[0:3], off, s0 offset:3024 glc
4813 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0)
4814 ; GFX9-PAL-NEXT: v_mov_b32_e32 v0, 16
4815 ; GFX9-PAL-NEXT: ;;#ASMSTART
4816 ; GFX9-PAL-NEXT: ; use v0
4817 ; GFX9-PAL-NEXT: ;;#ASMEND
4818 ; GFX9-PAL-NEXT: v_mov_b32_e32 v0, 0x810
4819 ; GFX9-PAL-NEXT: ;;#ASMSTART
4820 ; GFX9-PAL-NEXT: ; use v0
4821 ; GFX9-PAL-NEXT: ;;#ASMEND
4822 ; GFX9-PAL-NEXT: s_endpgm
4824 ; GFX940-LABEL: large_offset:
4825 ; GFX940: ; %bb.0: ; %bb
4826 ; GFX940-NEXT: v_mov_b32_e32 v0, 0
4827 ; GFX940-NEXT: v_mov_b32_e32 v1, v0
4828 ; GFX940-NEXT: v_mov_b32_e32 v2, v0
4829 ; GFX940-NEXT: v_mov_b32_e32 v3, v0
4830 ; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:3024 sc0 sc1
4831 ; GFX940-NEXT: s_waitcnt vmcnt(0)
4832 ; GFX940-NEXT: scratch_load_dwordx4 v[0:3], off, off offset:3024 sc0 sc1
4833 ; GFX940-NEXT: s_waitcnt vmcnt(0)
4834 ; GFX940-NEXT: v_mov_b32_e32 v0, 16
4835 ; GFX940-NEXT: ;;#ASMSTART
4836 ; GFX940-NEXT: ; use v0
4837 ; GFX940-NEXT: ;;#ASMEND
4838 ; GFX940-NEXT: v_mov_b32_e32 v0, 0x810
4839 ; GFX940-NEXT: ;;#ASMSTART
4840 ; GFX940-NEXT: ; use v0
4841 ; GFX940-NEXT: ;;#ASMEND
4842 ; GFX940-NEXT: s_endpgm
4844 ; GFX10-PAL-LABEL: large_offset:
4845 ; GFX10-PAL: ; %bb.0: ; %bb
4846 ; GFX10-PAL-NEXT: s_getpc_b64 s[2:3]
4847 ; GFX10-PAL-NEXT: s_mov_b32 s2, s0
4848 ; GFX10-PAL-NEXT: s_load_dwordx2 s[2:3], s[2:3], 0x0
4849 ; GFX10-PAL-NEXT: s_waitcnt lgkmcnt(0)
4850 ; GFX10-PAL-NEXT: s_and_b32 s3, s3, 0xffff
4851 ; GFX10-PAL-NEXT: s_add_u32 s2, s2, s0
4852 ; GFX10-PAL-NEXT: s_addc_u32 s3, s3, 0
4853 ; GFX10-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s2
4854 ; GFX10-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s3
4855 ; GFX10-PAL-NEXT: v_mov_b32_e32 v0, 0
4856 ; GFX10-PAL-NEXT: s_movk_i32 s0, 0x810
4857 ; GFX10-PAL-NEXT: s_addk_i32 s0, 0x3c0
4858 ; GFX10-PAL-NEXT: v_mov_b32_e32 v1, v0
4859 ; GFX10-PAL-NEXT: v_mov_b32_e32 v2, v0
4860 ; GFX10-PAL-NEXT: v_mov_b32_e32 v3, v0
4861 ; GFX10-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0
4862 ; GFX10-PAL-NEXT: s_waitcnt_vscnt null, 0x0
4863 ; GFX10-PAL-NEXT: scratch_load_dwordx4 v[0:3], off, s0 glc dlc
4864 ; GFX10-PAL-NEXT: s_waitcnt vmcnt(0)
4865 ; GFX10-PAL-NEXT: v_mov_b32_e32 v0, 16
4866 ; GFX10-PAL-NEXT: v_mov_b32_e32 v1, 0x810
4867 ; GFX10-PAL-NEXT: ;;#ASMSTART
4868 ; GFX10-PAL-NEXT: ; use v0
4869 ; GFX10-PAL-NEXT: ;;#ASMEND
4870 ; GFX10-PAL-NEXT: ;;#ASMSTART
4871 ; GFX10-PAL-NEXT: ; use v1
4872 ; GFX10-PAL-NEXT: ;;#ASMEND
4873 ; GFX10-PAL-NEXT: s_endpgm
4875 ; GFX11-PAL-LABEL: large_offset:
4876 ; GFX11-PAL: ; %bb.0: ; %bb
4877 ; GFX11-PAL-NEXT: v_mov_b32_e32 v0, 0
4878 ; GFX11-PAL-NEXT: s_delay_alu instid0(VALU_DEP_1)
4879 ; GFX11-PAL-NEXT: v_mov_b32_e32 v1, v0
4880 ; GFX11-PAL-NEXT: v_mov_b32_e32 v2, v0
4881 ; GFX11-PAL-NEXT: v_mov_b32_e32 v3, v0
4882 ; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:3024 dlc
4883 ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0
4884 ; GFX11-PAL-NEXT: scratch_load_b128 v[0:3], off, off offset:3024 glc dlc
4885 ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0)
4886 ; GFX11-PAL-NEXT: v_dual_mov_b32 v0, 16 :: v_dual_mov_b32 v1, 0x810
4887 ; GFX11-PAL-NEXT: ;;#ASMSTART
4888 ; GFX11-PAL-NEXT: ; use v0
4889 ; GFX11-PAL-NEXT: ;;#ASMEND
4890 ; GFX11-PAL-NEXT: ;;#ASMSTART
4891 ; GFX11-PAL-NEXT: ; use v1
4892 ; GFX11-PAL-NEXT: ;;#ASMEND
4893 ; GFX11-PAL-NEXT: s_endpgm
4895 ; GFX12-PAL-LABEL: large_offset:
4896 ; GFX12-PAL: ; %bb.0: ; %bb
4897 ; GFX12-PAL-NEXT: v_mov_b32_e32 v0, 0
4898 ; GFX12-PAL-NEXT: s_delay_alu instid0(VALU_DEP_1)
4899 ; GFX12-PAL-NEXT: v_dual_mov_b32 v1, v0 :: v_dual_mov_b32 v2, v0
4900 ; GFX12-PAL-NEXT: v_mov_b32_e32 v3, v0
4901 ; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:3008 scope:SCOPE_SYS
4902 ; GFX12-PAL-NEXT: s_wait_storecnt 0x0
4903 ; GFX12-PAL-NEXT: scratch_load_b128 v[0:3], off, off offset:3008 scope:SCOPE_SYS
4904 ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0
4905 ; GFX12-PAL-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, 0x800
4906 ; GFX12-PAL-NEXT: ;;#ASMSTART
4907 ; GFX12-PAL-NEXT: ; use v0
4908 ; GFX12-PAL-NEXT: ;;#ASMEND
4909 ; GFX12-PAL-NEXT: ;;#ASMSTART
4910 ; GFX12-PAL-NEXT: ; use v1
4911 ; GFX12-PAL-NEXT: ;;#ASMEND
4912 ; GFX12-PAL-NEXT: s_endpgm
4914 %alloca = alloca [128 x <4 x i32>], align 16, addrspace(5)
4915 %alloca2 = alloca [128 x <4 x i32>], align 16, addrspace(5)
4916 %gep = getelementptr inbounds [128 x <4 x i32>], ptr addrspace(5) %alloca2, i32 0, i32 60
4917 store volatile <4 x i32> zeroinitializer, ptr addrspace(5) %gep, align 16
4918 %load = load volatile <4 x i32>, ptr addrspace(5) %gep, align 16
4919 call void asm sideeffect "; use $0", "s"(ptr addrspace(5) %alloca) #0
4920 call void asm sideeffect "; use $0", "s"(ptr addrspace(5) %alloca2) #0
4924 declare void @llvm.memset.p5.i64(ptr addrspace(5) nocapture writeonly, i8, i64, i1 immarg)
4925 declare i32 @llvm.amdgcn.workitem.id.x()