1 ; RUN: llc -march=amdgcn -mcpu=hawaii -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,CI,CIVI %s
2 ; RUN: llc -march=amdgcn -mcpu=fiji -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,VI,CIVI,GFX89 %s
3 ; RUN: llc -march=amdgcn -mcpu=gfx900 -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,VI,GFX89 %s
5 ; GCN-LABEL: {{^}}void_func_i1:
6 ; GCN: v_and_b32_e32 v0, 1, v0
7 ; GCN: buffer_store_byte v0, off
8 define void @void_func_i1(i1 %arg0) #0 {
9 store i1 %arg0, i1 addrspace(1)* undef
13 ; GCN-LABEL: {{^}}void_func_i1_zeroext:
15 ; GCN-NEXT: v_or_b32_e32 v0, 12, v0
17 ; GCN: buffer_store_dword v0, off
18 define void @void_func_i1_zeroext(i1 zeroext %arg0) #0 {
19 %ext = zext i1 %arg0 to i32
20 %add = add i32 %ext, 12
21 store i32 %add, i32 addrspace(1)* undef
25 ; GCN-LABEL: {{^}}void_func_i1_signext:
27 ; GCN-NEXT: v_add_{{i|u}}32_e32 v0, {{(vcc, )?}}12, v0
29 ; GCN: buffer_store_dword v0, off
30 define void @void_func_i1_signext(i1 signext %arg0) #0 {
31 %ext = sext i1 %arg0 to i32
32 %add = add i32 %ext, 12
33 store i32 %add, i32 addrspace(1)* undef
37 ; GCN-LABEL: {{^}}i1_arg_i1_use:
38 ; GCN: v_and_b32_e32 v0, 1, v0
39 ; GCN: v_cmp_eq_u32_e32 vcc, 1, v0
40 ; GCN: s_xor_b64 s{{\[[0-9]+:[0-9]+\]}}, vcc, -1
41 define void @i1_arg_i1_use(i1 %arg) #0 {
43 br i1 %arg, label %bb2, label %bb1
46 store volatile i32 0, i32 addrspace(1)* undef
53 ; GCN-LABEL: {{^}}void_func_i8:
55 ; GCN: buffer_store_byte v0, off
56 define void @void_func_i8(i8 %arg0) #0 {
57 store i8 %arg0, i8 addrspace(1)* undef
61 ; GCN-LABEL: {{^}}void_func_i8_zeroext:
63 ; GCN: v_add_{{i|u}}32_e32 v0, {{(vcc, )?}}12, v0
64 define void @void_func_i8_zeroext(i8 zeroext %arg0) #0 {
65 %ext = zext i8 %arg0 to i32
66 %add = add i32 %ext, 12
67 store i32 %add, i32 addrspace(1)* undef
71 ; GCN-LABEL: {{^}}void_func_i8_signext:
73 ; GCN: v_add_{{i|u}}32_e32 v0, {{(vcc, )?}}12, v0
74 define void @void_func_i8_signext(i8 signext %arg0) #0 {
75 %ext = sext i8 %arg0 to i32
76 %add = add i32 %ext, 12
77 store i32 %add, i32 addrspace(1)* undef
81 ; GCN-LABEL: {{^}}void_func_i16:
82 ; GCN: buffer_store_short v0, off
83 define void @void_func_i16(i16 %arg0) #0 {
84 store i16 %arg0, i16 addrspace(1)* undef
88 ; GCN-LABEL: {{^}}void_func_i16_zeroext:
90 ; GCN: v_add_{{i|u}}32_e32 v0, {{(vcc, )?}}12, v0
91 define void @void_func_i16_zeroext(i16 zeroext %arg0) #0 {
92 %ext = zext i16 %arg0 to i32
93 %add = add i32 %ext, 12
94 store i32 %add, i32 addrspace(1)* undef
98 ; GCN-LABEL: {{^}}void_func_i16_signext:
100 ; GCN: v_add_{{i|u}}32_e32 v0, {{(vcc, )?}}12, v0
101 define void @void_func_i16_signext(i16 signext %arg0) #0 {
102 %ext = sext i16 %arg0 to i32
103 %add = add i32 %ext, 12
104 store i32 %add, i32 addrspace(1)* undef
108 ; GCN-LABEL: {{^}}void_func_i32:
110 ; GCN: buffer_store_dword v0, off
111 define void @void_func_i32(i32 %arg0) #0 {
112 store i32 %arg0, i32 addrspace(1)* undef
116 ; GCN-LABEL: {{^}}void_func_i64:
120 ; GCN: buffer_store_dwordx2 v[0:1], off
121 define void @void_func_i64(i64 %arg0) #0 {
122 store i64 %arg0, i64 addrspace(1)* undef
126 ; GCN-LABEL: {{^}}void_func_f16:
128 ; CI: v_cvt_f16_f32_e32 v0, v0
129 ; GCN: buffer_store_short v0, off
130 define void @void_func_f16(half %arg0) #0 {
131 store half %arg0, half addrspace(1)* undef
135 ; GCN-LABEL: {{^}}void_func_f32
137 ; GCN: buffer_store_dword v0, off
138 define void @void_func_f32(float %arg0) #0 {
139 store float %arg0, float addrspace(1)* undef
143 ; GCN-LABEL: {{^}}void_func_f64:
147 ; GCN: buffer_store_dwordx2 v[0:1], off
148 define void @void_func_f64(double %arg0) #0 {
149 store double %arg0, double addrspace(1)* undef
153 ; GCN-LABEL: {{^}}void_func_v2i32:
157 ; GCN: buffer_store_dwordx2 v[0:1], off
158 define void @void_func_v2i32(<2 x i32> %arg0) #0 {
159 store <2 x i32> %arg0, <2 x i32> addrspace(1)* undef
163 ; GCN-LABEL: {{^}}void_func_v3i32:
164 ; GCN-DAG: buffer_store_dwordx3 v[0:2], off
165 define void @void_func_v3i32(<3 x i32> %arg0) #0 {
166 store <3 x i32> %arg0, <3 x i32> addrspace(1)* undef
170 ; GCN-LABEL: {{^}}void_func_v4i32:
171 ; GCN: buffer_store_dwordx4 v[0:3], off
172 define void @void_func_v4i32(<4 x i32> %arg0) #0 {
173 store <4 x i32> %arg0, <4 x i32> addrspace(1)* undef
177 ; GCN-LABEL: {{^}}void_func_v5i32:
178 ; GCN-DAG: buffer_store_dwordx4 v[0:3], off
179 ; GCN-DAG: buffer_store_dword v4, off
180 define void @void_func_v5i32(<5 x i32> %arg0) #0 {
181 store <5 x i32> %arg0, <5 x i32> addrspace(1)* undef
185 ; GCN-LABEL: {{^}}void_func_v8i32:
186 ; GCN-DAG: buffer_store_dwordx4 v[0:3], off
187 ; GCN-DAG: buffer_store_dwordx4 v[4:7], off
188 define void @void_func_v8i32(<8 x i32> %arg0) #0 {
189 store <8 x i32> %arg0, <8 x i32> addrspace(1)* undef
193 ; GCN-LABEL: {{^}}void_func_v16i32:
194 ; GCN-DAG: buffer_store_dwordx4 v[0:3], off
195 ; GCN-DAG: buffer_store_dwordx4 v[4:7], off
196 ; GCN-DAG: buffer_store_dwordx4 v[8:11], off
197 ; GCN-DAG: buffer_store_dwordx4 v[12:15], off
198 define void @void_func_v16i32(<16 x i32> %arg0) #0 {
199 store <16 x i32> %arg0, <16 x i32> addrspace(1)* undef
203 ; GCN-LABEL: {{^}}void_func_v32i32:
204 ; GCN-DAG: buffer_store_dwordx4 v[0:3], off
205 ; GCN-DAG: buffer_store_dwordx4 v[4:7], off
206 ; GCN-DAG: buffer_store_dwordx4 v[8:11], off
207 ; GCN-DAG: buffer_store_dwordx4 v[12:15], off
208 ; GCN-DAG: buffer_store_dwordx4 v[16:19], off
209 ; GCN-DAG: buffer_store_dwordx4 v[20:23], off
210 ; GCN-DAG: buffer_store_dwordx4 v[24:27], off
211 ; GCN-DAG: buffer_store_dwordx4 v[28:31], off
212 define void @void_func_v32i32(<32 x i32> %arg0) #0 {
213 store <32 x i32> %arg0, <32 x i32> addrspace(1)* undef
217 ; 1 over register limit
218 ; GCN-LABEL: {{^}}void_func_v33i32:
219 ; GCN-DAG: buffer_store_dwordx4 v[0:3], off
220 ; GCN-DAG: buffer_store_dwordx4 v[4:7], off
221 ; GCN-DAG: buffer_store_dwordx4 v[8:11], off
222 ; GCN-DAG: buffer_store_dwordx4 v[12:15], off
223 ; GCN-DAG: buffer_load_dword [[STACKLOAD:v[0-9]+]], off, s[0:3], s32
224 ; GCN-DAG: buffer_store_dwordx4 v[16:19], off
225 ; GCN-DAG: buffer_store_dwordx4 v[20:23], off
226 ; GCN-DAG: buffer_store_dwordx4 v[24:27], off
227 ; GCN-DAG: buffer_store_dwordx4 v[28:31], off
228 ; GCN: buffer_store_dword [[STACKLOAD]], off
229 define void @void_func_v33i32(<33 x i32> %arg0) #0 {
230 store <33 x i32> %arg0, <33 x i32> addrspace(1)* undef
234 ; GCN-LABEL: {{^}}void_func_v2i64:
235 ; GCN: buffer_store_dwordx4 v[0:3], off
236 define void @void_func_v2i64(<2 x i64> %arg0) #0 {
237 store <2 x i64> %arg0, <2 x i64> addrspace(1)* undef
241 ; GCN-LABEL: {{^}}void_func_v3i64:
242 ; GCN-DAG: buffer_store_dwordx4 v[0:3], off
243 ; GCN-DAG: buffer_store_dwordx2 v[4:5], off
244 define void @void_func_v3i64(<3 x i64> %arg0) #0 {
245 store <3 x i64> %arg0, <3 x i64> addrspace(1)* undef
249 ; GCN-LABEL: {{^}}void_func_v4i64:
250 ; GCN-DAG: buffer_store_dwordx4 v[0:3], off
251 ; GCN-DAG: buffer_store_dwordx4 v[4:7], off
252 define void @void_func_v4i64(<4 x i64> %arg0) #0 {
253 store <4 x i64> %arg0, <4 x i64> addrspace(1)* undef
257 ; GCN-LABEL: {{^}}void_func_v5i64:
258 ; GCN-DAG: buffer_store_dwordx4 v[0:3], off
259 ; GCN-DAG: buffer_store_dwordx4 v[4:7], off
260 ; GCN-DAG: buffer_store_dwordx2 v[8:9], off
261 define void @void_func_v5i64(<5 x i64> %arg0) #0 {
262 store <5 x i64> %arg0, <5 x i64> addrspace(1)* undef
266 ; GCN-LABEL: {{^}}void_func_v8i64:
267 ; GCN-DAG: buffer_store_dwordx4 v[0:3], off
268 ; GCN-DAG: buffer_store_dwordx4 v[4:7], off
269 ; GCN-DAG: buffer_store_dwordx4 v[8:11], off
270 ; GCN-DAG: buffer_store_dwordx4 v[12:15], off
271 define void @void_func_v8i64(<8 x i64> %arg0) #0 {
272 store <8 x i64> %arg0, <8 x i64> addrspace(1)* undef
276 ; GCN-LABEL: {{^}}void_func_v16i64:
277 ; GCN-DAG: buffer_store_dwordx4 v[0:3], off
278 ; GCN-DAG: buffer_store_dwordx4 v[4:7], off
279 ; GCN-DAG: buffer_store_dwordx4 v[8:11], off
280 ; GCN-DAG: buffer_store_dwordx4 v[12:15], off
281 ; GCN-DAG: buffer_store_dwordx4 v[16:19], off
282 ; GCN-DAG: buffer_store_dwordx4 v[20:23], off
283 ; GCN-DAG: buffer_store_dwordx4 v[24:27], off
284 ; GCN-DAG: buffer_store_dwordx4 v[28:31], off
285 define void @void_func_v16i64(<16 x i64> %arg0) #0 {
286 store <16 x i64> %arg0, <16 x i64> addrspace(1)* undef
290 ; GCN-LABEL: {{^}}void_func_v2i16:
292 ; GFX9: buffer_store_dword v0, off
293 define void @void_func_v2i16(<2 x i16> %arg0) #0 {
294 store <2 x i16> %arg0, <2 x i16> addrspace(1)* undef
298 ; GCN-LABEL: {{^}}void_func_v3i16:
299 ; GCN-DAG: buffer_store_dword v{{[0-9]+}}, off
300 ; GCN-DAG: buffer_store_short v{{[0-9]+}}, off
301 define void @void_func_v3i16(<3 x i16> %arg0) #0 {
302 store <3 x i16> %arg0, <3 x i16> addrspace(1)* undef
306 ; GCN-LABEL: {{^}}void_func_v4i16:
309 ; GFX9: buffer_store_dwordx2 v[0:1], off
310 define void @void_func_v4i16(<4 x i16> %arg0) #0 {
311 store <4 x i16> %arg0, <4 x i16> addrspace(1)* undef
315 ; GCN-LABEL: {{^}}void_func_v5i16:
321 ; CI-DAG: buffer_store_short v
322 ; CI-DAG: buffer_store_dwordx2 v
324 ; GFX89-DAG: buffer_store_short v2, off,
325 ; GFX89-DAG: buffer_store_dwordx2 v[0:1], off
327 define void @void_func_v5i16(<5 x i16> %arg0) #0 {
328 store <5 x i16> %arg0, <5 x i16> addrspace(1)* undef
332 ; GCN-LABEL: {{^}}void_func_v8i16:
333 ; GFX9-DAG: buffer_store_dwordx4 v[0:3], off
334 define void @void_func_v8i16(<8 x i16> %arg0) #0 {
335 store <8 x i16> %arg0, <8 x i16> addrspace(1)* undef
339 ; GCN-LABEL: {{^}}void_func_v16i16:
340 ; GFX9-DAG: buffer_store_dwordx4 v[0:3], off
341 ; GFX9-DAG: buffer_store_dwordx4 v[4:7], off
342 define void @void_func_v16i16(<16 x i16> %arg0) #0 {
343 store <16 x i16> %arg0, <16 x i16> addrspace(1)* undef
347 ; GCN-LABEL: {{^}}void_func_v2f32:
351 ; GCN: buffer_store_dwordx2 v[0:1], off
352 define void @void_func_v2f32(<2 x float> %arg0) #0 {
353 store <2 x float> %arg0, <2 x float> addrspace(1)* undef
357 ; GCN-LABEL: {{^}}void_func_v3f32:
358 ; GCN-DAG: buffer_store_dwordx3 v[0:2], off
359 define void @void_func_v3f32(<3 x float> %arg0) #0 {
360 store <3 x float> %arg0, <3 x float> addrspace(1)* undef
364 ; GCN-LABEL: {{^}}void_func_v4f32:
365 ; GCN: buffer_store_dwordx4 v[0:3], off
366 define void @void_func_v4f32(<4 x float> %arg0) #0 {
367 store <4 x float> %arg0, <4 x float> addrspace(1)* undef
371 ; GCN-LABEL: {{^}}void_func_v8f32:
372 ; GCN-DAG: buffer_store_dwordx4 v[0:3], off
373 ; GCN-DAG: buffer_store_dwordx4 v[4:7], off
374 define void @void_func_v8f32(<8 x float> %arg0) #0 {
375 store <8 x float> %arg0, <8 x float> addrspace(1)* undef
379 ; GCN-LABEL: {{^}}void_func_v16f32:
380 ; GCN-DAG: buffer_store_dwordx4 v[0:3], off
381 ; GCN-DAG: buffer_store_dwordx4 v[4:7], off
382 ; GCN-DAG: buffer_store_dwordx4 v[8:11], off
383 ; GCN-DAG: buffer_store_dwordx4 v[12:15], off
384 define void @void_func_v16f32(<16 x float> %arg0) #0 {
385 store <16 x float> %arg0, <16 x float> addrspace(1)* undef
389 ; GCN-LABEL: {{^}}void_func_v2f64:
390 ; GCN: buffer_store_dwordx4 v[0:3], off
391 define void @void_func_v2f64(<2 x double> %arg0) #0 {
392 store <2 x double> %arg0, <2 x double> addrspace(1)* undef
396 ; GCN-LABEL: {{^}}void_func_v3f64:
397 ; GCN-DAG: buffer_store_dwordx4 v[0:3], off
398 ; GCN-DAG: buffer_store_dwordx2 v[4:5], off
399 define void @void_func_v3f64(<3 x double> %arg0) #0 {
400 store <3 x double> %arg0, <3 x double> addrspace(1)* undef
404 ; GCN-LABEL: {{^}}void_func_v4f64:
405 ; GCN-DAG: buffer_store_dwordx4 v[0:3], off
406 ; GCN-DAG: buffer_store_dwordx4 v[4:7], off
407 define void @void_func_v4f64(<4 x double> %arg0) #0 {
408 store <4 x double> %arg0, <4 x double> addrspace(1)* undef
412 ; GCN-LABEL: {{^}}void_func_v8f64:
413 ; GCN-DAG: buffer_store_dwordx4 v[0:3], off
414 ; GCN-DAG: buffer_store_dwordx4 v[4:7], off
415 ; GCN-DAG: buffer_store_dwordx4 v[8:11], off
416 ; GCN-DAG: buffer_store_dwordx4 v[12:15], off
417 define void @void_func_v8f64(<8 x double> %arg0) #0 {
418 store <8 x double> %arg0, <8 x double> addrspace(1)* undef
422 ; GCN-LABEL: {{^}}void_func_v16f64:
423 ; GCN-DAG: buffer_store_dwordx4 v[0:3], off
424 ; GCN-DAG: buffer_store_dwordx4 v[4:7], off
425 ; GCN-DAG: buffer_store_dwordx4 v[8:11], off
426 ; GCN-DAG: buffer_store_dwordx4 v[12:15], off
427 ; GCN-DAG: buffer_store_dwordx4 v[16:19], off
428 ; GCN-DAG: buffer_store_dwordx4 v[20:23], off
429 ; GCN-DAG: buffer_store_dwordx4 v[24:27], off
430 ; GCN-DAG: buffer_store_dwordx4 v[28:31], off
431 define void @void_func_v16f64(<16 x double> %arg0) #0 {
432 store <16 x double> %arg0, <16 x double> addrspace(1)* undef
436 ; GCN-LABEL: {{^}}void_func_v2f16:
438 ; GFX9: buffer_store_dword v0, off
439 define void @void_func_v2f16(<2 x half> %arg0) #0 {
440 store <2 x half> %arg0, <2 x half> addrspace(1)* undef
444 ; FIXME: Different abi if f16 legal
445 ; GCN-LABEL: {{^}}void_func_v3f16:
446 ; CI-DAG: v_cvt_f16_f32_e32 v{{[0-9]+}}, v0
447 ; CI-DAG: v_cvt_f16_f32_e32 v{{[0-9]+}}, v1
448 ; CI-DAG: v_cvt_f16_f32_e32 v{{[0-9]+}}, v2
453 ; GCN-DAG: buffer_store_short
454 ; GCN-DAG: buffer_store_dword
455 define void @void_func_v3f16(<3 x half> %arg0) #0 {
456 store <3 x half> %arg0, <3 x half> addrspace(1)* undef
460 ; GCN-LABEL: {{^}}void_func_v4f16:
464 ; GFX9: buffer_store_dwordx2 v[0:1], off
465 define void @void_func_v4f16(<4 x half> %arg0) #0 {
466 store <4 x half> %arg0, <4 x half> addrspace(1)* undef
470 ; GCN-LABEL: {{^}}void_func_v8f16:
473 ; GFX9: buffer_store_dwordx4 v[0:3], off
474 define void @void_func_v8f16(<8 x half> %arg0) #0 {
475 store <8 x half> %arg0, <8 x half> addrspace(1)* undef
479 ; GCN-LABEL: {{^}}void_func_v16f16:
482 ; GFX9-DAG: buffer_store_dwordx4 v[0:3], off
483 ; GFX9-DAG: buffer_store_dwordx4 v[4:7], off
484 define void @void_func_v16f16(<16 x half> %arg0) #0 {
485 store <16 x half> %arg0, <16 x half> addrspace(1)* undef
489 ; Make sure there is no alignment requirement for passed vgprs.
490 ; GCN-LABEL: {{^}}void_func_i32_i64_i32:
492 ; GCN: buffer_store_dword v0, off
493 ; GCN: buffer_store_dwordx2 v[1:2]
494 ; GCN: buffer_store_dword v3
495 define void @void_func_i32_i64_i32(i32 %arg0, i64 %arg1, i32 %arg2) #0 {
496 store volatile i32 %arg0, i32 addrspace(1)* undef
497 store volatile i64 %arg1, i64 addrspace(1)* undef
498 store volatile i32 %arg2, i32 addrspace(1)* undef
502 ; GCN-LABEL: {{^}}void_func_struct_i32:
504 ; GCN: buffer_store_dword v0, off
505 define void @void_func_struct_i32({ i32 } %arg0) #0 {
506 store { i32 } %arg0, { i32 } addrspace(1)* undef
510 ; GCN-LABEL: {{^}}void_func_struct_i8_i32:
511 ; GCN-DAG: buffer_store_byte v0, off
512 ; GCN-DAG: buffer_store_dword v1, off
513 define void @void_func_struct_i8_i32({ i8, i32 } %arg0) #0 {
514 store { i8, i32 } %arg0, { i8, i32 } addrspace(1)* undef
518 ; GCN-LABEL: {{^}}void_func_byval_struct_i8_i32:
519 ; GCN-DAG: buffer_load_ubyte v[[ELT0:[0-9]+]], off, s[0:3], s32{{$}}
520 ; GCN-DAG: buffer_load_dword v[[ELT1:[0-9]+]], off, s[0:3], s32 offset:4{{$}}
521 ; GCN-DAG: buffer_store_dword v[[ELT1]]
522 ; GCN-DAG: buffer_store_byte v[[ELT0]]
523 define void @void_func_byval_struct_i8_i32({ i8, i32 } addrspace(5)* byval %arg0) #0 {
524 %arg0.load = load { i8, i32 }, { i8, i32 } addrspace(5)* %arg0
525 store { i8, i32 } %arg0.load, { i8, i32 } addrspace(1)* undef
529 ; GCN-LABEL: {{^}}void_func_byval_struct_i8_i32_x2:
530 ; GCN: buffer_load_ubyte v[[ELT0_0:[0-9]+]], off, s[0:3], s32{{$}}
531 ; GCN: buffer_load_dword v[[ELT1_0:[0-9]+]], off, s[0:3], s32 offset:4{{$}}
532 ; GCN: buffer_load_ubyte v[[ELT0_1:[0-9]+]], off, s[0:3], s32 offset:8{{$}}
533 ; GCN: buffer_load_dword v[[ELT1_1:[0-9]+]], off, s[0:3], s32 offset:12{{$}}
535 ; GCN: ds_write_b32 v0, v0
537 define void @void_func_byval_struct_i8_i32_x2({ i8, i32 } addrspace(5)* byval %arg0, { i8, i32 } addrspace(5)* byval %arg1, i32 %arg2) #0 {
538 %arg0.load = load volatile { i8, i32 }, { i8, i32 } addrspace(5)* %arg0
539 %arg1.load = load volatile { i8, i32 }, { i8, i32 } addrspace(5)* %arg1
540 store volatile { i8, i32 } %arg0.load, { i8, i32 } addrspace(1)* undef
541 store volatile { i8, i32 } %arg1.load, { i8, i32 } addrspace(1)* undef
542 store volatile i32 %arg2, i32 addrspace(3)* undef
546 ; GCN-LABEL: {{^}}void_func_byval_i32_byval_i64:
547 ; GCN-DAG: buffer_load_dword v[[ARG0_LOAD:[0-9]+]], off, s[0:3], s32{{$}}
548 ; GCN-DAG: buffer_load_dword v[[ARG1_LOAD0:[0-9]+]], off, s[0:3], s32 offset:8{{$}}
549 ; GCN-DAG: buffer_load_dword v[[ARG1_LOAD1:[0-9]+]], off, s[0:3], s32 offset:12{{$}}
550 ; GCN-DAG: buffer_store_dword v[[ARG0_LOAD]], off
551 ; GCN-DAG: buffer_store_dwordx2 v{{\[}}[[ARG1_LOAD0]]:[[ARG1_LOAD1]]{{\]}}, off
552 define void @void_func_byval_i32_byval_i64(i32 addrspace(5)* byval %arg0, i64 addrspace(5)* byval %arg1) #0 {
553 %arg0.load = load i32, i32 addrspace(5)* %arg0
554 %arg1.load = load i64, i64 addrspace(5)* %arg1
555 store i32 %arg0.load, i32 addrspace(1)* undef
556 store i64 %arg1.load, i64 addrspace(1)* undef
560 ; GCN-LABEL: {{^}}void_func_v32i32_i32_i64:
561 ; GCN-DAG: buffer_store_dwordx4 v[0:3], off
562 ; GCN-DAG: buffer_store_dwordx4 v[4:7], off
563 ; GCN-DAG: buffer_store_dwordx4 v[8:11], off
564 ; GCN-DAG: buffer_store_dwordx4 v[12:15], off
565 ; GCN-DAG: buffer_store_dwordx4 v[16:19], off
566 ; GCN-DAG: buffer_store_dwordx4 v[20:23], off
567 ; GCN-DAG: buffer_store_dwordx4 v[24:27], off
568 ; GCN-DAG: buffer_store_dwordx4 v[28:31], off
569 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1:[0-9]+]], off, s[0:3], s32{{$}}
570 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_0:[0-9]+]], off, s[0:3], s32 offset:4
571 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_1:[0-9]+]], off, s[0:3], s32 offset:8
573 ; GCN: buffer_store_dword v[[LOAD_ARG1]]
574 ; GCN: buffer_store_dwordx2 v{{\[}}[[LOAD_ARG2_0]]:[[LOAD_ARG2_1]]{{\]}}, off
575 define void @void_func_v32i32_i32_i64(<32 x i32> %arg0, i32 %arg1, i64 %arg2) #0 {
576 store volatile <32 x i32> %arg0, <32 x i32> addrspace(1)* undef
577 store volatile i32 %arg1, i32 addrspace(1)* undef
578 store volatile i64 %arg2, i64 addrspace(1)* undef
582 ; FIXME: Different ext load types on CI vs. VI
583 ; GCN-LABEL: {{^}}void_func_v32i32_i1_i8_i16:
584 ; GCN-DAG: buffer_load_ubyte [[LOAD_ARG1:v[0-9]+]], off, s[0:3], s32{{$}}
585 ; VI-DAG: buffer_load_ushort [[LOAD_ARG2:v[0-9]+]], off, s[0:3], s32 offset:4{{$}}
586 ; VI-DAG: buffer_load_ushort [[LOAD_ARG3:v[0-9]+]], off, s[0:3], s32 offset:8{{$}}
587 ; VI-DAG: buffer_load_ushort [[LOAD_ARG4:v[0-9]+]], off, s[0:3], s32 offset:12{{$}}
589 ; CI-DAG: buffer_load_dword [[LOAD_ARG2:v[0-9]+]], off, s[0:3], s32 offset:4{{$}}
590 ; CI-DAG: buffer_load_dword [[LOAD_ARG3:v[0-9]+]], off, s[0:3], s32 offset:8{{$}}
591 ; CI-DAG: buffer_load_dword [[LOAD_ARG4:v[0-9]+]], off, s[0:3], s32 offset:12{{$}}
593 ; GCN-DAG: v_and_b32_e32 [[TRUNC_ARG1_I1:v[0-9]+]], 1, [[LOAD_ARG1]]
594 ; CI-DAG: v_cvt_f16_f32_e32 [[CVT_ARG4:v[0-9]+]], [[LOAD_ARG4]]
596 ; GCN: buffer_store_byte [[TRUNC_ARG1_I1]], off
597 ; GCN: buffer_store_byte [[LOAD_ARG2]], off
598 ; GCN: buffer_store_short [[LOAD_ARG3]], off
599 ; GFX89 buffer_store_short [[LOAD_ARG4]], off
601 ; CI: buffer_store_short [[CVT_ARG4]], off
602 define void @void_func_v32i32_i1_i8_i16(<32 x i32> %arg0, i1 %arg1, i8 %arg2, i16 %arg3, half %arg4) #0 {
603 store volatile <32 x i32> %arg0, <32 x i32> addrspace(1)* undef
604 store volatile i1 %arg1, i1 addrspace(1)* undef
605 store volatile i8 %arg2, i8 addrspace(1)* undef
606 store volatile i16 %arg3, i16 addrspace(1)* undef
607 store volatile half %arg4, half addrspace(1)* undef
611 ; GCN-LABEL: {{^}}void_func_v32i32_v2i32_v2f32:
612 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_0:[0-9]+]], off, s[0:3], s32{{$}}
613 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_1:[0-9]+]], off, s[0:3], s32 offset:4{{$}}
614 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_0:[0-9]+]], off, s[0:3], s32 offset:8{{$}}
615 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_1:[0-9]+]], off, s[0:3], s32 offset:12{{$}}
617 ; GCN: buffer_store_dwordx2 v{{\[}}[[LOAD_ARG1_0]]:[[LOAD_ARG1_1]]{{\]}}, off
618 ; GCN: buffer_store_dwordx2 v{{\[}}[[LOAD_ARG2_0]]:[[LOAD_ARG2_1]]{{\]}}, off
619 define void @void_func_v32i32_v2i32_v2f32(<32 x i32> %arg0, <2 x i32> %arg1, <2 x float> %arg2) #0 {
620 store volatile <32 x i32> %arg0, <32 x i32> addrspace(1)* undef
621 store volatile <2 x i32> %arg1, <2 x i32> addrspace(1)* undef
622 store volatile <2 x float> %arg2, <2 x float> addrspace(1)* undef
626 ; GCN-LABEL: {{^}}void_func_v32i32_v2i16_v2f16:
627 ; GFX9-DAG: buffer_load_dword [[LOAD_ARG1:v[0-9]+]], off, s[0:3], s32 offset:4{{$}}
628 ; GFX9-DAG: buffer_load_dword [[LOAD_ARG2:v[0-9]+]], off, s[0:3], s32 offset:8{{$}}
629 ; GFX9: buffer_store_dword [[LOAD_ARG1]], off
630 ; GFX9: buffer_store_short [[LOAD_ARG2]], off
631 define void @void_func_v32i32_v2i16_v2f16(<32 x i32> %arg0, <2 x i16> %arg1, <2 x half> %arg2) #0 {
632 store volatile <32 x i32> %arg0, <32 x i32> addrspace(1)* undef
633 store volatile <2 x i16> %arg1, <2 x i16> addrspace(1)* undef
634 store volatile <2 x half> %arg2, <2 x half> addrspace(1)* undef
638 ; GCN-LABEL: {{^}}void_func_v32i32_v2i64_v2f64:
639 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_0:[0-9]+]], off, s[0:3], s32{{$}}
640 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_1:[0-9]+]], off, s[0:3], s32 offset:4{{$}}
641 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_2:[0-9]+]], off, s[0:3], s32 offset:8{{$}}
642 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_3:[0-9]+]], off, s[0:3], s32 offset:12{{$}}
644 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_0:[0-9]+]], off, s[0:3], s32 offset:16{{$}}
645 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_1:[0-9]+]], off, s[0:3], s32 offset:20{{$}}
646 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_2:[0-9]+]], off, s[0:3], s32 offset:24{{$}}
647 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_3:[0-9]+]], off, s[0:3], s32 offset:28{{$}}
649 ; GCN: buffer_store_dwordx4 v{{\[}}[[LOAD_ARG1_0]]:[[LOAD_ARG1_3]]{{\]}}, off
650 ; GCN: buffer_store_dwordx4 v{{\[}}[[LOAD_ARG2_0]]:[[LOAD_ARG2_3]]{{\]}}, off
651 define void @void_func_v32i32_v2i64_v2f64(<32 x i32> %arg0, <2 x i64> %arg1, <2 x double> %arg2) #0 {
652 store volatile <32 x i32> %arg0, <32 x i32> addrspace(1)* undef
653 store volatile <2 x i64> %arg1, <2 x i64> addrspace(1)* undef
654 store volatile <2 x double> %arg2, <2 x double> addrspace(1)* undef
658 ; GCN-LABEL: {{^}}void_func_v32i32_v4i32_v4f32:
659 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_0:[0-9]+]], off, s[0:3], s32{{$}}
660 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_1:[0-9]+]], off, s[0:3], s32 offset:4{{$}}
661 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_2:[0-9]+]], off, s[0:3], s32 offset:8{{$}}
662 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_3:[0-9]+]], off, s[0:3], s32 offset:12{{$}}
664 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_0:[0-9]+]], off, s[0:3], s32 offset:16{{$}}
665 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_1:[0-9]+]], off, s[0:3], s32 offset:20{{$}}
666 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_2:[0-9]+]], off, s[0:3], s32 offset:24{{$}}
667 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_3:[0-9]+]], off, s[0:3], s32 offset:28{{$}}
669 ; GCN: buffer_store_dwordx4 v{{\[}}[[LOAD_ARG1_0]]:[[LOAD_ARG1_3]]{{\]}}, off
670 ; GCN: buffer_store_dwordx4 v{{\[}}[[LOAD_ARG2_0]]:[[LOAD_ARG2_3]]{{\]}}, off
671 define void @void_func_v32i32_v4i32_v4f32(<32 x i32> %arg0, <4 x i32> %arg1, <4 x float> %arg2) #0 {
672 store volatile <32 x i32> %arg0, <32 x i32> addrspace(1)* undef
673 store volatile <4 x i32> %arg1, <4 x i32> addrspace(1)* undef
674 store volatile <4 x float> %arg2, <4 x float> addrspace(1)* undef
678 ; GCN-LABEL: {{^}}void_func_v32i32_v8i32_v8f32:
679 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_0:[0-9]+]], off, s[0:3], s32{{$}}
680 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_1:[0-9]+]], off, s[0:3], s32 offset:4{{$}}
681 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_2:[0-9]+]], off, s[0:3], s32 offset:8{{$}}
682 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_3:[0-9]+]], off, s[0:3], s32 offset:12{{$}}
683 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_4:[0-9]+]], off, s[0:3], s32 offset:16{{$}}
684 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_5:[0-9]+]], off, s[0:3], s32 offset:20{{$}}
685 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_6:[0-9]+]], off, s[0:3], s32 offset:24{{$}}
686 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_7:[0-9]+]], off, s[0:3], s32 offset:28{{$}}
688 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_0:[0-9]+]], off, s[0:3], s32 offset:32{{$}}
689 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_1:[0-9]+]], off, s[0:3], s32 offset:36{{$}}
690 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_2:[0-9]+]], off, s[0:3], s32 offset:40{{$}}
691 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_3:[0-9]+]], off, s[0:3], s32 offset:44{{$}}
692 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_4:[0-9]+]], off, s[0:3], s32 offset:48{{$}}
693 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_5:[0-9]+]], off, s[0:3], s32 offset:52{{$}}
694 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_6:[0-9]+]], off, s[0:3], s32 offset:56{{$}}
695 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_7:[0-9]+]], off, s[0:3], s32 offset:60{{$}}
697 ; GCN: buffer_store_dwordx4 v{{\[}}[[LOAD_ARG1_4]]:[[LOAD_ARG1_7]]{{\]}}, off
698 ; GCN: buffer_store_dwordx4 v{{\[}}[[LOAD_ARG1_0]]:[[LOAD_ARG1_3]]{{\]}}, off
699 ; GCN: buffer_store_dwordx4 v{{\[}}[[LOAD_ARG2_4]]:[[LOAD_ARG2_7]]{{\]}}, off
700 ; GCN: buffer_store_dwordx4 v{{\[}}[[LOAD_ARG2_0]]:[[LOAD_ARG2_3]]{{\]}}, off
701 define void @void_func_v32i32_v8i32_v8f32(<32 x i32> %arg0, <8 x i32> %arg1, <8 x float> %arg2) #0 {
702 store volatile <32 x i32> %arg0, <32 x i32> addrspace(1)* undef
703 store volatile <8 x i32> %arg1, <8 x i32> addrspace(1)* undef
704 store volatile <8 x float> %arg2, <8 x float> addrspace(1)* undef
708 ; GCN-LABEL: {{^}}void_func_v32i32_v16i32_v16f32:
709 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_0:[0-9]+]], off, s[0:3], s32{{$}}
710 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_1:[0-9]+]], off, s[0:3], s32 offset:4{{$}}
711 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_2:[0-9]+]], off, s[0:3], s32 offset:8{{$}}
712 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_:[0-9]+]], off, s[0:3], s32 offset:12{{$}}
713 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_4:[0-9]+]], off, s[0:3], s32 offset:16{{$}}
714 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_5:[0-9]+]], off, s[0:3], s32 offset:20{{$}}
715 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_6:[0-9]+]], off, s[0:3], s32 offset:24{{$}}
716 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_7:[0-9]+]], off, s[0:3], s32 offset:28{{$}}
717 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_8:[0-9]+]], off, s[0:3], s32 offset:32{{$}}
718 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_9:[0-9]+]], off, s[0:3], s32 offset:36{{$}}
719 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_10:[0-9]+]], off, s[0:3], s32 offset:40{{$}}
720 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_11:[0-9]+]], off, s[0:3], s32 offset:44{{$}}
721 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_12:[0-9]+]], off, s[0:3], s32 offset:48{{$}}
722 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_13:[0-9]+]], off, s[0:3], s32 offset:52{{$}}
723 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_14:[0-9]+]], off, s[0:3], s32 offset:56{{$}}
724 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_15:[0-9]+]], off, s[0:3], s32 offset:60{{$}}
726 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_0:[0-9]+]], off, s[0:3], s32 offset:64{{$}}
727 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_1:[0-9]+]], off, s[0:3], s32 offset:68{{$}}
728 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_2:[0-9]+]], off, s[0:3], s32 offset:72{{$}}
729 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_3:[0-9]+]], off, s[0:3], s32 offset:76{{$}}
730 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_4:[0-9]+]], off, s[0:3], s32 offset:80{{$}}
731 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_5:[0-9]+]], off, s[0:3], s32 offset:84{{$}}
732 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_6:[0-9]+]], off, s[0:3], s32 offset:88{{$}}
733 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_7:[0-9]+]], off, s[0:3], s32 offset:92{{$}}
734 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_8:[0-9]+]], off, s[0:3], s32 offset:96{{$}}
735 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_9:[0-9]+]], off, s[0:3], s32 offset:100{{$}}
736 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_10:[0-9]+]], off, s[0:3], s32 offset:104{{$}}
737 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_11:[0-9]+]], off, s[0:3], s32 offset:108{{$}}
738 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_12:[0-9]+]], off, s[0:3], s32 offset:112{{$}}
739 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_13:[0-9]+]], off, s[0:3], s32 offset:116{{$}}
740 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_14:[0-9]+]], off, s[0:3], s32 offset:120{{$}}
741 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_15:[0-9]+]], off, s[0:3], s32 offset:124{{$}}
742 define void @void_func_v32i32_v16i32_v16f32(<32 x i32> %arg0, <16 x i32> %arg1, <16 x float> %arg2) #0 {
743 store volatile <32 x i32> %arg0, <32 x i32> addrspace(1)* undef
744 store volatile <16 x i32> %arg1, <16 x i32> addrspace(1)* undef
745 store volatile <16 x float> %arg2, <16 x float> addrspace(1)* undef
749 ; Make sure v3 isn't a wasted register because of v3 types being promoted to v4
750 ; GCN-LABEL: {{^}}void_func_v3f32_wasted_reg:
752 ; GCN: ds_write_b32 v{{[0-9]+}}, v0
753 ; GCN-NEXT: ds_write_b32 v{{[0-9]+}}, v1
754 ; GCN-NEXT: ds_write_b32 v{{[0-9]+}}, v2
755 ; GCN-NEXT: ds_write_b32 v{{[0-9]+}}, v3
756 ; GCN-NEXT: s_waitcnt
757 ; GCN-NEXT: s_setpc_b64
758 define void @void_func_v3f32_wasted_reg(<3 x float> %arg0, i32 %arg1) #0 {
759 %arg0.0 = extractelement <3 x float> %arg0, i32 0
760 %arg0.1 = extractelement <3 x float> %arg0, i32 1
761 %arg0.2 = extractelement <3 x float> %arg0, i32 2
762 store volatile float %arg0.0, float addrspace(3)* undef
763 store volatile float %arg0.1, float addrspace(3)* undef
764 store volatile float %arg0.2, float addrspace(3)* undef
765 store volatile i32 %arg1, i32 addrspace(3)* undef
769 ; GCN-LABEL: {{^}}void_func_v3i32_wasted_reg:
771 ; GCN: ds_write_b32 v{{[0-9]+}}, v0
772 ; GCN-NEXT: ds_write_b32 v{{[0-9]+}}, v1
773 ; GCN-NEXT: ds_write_b32 v{{[0-9]+}}, v2
774 ; GCN-NEXT: ds_write_b32 v{{[0-9]+}}, v3
775 ; GCN-NEXT: s_waitcnt
776 ; GCN-NEXT: s_setpc_b64
777 define void @void_func_v3i32_wasted_reg(<3 x i32> %arg0, i32 %arg1) #0 {
778 %arg0.0 = extractelement <3 x i32> %arg0, i32 0
779 %arg0.1 = extractelement <3 x i32> %arg0, i32 1
780 %arg0.2 = extractelement <3 x i32> %arg0, i32 2
781 store volatile i32 %arg0.0, i32 addrspace(3)* undef
782 store volatile i32 %arg0.1, i32 addrspace(3)* undef
783 store volatile i32 %arg0.2, i32 addrspace(3)* undef
784 store volatile i32 %arg1, i32 addrspace(3)* undef
788 ; Check there is no crash.
789 ; GCN-LABEL: {{^}}void_func_v16i8:
790 define void @void_func_v16i8(<16 x i8> %arg0) #0 {
791 store volatile <16 x i8> %arg0, <16 x i8> addrspace(1)* undef
795 ; Check there is no crash.
796 ; GCN-LABEL: {{^}}void_func_v32i32_v16i8:
797 define void @void_func_v32i32_v16i8(<32 x i32> %arg0, <16 x i8> %arg1) #0 {
798 store volatile <32 x i32> %arg0, <32 x i32> addrspace(1)* undef
799 store volatile <16 x i8> %arg1, <16 x i8> addrspace(1)* undef
803 attributes #0 = { nounwind }