1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-none-linux-gnu -mattr=+neon -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,CHECK-LE
3 ; RUN: llc -mtriple=aarch64_be-none-linux-gnu -mattr=+neon -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,CHECK-BE
7 define <1 x i64> @test_v8i8_to_v1i64(<8 x i8> %in) nounwind {
8 ; CHECK-LABEL: test_v8i8_to_v1i64:
11 %val = bitcast <8 x i8> %in to <1 x i64>
15 define <2 x i32> @test_v8i8_to_v2i32(<8 x i8> %in) nounwind {
16 ; CHECK-LABEL: test_v8i8_to_v2i32:
19 %val = bitcast <8 x i8> %in to <2 x i32>
23 define <2 x float> @test_v8i8_to_v2f32(<8 x i8> %in) nounwind{
24 ; CHECK-LABEL: test_v8i8_to_v2f32:
27 %val = bitcast <8 x i8> %in to <2 x float>
31 define <4 x i16> @test_v8i8_to_v4i16(<8 x i8> %in) nounwind{
32 ; CHECK-LABEL: test_v8i8_to_v4i16:
35 %val = bitcast <8 x i8> %in to <4 x i16>
39 define <8 x i8> @test_v8i8_to_v8i8(<8 x i8> %in) nounwind{
40 ; CHECK-LABEL: test_v8i8_to_v8i8:
43 %val = bitcast <8 x i8> %in to <8 x i8>
49 define <1 x i64> @test_v4i16_to_v1i64(<4 x i16> %in) nounwind {
50 ; CHECK-LABEL: test_v4i16_to_v1i64:
53 %val = bitcast <4 x i16> %in to <1 x i64>
57 define <2 x i32> @test_v4i16_to_v2i32(<4 x i16> %in) nounwind {
58 ; CHECK-LABEL: test_v4i16_to_v2i32:
61 %val = bitcast <4 x i16> %in to <2 x i32>
65 define <2 x float> @test_v4i16_to_v2f32(<4 x i16> %in) nounwind{
66 ; CHECK-LABEL: test_v4i16_to_v2f32:
69 %val = bitcast <4 x i16> %in to <2 x float>
73 define <4 x i16> @test_v4i16_to_v4i16(<4 x i16> %in) nounwind{
74 ; CHECK-LABEL: test_v4i16_to_v4i16:
77 %val = bitcast <4 x i16> %in to <4 x i16>
81 define <8 x i8> @test_v4i16_to_v8i8(<4 x i16> %in) nounwind{
82 ; CHECK-LABEL: test_v4i16_to_v8i8:
85 %val = bitcast <4 x i16> %in to <8 x i8>
91 define <1 x i64> @test_v2i32_to_v1i64(<2 x i32> %in) nounwind {
92 ; CHECK-LABEL: test_v2i32_to_v1i64:
95 %val = bitcast <2 x i32> %in to <1 x i64>
99 define <2 x i32> @test_v2i32_to_v2i32(<2 x i32> %in) nounwind {
100 ; CHECK-LABEL: test_v2i32_to_v2i32:
103 %val = bitcast <2 x i32> %in to <2 x i32>
107 define <2 x float> @test_v2i32_to_v2f32(<2 x i32> %in) nounwind{
108 ; CHECK-LABEL: test_v2i32_to_v2f32:
111 %val = bitcast <2 x i32> %in to <2 x float>
115 define <4 x i16> @test_v2i32_to_v4i16(<2 x i32> %in) nounwind{
116 ; CHECK-LABEL: test_v2i32_to_v4i16:
119 %val = bitcast <2 x i32> %in to <4 x i16>
123 define <8 x i8> @test_v2i32_to_v8i8(<2 x i32> %in) nounwind{
124 ; CHECK-LABEL: test_v2i32_to_v8i8:
127 %val = bitcast <2 x i32> %in to <8 x i8>
133 define <1 x i64> @test_v2f32_to_v1i64(<2 x float> %in) nounwind {
134 ; CHECK-LABEL: test_v2f32_to_v1i64:
137 %val = bitcast <2 x float> %in to <1 x i64>
141 define <2 x i32> @test_v2f32_to_v2i32(<2 x float> %in) nounwind {
142 ; CHECK-LABEL: test_v2f32_to_v2i32:
145 %val = bitcast <2 x float> %in to <2 x i32>
149 define <2 x float> @test_v2f32_to_v2f32(<2 x float> %in) nounwind{
150 ; CHECK-LABEL: test_v2f32_to_v2f32:
153 %val = bitcast <2 x float> %in to <2 x float>
157 define <4 x i16> @test_v2f32_to_v4i16(<2 x float> %in) nounwind{
158 ; CHECK-LABEL: test_v2f32_to_v4i16:
161 %val = bitcast <2 x float> %in to <4 x i16>
165 define <8 x i8> @test_v2f32_to_v8i8(<2 x float> %in) nounwind{
166 ; CHECK-LABEL: test_v2f32_to_v8i8:
169 %val = bitcast <2 x float> %in to <8 x i8>
175 define <1 x i64> @test_v1i64_to_v1i64(<1 x i64> %in) nounwind {
176 ; CHECK-LABEL: test_v1i64_to_v1i64:
179 %val = bitcast <1 x i64> %in to <1 x i64>
183 define <2 x i32> @test_v1i64_to_v2i32(<1 x i64> %in) nounwind {
184 ; CHECK-LABEL: test_v1i64_to_v2i32:
187 %val = bitcast <1 x i64> %in to <2 x i32>
191 define <2 x float> @test_v1i64_to_v2f32(<1 x i64> %in) nounwind{
192 ; CHECK-LABEL: test_v1i64_to_v2f32:
195 %val = bitcast <1 x i64> %in to <2 x float>
199 define <4 x i16> @test_v1i64_to_v4i16(<1 x i64> %in) nounwind{
200 ; CHECK-LABEL: test_v1i64_to_v4i16:
203 %val = bitcast <1 x i64> %in to <4 x i16>
207 define <8 x i8> @test_v1i64_to_v8i8(<1 x i64> %in) nounwind{
208 ; CHECK-LABEL: test_v1i64_to_v8i8:
211 %val = bitcast <1 x i64> %in to <8 x i8>
218 define <2 x double> @test_v16i8_to_v2f64(<16 x i8> %in) nounwind {
219 ; CHECK-LABEL: test_v16i8_to_v2f64:
222 %val = bitcast <16 x i8> %in to <2 x double>
223 ret <2 x double> %val
226 define <2 x i64> @test_v16i8_to_v2i64(<16 x i8> %in) nounwind {
227 ; CHECK-LABEL: test_v16i8_to_v2i64:
230 %val = bitcast <16 x i8> %in to <2 x i64>
234 define <4 x i32> @test_v16i8_to_v4i32(<16 x i8> %in) nounwind {
235 ; CHECK-LABEL: test_v16i8_to_v4i32:
238 %val = bitcast <16 x i8> %in to <4 x i32>
242 define <4 x float> @test_v16i8_to_v2f32(<16 x i8> %in) nounwind{
243 ; CHECK-LABEL: test_v16i8_to_v2f32:
246 %val = bitcast <16 x i8> %in to <4 x float>
250 define <8 x i16> @test_v16i8_to_v8i16(<16 x i8> %in) nounwind{
251 ; CHECK-LABEL: test_v16i8_to_v8i16:
254 %val = bitcast <16 x i8> %in to <8 x i16>
258 define <16 x i8> @test_v16i8_to_v16i8(<16 x i8> %in) nounwind{
259 ; CHECK-LABEL: test_v16i8_to_v16i8:
262 %val = bitcast <16 x i8> %in to <16 x i8>
268 define <2 x double> @test_v8i16_to_v2f64(<8 x i16> %in) nounwind {
269 ; CHECK-LABEL: test_v8i16_to_v2f64:
272 %val = bitcast <8 x i16> %in to <2 x double>
273 ret <2 x double> %val
276 define <2 x i64> @test_v8i16_to_v2i64(<8 x i16> %in) nounwind {
278 ; CHECK-LABEL: test_v8i16_to_v2i64:
281 %val = bitcast <8 x i16> %in to <2 x i64>
285 define <4 x i32> @test_v8i16_to_v4i32(<8 x i16> %in) nounwind {
286 ; CHECK-LABEL: test_v8i16_to_v4i32:
289 %val = bitcast <8 x i16> %in to <4 x i32>
293 define <4 x float> @test_v8i16_to_v2f32(<8 x i16> %in) nounwind{
294 ; CHECK-LABEL: test_v8i16_to_v2f32:
297 %val = bitcast <8 x i16> %in to <4 x float>
301 define <8 x i16> @test_v8i16_to_v8i16(<8 x i16> %in) nounwind{
302 ; CHECK-LABEL: test_v8i16_to_v8i16:
305 %val = bitcast <8 x i16> %in to <8 x i16>
309 define <16 x i8> @test_v8i16_to_v16i8(<8 x i16> %in) nounwind{
310 ; CHECK-LABEL: test_v8i16_to_v16i8:
313 %val = bitcast <8 x i16> %in to <16 x i8>
319 define <2 x double> @test_v4i32_to_v2f64(<4 x i32> %in) nounwind {
320 ; CHECK-LABEL: test_v4i32_to_v2f64:
323 %val = bitcast <4 x i32> %in to <2 x double>
324 ret <2 x double> %val
327 define <2 x i64> @test_v4i32_to_v2i64(<4 x i32> %in) nounwind {
328 ; CHECK-LABEL: test_v4i32_to_v2i64:
331 %val = bitcast <4 x i32> %in to <2 x i64>
335 define <4 x i32> @test_v4i32_to_v4i32(<4 x i32> %in) nounwind {
336 ; CHECK-LABEL: test_v4i32_to_v4i32:
339 %val = bitcast <4 x i32> %in to <4 x i32>
343 define <4 x float> @test_v4i32_to_v2f32(<4 x i32> %in) nounwind{
344 ; CHECK-LABEL: test_v4i32_to_v2f32:
347 %val = bitcast <4 x i32> %in to <4 x float>
351 define <8 x i16> @test_v4i32_to_v8i16(<4 x i32> %in) nounwind{
352 ; CHECK-LABEL: test_v4i32_to_v8i16:
355 %val = bitcast <4 x i32> %in to <8 x i16>
359 define <16 x i8> @test_v4i32_to_v16i8(<4 x i32> %in) nounwind{
360 ; CHECK-LABEL: test_v4i32_to_v16i8:
363 %val = bitcast <4 x i32> %in to <16 x i8>
369 define <2 x double> @test_v4f32_to_v2f64(<4 x float> %in) nounwind {
370 ; CHECK-LABEL: test_v4f32_to_v2f64:
373 %val = bitcast <4 x float> %in to <2 x double>
374 ret <2 x double> %val
377 define <2 x i64> @test_v4f32_to_v2i64(<4 x float> %in) nounwind {
378 ; CHECK-LABEL: test_v4f32_to_v2i64:
381 %val = bitcast <4 x float> %in to <2 x i64>
385 define <4 x i32> @test_v4f32_to_v4i32(<4 x float> %in) nounwind {
386 ; CHECK-LABEL: test_v4f32_to_v4i32:
389 %val = bitcast <4 x float> %in to <4 x i32>
393 define <4 x float> @test_v4f32_to_v4f32(<4 x float> %in) nounwind{
394 ; CHECK-LABEL: test_v4f32_to_v4f32:
397 %val = bitcast <4 x float> %in to <4 x float>
401 define <8 x i16> @test_v4f32_to_v8i16(<4 x float> %in) nounwind{
402 ; CHECK-LABEL: test_v4f32_to_v8i16:
405 %val = bitcast <4 x float> %in to <8 x i16>
409 define <16 x i8> @test_v4f32_to_v16i8(<4 x float> %in) nounwind{
410 ; CHECK-LABEL: test_v4f32_to_v16i8:
413 %val = bitcast <4 x float> %in to <16 x i8>
419 define <2 x double> @test_v2i64_to_v2f64(<2 x i64> %in) nounwind {
420 ; CHECK-LABEL: test_v2i64_to_v2f64:
423 %val = bitcast <2 x i64> %in to <2 x double>
424 ret <2 x double> %val
427 define <2 x i64> @test_v2i64_to_v2i64(<2 x i64> %in) nounwind {
428 ; CHECK-LABEL: test_v2i64_to_v2i64:
431 %val = bitcast <2 x i64> %in to <2 x i64>
435 define <4 x i32> @test_v2i64_to_v4i32(<2 x i64> %in) nounwind {
436 ; CHECK-LABEL: test_v2i64_to_v4i32:
439 %val = bitcast <2 x i64> %in to <4 x i32>
443 define <4 x float> @test_v2i64_to_v4f32(<2 x i64> %in) nounwind{
444 ; CHECK-LABEL: test_v2i64_to_v4f32:
447 %val = bitcast <2 x i64> %in to <4 x float>
451 define <8 x i16> @test_v2i64_to_v8i16(<2 x i64> %in) nounwind{
452 ; CHECK-LABEL: test_v2i64_to_v8i16:
455 %val = bitcast <2 x i64> %in to <8 x i16>
459 define <16 x i8> @test_v2i64_to_v16i8(<2 x i64> %in) nounwind{
460 ; CHECK-LABEL: test_v2i64_to_v16i8:
463 %val = bitcast <2 x i64> %in to <16 x i8>
469 define <2 x double> @test_v2f64_to_v2f64(<2 x double> %in) nounwind {
470 ; CHECK-LABEL: test_v2f64_to_v2f64:
473 %val = bitcast <2 x double> %in to <2 x double>
474 ret <2 x double> %val
477 define <2 x i64> @test_v2f64_to_v2i64(<2 x double> %in) nounwind {
478 ; CHECK-LABEL: test_v2f64_to_v2i64:
481 %val = bitcast <2 x double> %in to <2 x i64>
485 define <4 x i32> @test_v2f64_to_v4i32(<2 x double> %in) nounwind {
486 ; CHECK-LABEL: test_v2f64_to_v4i32:
489 %val = bitcast <2 x double> %in to <4 x i32>
493 define <4 x float> @test_v2f64_to_v4f32(<2 x double> %in) nounwind{
494 ; CHECK-LABEL: test_v2f64_to_v4f32:
497 %val = bitcast <2 x double> %in to <4 x float>
501 define <8 x i16> @test_v2f64_to_v8i16(<2 x double> %in) nounwind{
502 ; CHECK-LABEL: test_v2f64_to_v8i16:
505 %val = bitcast <2 x double> %in to <8 x i16>
509 define <16 x i8> @test_v2f64_to_v16i8(<2 x double> %in) nounwind{
510 ; CHECK-LABEL: test_v2f64_to_v16i8:
513 %val = bitcast <2 x double> %in to <16 x i8>
517 define <2 x i16> @bitcast_i32_to_v2i16(i32 %word) {
518 ; CHECK-LE-LABEL: bitcast_i32_to_v2i16:
519 ; CHECK-LE: // %bb.0:
520 ; CHECK-LE-NEXT: fmov s0, w0
521 ; CHECK-LE-NEXT: ushll v0.4s, v0.4h, #0
522 ; CHECK-LE-NEXT: // kill: def $d0 killed $d0 killed $q0
525 ; CHECK-BE-LABEL: bitcast_i32_to_v2i16:
526 ; CHECK-BE: // %bb.0:
527 ; CHECK-BE-NEXT: fmov s0, w0
528 ; CHECK-BE-NEXT: rev32 v0.4h, v0.4h
529 ; CHECK-BE-NEXT: ushll v0.4s, v0.4h, #0
530 ; CHECK-BE-NEXT: rev64 v0.2s, v0.2s
532 %ret = bitcast i32 %word to <2 x i16>
536 define <4 x i8> @bitcast_i32_to_v4i8(i32 %word) {
537 ; CHECK-LE-LABEL: bitcast_i32_to_v4i8:
538 ; CHECK-LE: // %bb.0:
539 ; CHECK-LE-NEXT: fmov s0, w0
540 ; CHECK-LE-NEXT: zip1 v0.8b, v0.8b, v0.8b
543 ; CHECK-BE-LABEL: bitcast_i32_to_v4i8:
544 ; CHECK-BE: // %bb.0:
545 ; CHECK-BE-NEXT: fmov s0, w0
546 ; CHECK-BE-NEXT: rev32 v0.8b, v0.8b
547 ; CHECK-BE-NEXT: zip1 v0.8b, v0.8b, v0.8b
548 ; CHECK-BE-NEXT: rev64 v0.8b, v0.8b
550 %ret = bitcast i32 %word to <4 x i8>
554 ; TODO: Eliminate redundant moving back and forth between gpr and vectors
555 define <2 x i8> @bitcast_i16_to_v2i8(i16 %word) {
556 ; CHECK-LE-LABEL: bitcast_i16_to_v2i8:
557 ; CHECK-LE: // %bb.0:
558 ; CHECK-LE-NEXT: fmov s0, w0
559 ; CHECK-LE-NEXT: umov w8, v0.b[0]
560 ; CHECK-LE-NEXT: umov w9, v0.b[1]
561 ; CHECK-LE-NEXT: fmov s0, w8
562 ; CHECK-LE-NEXT: mov v0.s[1], w9
563 ; CHECK-LE-NEXT: // kill: def $d0 killed $d0 killed $q0
566 ; CHECK-BE-LABEL: bitcast_i16_to_v2i8:
567 ; CHECK-BE: // %bb.0:
568 ; CHECK-BE-NEXT: fmov s0, w0
569 ; CHECK-BE-NEXT: rev16 v0.16b, v0.16b
570 ; CHECK-BE-NEXT: umov w8, v0.b[0]
571 ; CHECK-BE-NEXT: umov w9, v0.b[1]
572 ; CHECK-BE-NEXT: fmov s0, w8
573 ; CHECK-BE-NEXT: mov v0.s[1], w9
574 ; CHECK-BE-NEXT: rev64 v0.2s, v0.2s
576 %ret = bitcast i16 %word to <2 x i8>