1 ; RUN: llc -march=amdgcn -mcpu=hawaii -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,CI %s
2 ; RUN: llc -march=amdgcn -mcpu=fiji -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,VI,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_v2i24:
348 ; GCN: v_add_{{i|u}}32_e32 v0, {{(vcc, )?}}v0, v1
349 define void @void_func_v2i24(<2 x i24> %arg0) #0 {
350 %elt0 = extractelement <2 x i24> %arg0, i32 0
351 %elt1 = extractelement <2 x i24> %arg0, i32 1
352 %add = add i24 %elt0, %elt1
353 store i24 %add, i24 addrspace(1)* undef
357 ; GCN-LABEL: {{^}}void_func_v2f32:
361 ; GCN: buffer_store_dwordx2 v[0:1], off
362 define void @void_func_v2f32(<2 x float> %arg0) #0 {
363 store <2 x float> %arg0, <2 x float> addrspace(1)* undef
367 ; GCN-LABEL: {{^}}void_func_v3f32:
368 ; GCN-DAG: buffer_store_dwordx3 v[0:2], off
369 define void @void_func_v3f32(<3 x float> %arg0) #0 {
370 store <3 x float> %arg0, <3 x float> addrspace(1)* undef
374 ; GCN-LABEL: {{^}}void_func_v4f32:
375 ; GCN: buffer_store_dwordx4 v[0:3], off
376 define void @void_func_v4f32(<4 x float> %arg0) #0 {
377 store <4 x float> %arg0, <4 x float> addrspace(1)* undef
381 ; GCN-LABEL: {{^}}void_func_v8f32:
382 ; GCN-DAG: buffer_store_dwordx4 v[0:3], off
383 ; GCN-DAG: buffer_store_dwordx4 v[4:7], off
384 define void @void_func_v8f32(<8 x float> %arg0) #0 {
385 store <8 x float> %arg0, <8 x float> addrspace(1)* undef
389 ; GCN-LABEL: {{^}}void_func_v16f32:
390 ; GCN-DAG: buffer_store_dwordx4 v[0:3], off
391 ; GCN-DAG: buffer_store_dwordx4 v[4:7], off
392 ; GCN-DAG: buffer_store_dwordx4 v[8:11], off
393 ; GCN-DAG: buffer_store_dwordx4 v[12:15], off
394 define void @void_func_v16f32(<16 x float> %arg0) #0 {
395 store <16 x float> %arg0, <16 x float> addrspace(1)* undef
399 ; GCN-LABEL: {{^}}void_func_v2f64:
400 ; GCN: buffer_store_dwordx4 v[0:3], off
401 define void @void_func_v2f64(<2 x double> %arg0) #0 {
402 store <2 x double> %arg0, <2 x double> addrspace(1)* undef
406 ; GCN-LABEL: {{^}}void_func_v3f64:
407 ; GCN-DAG: buffer_store_dwordx4 v[0:3], off
408 ; GCN-DAG: buffer_store_dwordx2 v[4:5], off
409 define void @void_func_v3f64(<3 x double> %arg0) #0 {
410 store <3 x double> %arg0, <3 x double> addrspace(1)* undef
414 ; GCN-LABEL: {{^}}void_func_v4f64:
415 ; GCN-DAG: buffer_store_dwordx4 v[0:3], off
416 ; GCN-DAG: buffer_store_dwordx4 v[4:7], off
417 define void @void_func_v4f64(<4 x double> %arg0) #0 {
418 store <4 x double> %arg0, <4 x double> addrspace(1)* undef
422 ; GCN-LABEL: {{^}}void_func_v8f64:
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 define void @void_func_v8f64(<8 x double> %arg0) #0 {
428 store <8 x double> %arg0, <8 x double> addrspace(1)* undef
432 ; GCN-LABEL: {{^}}void_func_v16f64:
433 ; GCN-DAG: buffer_store_dwordx4 v[0:3], off
434 ; GCN-DAG: buffer_store_dwordx4 v[4:7], off
435 ; GCN-DAG: buffer_store_dwordx4 v[8:11], off
436 ; GCN-DAG: buffer_store_dwordx4 v[12:15], off
437 ; GCN-DAG: buffer_store_dwordx4 v[16:19], off
438 ; GCN-DAG: buffer_store_dwordx4 v[20:23], off
439 ; GCN-DAG: buffer_store_dwordx4 v[24:27], off
440 ; GCN-DAG: buffer_store_dwordx4 v[28:31], off
441 define void @void_func_v16f64(<16 x double> %arg0) #0 {
442 store <16 x double> %arg0, <16 x double> addrspace(1)* undef
446 ; GCN-LABEL: {{^}}void_func_v2f16:
448 ; GFX9: buffer_store_dword v0, off
449 define void @void_func_v2f16(<2 x half> %arg0) #0 {
450 store <2 x half> %arg0, <2 x half> addrspace(1)* undef
454 ; FIXME: Different abi if f16 legal
455 ; GCN-LABEL: {{^}}void_func_v3f16:
456 ; CI-DAG: v_cvt_f16_f32_e32 v{{[0-9]+}}, v0
457 ; CI-DAG: v_cvt_f16_f32_e32 v{{[0-9]+}}, v1
458 ; CI-DAG: v_cvt_f16_f32_e32 v{{[0-9]+}}, v2
463 ; GCN-DAG: buffer_store_short
464 ; GCN-DAG: buffer_store_dword
465 define void @void_func_v3f16(<3 x half> %arg0) #0 {
466 store <3 x half> %arg0, <3 x half> addrspace(1)* undef
470 ; GCN-LABEL: {{^}}void_func_v4f16:
474 ; GFX9: buffer_store_dwordx2 v[0:1], off
475 define void @void_func_v4f16(<4 x half> %arg0) #0 {
476 store <4 x half> %arg0, <4 x half> addrspace(1)* undef
480 ; GCN-LABEL: {{^}}void_func_v8f16:
483 ; GFX9: buffer_store_dwordx4 v[0:3], off
484 define void @void_func_v8f16(<8 x half> %arg0) #0 {
485 store <8 x half> %arg0, <8 x half> addrspace(1)* undef
489 ; GCN-LABEL: {{^}}void_func_v16f16:
492 ; GFX9-DAG: buffer_store_dwordx4 v[0:3], off
493 ; GFX9-DAG: buffer_store_dwordx4 v[4:7], off
494 define void @void_func_v16f16(<16 x half> %arg0) #0 {
495 store <16 x half> %arg0, <16 x half> addrspace(1)* undef
499 ; Make sure there is no alignment requirement for passed vgprs.
500 ; GCN-LABEL: {{^}}void_func_i32_i64_i32:
502 ; GCN: buffer_store_dword v0, off
503 ; GCN: buffer_store_dwordx2 v[1:2]
504 ; GCN: buffer_store_dword v3
505 define void @void_func_i32_i64_i32(i32 %arg0, i64 %arg1, i32 %arg2) #0 {
506 store volatile i32 %arg0, i32 addrspace(1)* undef
507 store volatile i64 %arg1, i64 addrspace(1)* undef
508 store volatile i32 %arg2, i32 addrspace(1)* undef
512 ; GCN-LABEL: {{^}}void_func_struct_i32:
514 ; GCN: buffer_store_dword v0, off
515 define void @void_func_struct_i32({ i32 } %arg0) #0 {
516 store { i32 } %arg0, { i32 } addrspace(1)* undef
520 ; GCN-LABEL: {{^}}void_func_struct_i8_i32:
521 ; GCN-DAG: buffer_store_byte v0, off
522 ; GCN-DAG: buffer_store_dword v1, off
523 define void @void_func_struct_i8_i32({ i8, i32 } %arg0) #0 {
524 store { i8, i32 } %arg0, { i8, i32 } addrspace(1)* undef
528 ; GCN-LABEL: {{^}}void_func_byval_struct_i8_i32:
529 ; GCN-DAG: buffer_load_ubyte v[[ELT0:[0-9]+]], off, s[0:3], s32{{$}}
530 ; GCN-DAG: buffer_load_dword v[[ELT1:[0-9]+]], off, s[0:3], s32 offset:4{{$}}
531 ; GCN-DAG: buffer_store_dword v[[ELT1]]
532 ; GCN-DAG: buffer_store_byte v[[ELT0]]
533 define void @void_func_byval_struct_i8_i32({ i8, i32 } addrspace(5)* byval({ i8, i32 }) %arg0) #0 {
534 %arg0.load = load { i8, i32 }, { i8, i32 } addrspace(5)* %arg0
535 store { i8, i32 } %arg0.load, { i8, i32 } addrspace(1)* undef
539 ; GCN-LABEL: {{^}}void_func_byval_struct_i8_i32_x2:
540 ; GCN: buffer_load_ubyte v[[ELT0_0:[0-9]+]], off, s[0:3], s32 glc{{$}}
541 ; GCN: buffer_load_dword v[[ELT1_0:[0-9]+]], off, s[0:3], s32 offset:4 glc{{$}}
542 ; GCN: buffer_load_ubyte v[[ELT0_1:[0-9]+]], off, s[0:3], s32 offset:8 glc{{$}}
543 ; GCN: buffer_load_dword v[[ELT1_1:[0-9]+]], off, s[0:3], s32 offset:12 glc{{$}}
545 ; GCN: ds_write_b32 v0, v0
547 define void @void_func_byval_struct_i8_i32_x2({ i8, i32 } addrspace(5)* byval({ i8, i32 }) %arg0, { i8, i32 } addrspace(5)* byval({ i8, i32 }) %arg1, i32 %arg2) #0 {
548 %arg0.load = load volatile { i8, i32 }, { i8, i32 } addrspace(5)* %arg0
549 %arg1.load = load volatile { i8, i32 }, { i8, i32 } addrspace(5)* %arg1
550 store volatile { i8, i32 } %arg0.load, { i8, i32 } addrspace(1)* undef
551 store volatile { i8, i32 } %arg1.load, { i8, i32 } addrspace(1)* undef
552 store volatile i32 %arg2, i32 addrspace(3)* undef
556 ; GCN-LABEL: {{^}}void_func_byval_i32_byval_i64:
557 ; GCN-DAG: buffer_load_dword v[[ARG0_LOAD:[0-9]+]], off, s[0:3], s32{{$}}
558 ; GCN-DAG: buffer_load_dword v[[ARG1_LOAD0:[0-9]+]], off, s[0:3], s32 offset:8{{$}}
559 ; GCN-DAG: buffer_load_dword v[[ARG1_LOAD1:[0-9]+]], off, s[0:3], s32 offset:12{{$}}
560 ; GCN-DAG: buffer_store_dword v[[ARG0_LOAD]], off
561 ; GCN-DAG: buffer_store_dwordx2 v{{\[}}[[ARG1_LOAD0]]:[[ARG1_LOAD1]]{{\]}}, off
562 define void @void_func_byval_i32_byval_i64(i32 addrspace(5)* byval(i32) %arg0, i64 addrspace(5)* byval(i64) %arg1) #0 {
563 %arg0.load = load i32, i32 addrspace(5)* %arg0
564 %arg1.load = load i64, i64 addrspace(5)* %arg1
565 store i32 %arg0.load, i32 addrspace(1)* undef
566 store i64 %arg1.load, i64 addrspace(1)* undef
570 ; GCN-LABEL: {{^}}void_func_v32i32_i32_i64:
571 ; GCN-DAG: buffer_store_dwordx4 v[0:3], off
572 ; GCN-DAG: buffer_store_dwordx4 v[4:7], off
573 ; GCN-DAG: buffer_store_dwordx4 v[8:11], off
574 ; GCN-DAG: buffer_store_dwordx4 v[12:15], off
575 ; GCN-DAG: buffer_store_dwordx4 v[16:19], off
576 ; GCN-DAG: buffer_store_dwordx4 v[20:23], off
577 ; GCN-DAG: buffer_store_dwordx4 v[24:27], off
578 ; GCN-DAG: buffer_store_dwordx4 v[28:31], off
579 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1:[0-9]+]], off, s[0:3], s32{{$}}
580 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_0:[0-9]+]], off, s[0:3], s32 offset:4
581 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_1:[0-9]+]], off, s[0:3], s32 offset:8
583 ; GCN: buffer_store_dword v[[LOAD_ARG1]]
584 ; GCN: buffer_store_dwordx2 v{{\[}}[[LOAD_ARG2_0]]:[[LOAD_ARG2_1]]{{\]}}, off
585 define void @void_func_v32i32_i32_i64(<32 x i32> %arg0, i32 %arg1, i64 %arg2) #0 {
586 store volatile <32 x i32> %arg0, <32 x i32> addrspace(1)* undef
587 store volatile i32 %arg1, i32 addrspace(1)* undef
588 store volatile i64 %arg2, i64 addrspace(1)* undef
592 ; FIXME: Different ext load types on CI vs. VI
593 ; GCN-LABEL: {{^}}void_func_v32i32_i1_i8_i16:
594 ; GCN-DAG: buffer_load_ubyte [[LOAD_ARG1:v[0-9]+]], off, s[0:3], s32{{$}}
595 ; VI-DAG: buffer_load_ushort [[LOAD_ARG2:v[0-9]+]], off, s[0:3], s32 offset:4{{$}}
596 ; VI-DAG: buffer_load_ushort [[LOAD_ARG3:v[0-9]+]], off, s[0:3], s32 offset:8{{$}}
597 ; VI-DAG: buffer_load_ushort [[LOAD_ARG4:v[0-9]+]], off, s[0:3], s32 offset:12{{$}}
599 ; CI-DAG: buffer_load_dword [[LOAD_ARG2:v[0-9]+]], off, s[0:3], s32 offset:4{{$}}
600 ; CI-DAG: buffer_load_dword [[LOAD_ARG3:v[0-9]+]], off, s[0:3], s32 offset:8{{$}}
601 ; CI-DAG: buffer_load_dword [[LOAD_ARG4:v[0-9]+]], off, s[0:3], s32 offset:12{{$}}
603 ; GCN-DAG: v_and_b32_e32 [[TRUNC_ARG1_I1:v[0-9]+]], 1, [[LOAD_ARG1]]
604 ; CI-DAG: v_cvt_f16_f32_e32 [[CVT_ARG4:v[0-9]+]], [[LOAD_ARG4]]
606 ; GCN: buffer_store_byte [[TRUNC_ARG1_I1]], off
607 ; GCN: buffer_store_byte [[LOAD_ARG2]], off
608 ; GCN: buffer_store_short [[LOAD_ARG3]], off
609 ; GFX89: buffer_store_short [[LOAD_ARG4]], off
611 ; CI: buffer_store_short [[CVT_ARG4]], off
612 define void @void_func_v32i32_i1_i8_i16(<32 x i32> %arg0, i1 %arg1, i8 %arg2, i16 %arg3, half %arg4) #0 {
613 store volatile <32 x i32> %arg0, <32 x i32> addrspace(1)* undef
614 store volatile i1 %arg1, i1 addrspace(1)* undef
615 store volatile i8 %arg2, i8 addrspace(1)* undef
616 store volatile i16 %arg3, i16 addrspace(1)* undef
617 store volatile half %arg4, half addrspace(1)* undef
621 ; GCN-LABEL: {{^}}void_func_v32i32_v2i32_v2f32:
622 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_0:[0-9]+]], off, s[0:3], s32{{$}}
623 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_1:[0-9]+]], off, s[0:3], s32 offset:4{{$}}
624 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_0:[0-9]+]], off, s[0:3], s32 offset:8{{$}}
625 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_1:[0-9]+]], off, s[0:3], s32 offset:12{{$}}
627 ; GCN: buffer_store_dwordx2 v{{\[}}[[LOAD_ARG1_0]]:[[LOAD_ARG1_1]]{{\]}}, off
628 ; GCN: buffer_store_dwordx2 v{{\[}}[[LOAD_ARG2_0]]:[[LOAD_ARG2_1]]{{\]}}, off
629 define void @void_func_v32i32_v2i32_v2f32(<32 x i32> %arg0, <2 x i32> %arg1, <2 x float> %arg2) #0 {
630 store volatile <32 x i32> %arg0, <32 x i32> addrspace(1)* undef
631 store volatile <2 x i32> %arg1, <2 x i32> addrspace(1)* undef
632 store volatile <2 x float> %arg2, <2 x float> addrspace(1)* undef
636 ; GCN-LABEL: {{^}}void_func_v32i32_v2i16_v2f16:
637 ; GFX9-DAG: buffer_load_dword [[LOAD_ARG1:v[0-9]+]], off, s[0:3], s32 offset:4{{$}}
638 ; GFX9-DAG: buffer_load_dword [[LOAD_ARG2:v[0-9]+]], off, s[0:3], s32 offset:8{{$}}
639 ; GFX9: buffer_store_dword [[LOAD_ARG1]], off
640 ; GFX9: buffer_store_short [[LOAD_ARG2]], off
641 define void @void_func_v32i32_v2i16_v2f16(<32 x i32> %arg0, <2 x i16> %arg1, <2 x half> %arg2) #0 {
642 store volatile <32 x i32> %arg0, <32 x i32> addrspace(1)* undef
643 store volatile <2 x i16> %arg1, <2 x i16> addrspace(1)* undef
644 store volatile <2 x half> %arg2, <2 x half> addrspace(1)* undef
648 ; GCN-LABEL: {{^}}void_func_v32i32_v2i64_v2f64:
649 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_0:[0-9]+]], off, s[0:3], s32{{$}}
650 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_1:[0-9]+]], off, s[0:3], s32 offset:4{{$}}
651 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_2:[0-9]+]], off, s[0:3], s32 offset:8{{$}}
652 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_3:[0-9]+]], off, s[0:3], s32 offset:12{{$}}
654 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_0:[0-9]+]], off, s[0:3], s32 offset:16{{$}}
655 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_1:[0-9]+]], off, s[0:3], s32 offset:20{{$}}
656 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_2:[0-9]+]], off, s[0:3], s32 offset:24{{$}}
657 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_3:[0-9]+]], off, s[0:3], s32 offset:28{{$}}
659 ; GCN: buffer_store_dwordx4 v{{\[}}[[LOAD_ARG1_0]]:[[LOAD_ARG1_3]]{{\]}}, off
660 ; GCN: buffer_store_dwordx4 v{{\[}}[[LOAD_ARG2_0]]:[[LOAD_ARG2_3]]{{\]}}, off
661 define void @void_func_v32i32_v2i64_v2f64(<32 x i32> %arg0, <2 x i64> %arg1, <2 x double> %arg2) #0 {
662 store volatile <32 x i32> %arg0, <32 x i32> addrspace(1)* undef
663 store volatile <2 x i64> %arg1, <2 x i64> addrspace(1)* undef
664 store volatile <2 x double> %arg2, <2 x double> addrspace(1)* undef
668 ; GCN-LABEL: {{^}}void_func_v32i32_v4i32_v4f32:
669 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_0:[0-9]+]], off, s[0:3], s32{{$}}
670 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_1:[0-9]+]], off, s[0:3], s32 offset:4{{$}}
671 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_2:[0-9]+]], off, s[0:3], s32 offset:8{{$}}
672 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_3:[0-9]+]], off, s[0:3], s32 offset:12{{$}}
674 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_0:[0-9]+]], off, s[0:3], s32 offset:16{{$}}
675 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_1:[0-9]+]], off, s[0:3], s32 offset:20{{$}}
676 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_2:[0-9]+]], off, s[0:3], s32 offset:24{{$}}
677 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_3:[0-9]+]], off, s[0:3], s32 offset:28{{$}}
679 ; GCN: buffer_store_dwordx4 v{{\[}}[[LOAD_ARG1_0]]:[[LOAD_ARG1_3]]{{\]}}, off
680 ; GCN: buffer_store_dwordx4 v{{\[}}[[LOAD_ARG2_0]]:[[LOAD_ARG2_3]]{{\]}}, off
681 define void @void_func_v32i32_v4i32_v4f32(<32 x i32> %arg0, <4 x i32> %arg1, <4 x float> %arg2) #0 {
682 store volatile <32 x i32> %arg0, <32 x i32> addrspace(1)* undef
683 store volatile <4 x i32> %arg1, <4 x i32> addrspace(1)* undef
684 store volatile <4 x float> %arg2, <4 x float> addrspace(1)* undef
688 ; GCN-LABEL: {{^}}void_func_v32i32_v8i32_v8f32:
689 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_0:[0-9]+]], off, s[0:3], s32{{$}}
690 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_1:[0-9]+]], off, s[0:3], s32 offset:4{{$}}
691 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_2:[0-9]+]], off, s[0:3], s32 offset:8{{$}}
692 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_3:[0-9]+]], off, s[0:3], s32 offset:12{{$}}
693 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_4:[0-9]+]], off, s[0:3], s32 offset:16{{$}}
694 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_5:[0-9]+]], off, s[0:3], s32 offset:20{{$}}
695 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_6:[0-9]+]], off, s[0:3], s32 offset:24{{$}}
696 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_7:[0-9]+]], off, s[0:3], s32 offset:28{{$}}
698 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_0:[0-9]+]], off, s[0:3], s32 offset:32{{$}}
699 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_1:[0-9]+]], off, s[0:3], s32 offset:36{{$}}
700 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_2:[0-9]+]], off, s[0:3], s32 offset:40{{$}}
701 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_3:[0-9]+]], off, s[0:3], s32 offset:44{{$}}
702 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_4:[0-9]+]], off, s[0:3], s32 offset:48{{$}}
703 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_5:[0-9]+]], off, s[0:3], s32 offset:52{{$}}
704 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_6:[0-9]+]], off, s[0:3], s32 offset:56{{$}}
705 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_7:[0-9]+]], off, s[0:3], s32 offset:60{{$}}
707 ; GCN: buffer_store_dwordx4 v{{\[}}[[LOAD_ARG1_4]]:[[LOAD_ARG1_7]]{{\]}}, off
708 ; GCN: buffer_store_dwordx4 v{{\[}}[[LOAD_ARG1_0]]:[[LOAD_ARG1_3]]{{\]}}, off
709 ; GCN: buffer_store_dwordx4 v{{\[}}[[LOAD_ARG2_4]]:[[LOAD_ARG2_7]]{{\]}}, off
710 ; GCN: buffer_store_dwordx4 v{{\[}}[[LOAD_ARG2_0]]:[[LOAD_ARG2_3]]{{\]}}, off
711 define void @void_func_v32i32_v8i32_v8f32(<32 x i32> %arg0, <8 x i32> %arg1, <8 x float> %arg2) #0 {
712 store volatile <32 x i32> %arg0, <32 x i32> addrspace(1)* undef
713 store volatile <8 x i32> %arg1, <8 x i32> addrspace(1)* undef
714 store volatile <8 x float> %arg2, <8 x float> addrspace(1)* undef
718 ; GCN-LABEL: {{^}}void_func_v32i32_v16i32_v16f32:
719 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_0:[0-9]+]], off, s[0:3], s32{{$}}
720 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_1:[0-9]+]], off, s[0:3], s32 offset:4{{$}}
721 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_2:[0-9]+]], off, s[0:3], s32 offset:8{{$}}
722 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_:[0-9]+]], off, s[0:3], s32 offset:12{{$}}
723 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_4:[0-9]+]], off, s[0:3], s32 offset:16{{$}}
724 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_5:[0-9]+]], off, s[0:3], s32 offset:20{{$}}
725 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_6:[0-9]+]], off, s[0:3], s32 offset:24{{$}}
726 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_7:[0-9]+]], off, s[0:3], s32 offset:28{{$}}
727 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_8:[0-9]+]], off, s[0:3], s32 offset:32{{$}}
728 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_9:[0-9]+]], off, s[0:3], s32 offset:36{{$}}
729 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_10:[0-9]+]], off, s[0:3], s32 offset:40{{$}}
730 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_11:[0-9]+]], off, s[0:3], s32 offset:44{{$}}
731 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_12:[0-9]+]], off, s[0:3], s32 offset:48{{$}}
732 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_13:[0-9]+]], off, s[0:3], s32 offset:52{{$}}
733 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG1_14:[0-9]+]], off, s[0:3], s32 offset:56{{$}}
734 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_15:[0-9]+]], off, s[0:3], s32 offset:60{{$}}
736 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_0:[0-9]+]], off, s[0:3], s32 offset:64{{$}}
737 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_1:[0-9]+]], off, s[0:3], s32 offset:68{{$}}
738 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_2:[0-9]+]], off, s[0:3], s32 offset:72{{$}}
739 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_3:[0-9]+]], off, s[0:3], s32 offset:76{{$}}
740 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_4:[0-9]+]], off, s[0:3], s32 offset:80{{$}}
741 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_5:[0-9]+]], off, s[0:3], s32 offset:84{{$}}
742 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_6:[0-9]+]], off, s[0:3], s32 offset:88{{$}}
743 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_7:[0-9]+]], off, s[0:3], s32 offset:92{{$}}
744 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_8:[0-9]+]], off, s[0:3], s32 offset:96{{$}}
745 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_9:[0-9]+]], off, s[0:3], s32 offset:100{{$}}
746 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_10:[0-9]+]], off, s[0:3], s32 offset:104{{$}}
747 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_11:[0-9]+]], off, s[0:3], s32 offset:108{{$}}
748 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_12:[0-9]+]], off, s[0:3], s32 offset:112{{$}}
749 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_13:[0-9]+]], off, s[0:3], s32 offset:116{{$}}
750 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_14:[0-9]+]], off, s[0:3], s32 offset:120{{$}}
751 ; GCN-DAG: buffer_load_dword v[[LOAD_ARG2_15:[0-9]+]], off, s[0:3], s32 offset:124{{$}}
752 define void @void_func_v32i32_v16i32_v16f32(<32 x i32> %arg0, <16 x i32> %arg1, <16 x float> %arg2) #0 {
753 store volatile <32 x i32> %arg0, <32 x i32> addrspace(1)* undef
754 store volatile <16 x i32> %arg1, <16 x i32> addrspace(1)* undef
755 store volatile <16 x float> %arg2, <16 x float> addrspace(1)* undef
759 ; Make sure v3 isn't a wasted register because of v3 types being promoted to v4
760 ; GCN-LABEL: {{^}}void_func_v3f32_wasted_reg:
762 ; GCN: ds_write_b32 v{{[0-9]+}}, v0
763 ; GCN-NEXT: ds_write_b32 v{{[0-9]+}}, v1
764 ; GCN-NEXT: ds_write_b32 v{{[0-9]+}}, v2
765 ; GCN-NEXT: ds_write_b32 v{{[0-9]+}}, v3
766 ; GCN-NEXT: s_waitcnt
767 ; GCN-NEXT: s_setpc_b64
768 define void @void_func_v3f32_wasted_reg(<3 x float> %arg0, i32 %arg1) #0 {
769 %arg0.0 = extractelement <3 x float> %arg0, i32 0
770 %arg0.1 = extractelement <3 x float> %arg0, i32 1
771 %arg0.2 = extractelement <3 x float> %arg0, i32 2
772 store volatile float %arg0.0, float addrspace(3)* undef
773 store volatile float %arg0.1, float addrspace(3)* undef
774 store volatile float %arg0.2, float addrspace(3)* undef
775 store volatile i32 %arg1, i32 addrspace(3)* undef
779 ; GCN-LABEL: {{^}}void_func_v3i32_wasted_reg:
781 ; GCN: ds_write_b32 v{{[0-9]+}}, v0
782 ; GCN-NEXT: ds_write_b32 v{{[0-9]+}}, v1
783 ; GCN-NEXT: ds_write_b32 v{{[0-9]+}}, v2
784 ; GCN-NEXT: ds_write_b32 v{{[0-9]+}}, v3
785 ; GCN-NEXT: s_waitcnt
786 ; GCN-NEXT: s_setpc_b64
787 define void @void_func_v3i32_wasted_reg(<3 x i32> %arg0, i32 %arg1) #0 {
788 %arg0.0 = extractelement <3 x i32> %arg0, i32 0
789 %arg0.1 = extractelement <3 x i32> %arg0, i32 1
790 %arg0.2 = extractelement <3 x i32> %arg0, i32 2
791 store volatile i32 %arg0.0, i32 addrspace(3)* undef
792 store volatile i32 %arg0.1, i32 addrspace(3)* undef
793 store volatile i32 %arg0.2, i32 addrspace(3)* undef
794 store volatile i32 %arg1, i32 addrspace(3)* undef
798 ; Check there is no crash.
799 ; GCN-LABEL: {{^}}void_func_v16i8:
800 define void @void_func_v16i8(<16 x i8> %arg0) #0 {
801 store volatile <16 x i8> %arg0, <16 x i8> addrspace(1)* undef
805 ; Check there is no crash.
806 ; GCN-LABEL: {{^}}void_func_v32i32_v16i8:
807 define void @void_func_v32i32_v16i8(<32 x i32> %arg0, <16 x i8> %arg1) #0 {
808 store volatile <32 x i32> %arg0, <32 x i32> addrspace(1)* undef
809 store volatile <16 x i8> %arg1, <16 x i8> addrspace(1)* undef
813 attributes #0 = { nounwind }