AArch64/ARM64: port some NEON tests to ARM64
[oota-llvm.git] / test / CodeGen / AArch64 / neon-bitcast.ll
1 ; RUN: llc -mtriple=aarch64-none-linux-gnu -mattr=+neon -verify-machineinstrs < %s | FileCheck %s
2 ; RUN: llc -mtriple=arm64-none-linux-gnu -mattr=+neon -verify-machineinstrs < %s | FileCheck %s
3
4 ; From <8 x i8>
5
6 define <1 x i64> @test_v8i8_to_v1i64(<8 x i8> %in) nounwind {
7 ; CHECK: test_v8i8_to_v1i64:
8 ; CHECK-NEXT: // BB#0:
9 ; CHECK-NEXT: ret
10
11   %val = bitcast <8 x i8> %in to <1 x i64>
12   ret <1 x i64> %val
13 }
14
15 define <2 x i32> @test_v8i8_to_v2i32(<8 x i8> %in) nounwind {
16 ; CHECK: test_v8i8_to_v2i32:
17 ; CHECK-NEXT: // BB#0:
18 ; CHECK-NEXT: ret
19
20   %val = bitcast <8 x i8> %in to <2 x i32>
21   ret <2 x i32> %val
22 }
23
24 define <2 x float> @test_v8i8_to_v2f32(<8 x i8> %in) nounwind{
25 ; CHECK: test_v8i8_to_v2f32:
26 ; CHECK-NEXT: // BB#0:
27 ; CHECK-NEXT: ret
28
29   %val = bitcast <8 x i8> %in to <2 x float>
30   ret <2 x float> %val
31 }
32
33 define <4 x i16> @test_v8i8_to_v4i16(<8 x i8> %in) nounwind{
34 ; CHECK: test_v8i8_to_v4i16:
35 ; CHECK-NEXT: // BB#0:
36 ; CHECK-NEXT: ret
37
38   %val = bitcast <8 x i8> %in to <4 x i16>
39   ret <4 x i16> %val
40 }
41
42 define <8 x i8> @test_v8i8_to_v8i8(<8 x i8> %in) nounwind{
43 ; CHECK: test_v8i8_to_v8i8:
44 ; CHECK-NEXT: // BB#0:
45 ; CHECK-NEXT: ret
46
47   %val = bitcast <8 x i8> %in to <8 x i8>
48   ret <8 x i8> %val
49 }
50
51 ; From <4 x i16>
52
53 define <1 x i64> @test_v4i16_to_v1i64(<4 x i16> %in) nounwind {
54 ; CHECK: test_v4i16_to_v1i64:
55 ; CHECK-NEXT: // BB#0:
56 ; CHECK-NEXT: ret
57
58   %val = bitcast <4 x i16> %in to <1 x i64>
59   ret <1 x i64> %val
60 }
61
62 define <2 x i32> @test_v4i16_to_v2i32(<4 x i16> %in) nounwind {
63 ; CHECK: test_v4i16_to_v2i32:
64 ; CHECK-NEXT: // BB#0:
65 ; CHECK-NEXT: ret
66
67   %val = bitcast <4 x i16> %in to <2 x i32>
68   ret <2 x i32> %val
69 }
70
71 define <2 x float> @test_v4i16_to_v2f32(<4 x i16> %in) nounwind{
72 ; CHECK: test_v4i16_to_v2f32:
73 ; CHECK-NEXT: // BB#0:
74 ; CHECK-NEXT: ret
75
76   %val = bitcast <4 x i16> %in to <2 x float>
77   ret <2 x float> %val
78 }
79
80 define <4 x i16> @test_v4i16_to_v4i16(<4 x i16> %in) nounwind{
81 ; CHECK: test_v4i16_to_v4i16:
82 ; CHECK-NEXT: // BB#0:
83 ; CHECK-NEXT: ret
84
85   %val = bitcast <4 x i16> %in to <4 x i16>
86   ret <4 x i16> %val
87 }
88
89 define <8 x i8> @test_v4i16_to_v8i8(<4 x i16> %in) nounwind{
90 ; CHECK: test_v4i16_to_v8i8:
91 ; CHECK-NEXT: // BB#0:
92 ; CHECK-NEXT: ret
93
94   %val = bitcast <4 x i16> %in to <8 x i8>
95   ret <8 x i8> %val
96 }
97
98 ; From <2 x i32>
99
100 define <1 x i64> @test_v2i32_to_v1i64(<2 x i32> %in) nounwind {
101 ; CHECK: test_v2i32_to_v1i64:
102 ; CHECK-NEXT: // BB#0:
103 ; CHECK-NEXT: ret
104
105   %val = bitcast <2 x i32> %in to <1 x i64>
106   ret <1 x i64> %val
107 }
108
109 define <2 x i32> @test_v2i32_to_v2i32(<2 x i32> %in) nounwind {
110 ; CHECK: test_v2i32_to_v2i32:
111 ; CHECK-NEXT: // BB#0:
112 ; CHECK-NEXT: ret
113
114   %val = bitcast <2 x i32> %in to <2 x i32>
115   ret <2 x i32> %val
116 }
117
118 define <2 x float> @test_v2i32_to_v2f32(<2 x i32> %in) nounwind{
119 ; CHECK: test_v2i32_to_v2f32:
120 ; CHECK-NEXT: // BB#0:
121 ; CHECK-NEXT: ret
122
123   %val = bitcast <2 x i32> %in to <2 x float>
124   ret <2 x float> %val
125 }
126
127 define <4 x i16> @test_v2i32_to_v4i16(<2 x i32> %in) nounwind{
128 ; CHECK: test_v2i32_to_v4i16:
129 ; CHECK-NEXT: // BB#0:
130 ; CHECK-NEXT: ret
131
132   %val = bitcast <2 x i32> %in to <4 x i16>
133   ret <4 x i16> %val
134 }
135
136 define <8 x i8> @test_v2i32_to_v8i8(<2 x i32> %in) nounwind{
137 ; CHECK: test_v2i32_to_v8i8:
138 ; CHECK-NEXT: // BB#0:
139 ; CHECK-NEXT: ret
140
141   %val = bitcast <2 x i32> %in to <8 x i8>
142   ret <8 x i8> %val
143 }
144
145 ; From <2 x float>
146
147 define <1 x i64> @test_v2f32_to_v1i64(<2 x float> %in) nounwind {
148 ; CHECK: test_v2f32_to_v1i64:
149 ; CHECK-NEXT: // BB#0:
150 ; CHECK-NEXT: ret
151
152   %val = bitcast <2 x float> %in to <1 x i64>
153   ret <1 x i64> %val
154 }
155
156 define <2 x i32> @test_v2f32_to_v2i32(<2 x float> %in) nounwind {
157 ; CHECK: test_v2f32_to_v2i32:
158 ; CHECK-NEXT: // BB#0:
159 ; CHECK-NEXT: ret
160
161   %val = bitcast <2 x float> %in to <2 x i32>
162   ret <2 x i32> %val
163 }
164
165 define <2 x float> @test_v2f32_to_v2f32(<2 x float> %in) nounwind{
166 ; CHECK: test_v2f32_to_v2f32:
167 ; CHECK-NEXT: // BB#0:
168 ; CHECK-NEXT: ret
169
170   %val = bitcast <2 x float> %in to <2 x float>
171   ret <2 x float> %val
172 }
173
174 define <4 x i16> @test_v2f32_to_v4i16(<2 x float> %in) nounwind{
175 ; CHECK: test_v2f32_to_v4i16:
176 ; CHECK-NEXT: // BB#0:
177 ; CHECK-NEXT: ret
178
179   %val = bitcast <2 x float> %in to <4 x i16>
180   ret <4 x i16> %val
181 }
182
183 define <8 x i8> @test_v2f32_to_v8i8(<2 x float> %in) nounwind{
184 ; CHECK: test_v2f32_to_v8i8:
185 ; CHECK-NEXT: // BB#0:
186 ; CHECK-NEXT: ret
187
188   %val = bitcast <2 x float> %in to <8 x i8>
189   ret <8 x i8> %val
190 }
191
192 ; From <1 x i64>
193
194 define <1 x i64> @test_v1i64_to_v1i64(<1 x i64> %in) nounwind {
195 ; CHECK: test_v1i64_to_v1i64:
196 ; CHECK-NEXT: // BB#0:
197 ; CHECK-NEXT: ret
198
199   %val = bitcast <1 x i64> %in to <1 x i64>
200   ret <1 x i64> %val
201 }
202
203 define <2 x i32> @test_v1i64_to_v2i32(<1 x i64> %in) nounwind {
204 ; CHECK: test_v1i64_to_v2i32:
205 ; CHECK-NEXT: // BB#0:
206 ; CHECK-NEXT: ret
207
208   %val = bitcast <1 x i64> %in to <2 x i32>
209   ret <2 x i32> %val
210 }
211
212 define <2 x float> @test_v1i64_to_v2f32(<1 x i64> %in) nounwind{
213 ; CHECK: test_v1i64_to_v2f32:
214 ; CHECK-NEXT: // BB#0:
215 ; CHECK-NEXT: ret
216
217   %val = bitcast <1 x i64> %in to <2 x float>
218   ret <2 x float> %val
219 }
220
221 define <4 x i16> @test_v1i64_to_v4i16(<1 x i64> %in) nounwind{
222 ; CHECK: test_v1i64_to_v4i16:
223 ; CHECK-NEXT: // BB#0:
224 ; CHECK-NEXT: ret
225
226   %val = bitcast <1 x i64> %in to <4 x i16>
227   ret <4 x i16> %val
228 }
229
230 define <8 x i8> @test_v1i64_to_v8i8(<1 x i64> %in) nounwind{
231 ; CHECK: test_v1i64_to_v8i8:
232 ; CHECK-NEXT: // BB#0:
233 ; CHECK-NEXT: ret
234
235   %val = bitcast <1 x i64> %in to <8 x i8>
236   ret <8 x i8> %val
237 }
238
239
240 ; From <16 x i8>
241
242 define <2 x double> @test_v16i8_to_v2f64(<16 x i8> %in) nounwind {
243 ; CHECK: test_v16i8_to_v2f64:
244 ; CHECK-NEXT: // BB#0:
245 ; CHECK-NEXT: ret
246
247   %val = bitcast <16 x i8> %in to <2 x double>
248   ret <2 x double> %val
249 }
250
251 define <2 x i64> @test_v16i8_to_v2i64(<16 x i8> %in) nounwind {
252 ; CHECK: test_v16i8_to_v2i64:
253 ; CHECK-NEXT: // BB#0:
254 ; CHECK-NEXT: ret
255
256   %val = bitcast <16 x i8> %in to <2 x i64>
257   ret <2 x i64> %val
258 }
259
260 define <4 x i32> @test_v16i8_to_v4i32(<16 x i8> %in) nounwind {
261 ; CHECK: test_v16i8_to_v4i32:
262 ; CHECK-NEXT: // BB#0:
263 ; CHECK-NEXT: ret
264
265   %val = bitcast <16 x i8> %in to <4 x i32>
266   ret <4 x i32> %val
267 }
268
269 define <4 x float> @test_v16i8_to_v2f32(<16 x i8> %in) nounwind{
270 ; CHECK: test_v16i8_to_v2f32:
271 ; CHECK-NEXT: // BB#0:
272 ; CHECK-NEXT: ret
273
274   %val = bitcast <16 x i8> %in to <4 x float>
275   ret <4 x float> %val
276 }
277
278 define <8 x i16> @test_v16i8_to_v8i16(<16 x i8> %in) nounwind{
279 ; CHECK: test_v16i8_to_v8i16:
280 ; CHECK-NEXT: // BB#0:
281 ; CHECK-NEXT: ret
282
283   %val = bitcast <16 x i8> %in to <8 x i16>
284   ret <8 x i16> %val
285 }
286
287 define <16 x i8> @test_v16i8_to_v16i8(<16 x i8> %in) nounwind{
288 ; CHECK: test_v16i8_to_v16i8:
289 ; CHECK-NEXT: // BB#0:
290 ; CHECK-NEXT: ret
291
292   %val = bitcast <16 x i8> %in to <16 x i8>
293   ret <16 x i8> %val
294 }
295
296 ; From <8 x i16>
297
298 define <2 x double> @test_v8i16_to_v2f64(<8 x i16> %in) nounwind {
299 ; CHECK: test_v8i16_to_v2f64:
300 ; CHECK-NEXT: // BB#0:
301 ; CHECK-NEXT: ret
302
303   %val = bitcast <8 x i16> %in to <2 x double>
304   ret <2 x double> %val
305 }
306
307 define <2 x i64> @test_v8i16_to_v2i64(<8 x i16> %in) nounwind {
308 ; CHECK: test_v8i16_to_v2i64:
309 ; CHECK-NEXT: // BB#0:
310 ; CHECK-NEXT: ret
311
312   %val = bitcast <8 x i16> %in to <2 x i64>
313   ret <2 x i64> %val
314 }
315
316 define <4 x i32> @test_v8i16_to_v4i32(<8 x i16> %in) nounwind {
317 ; CHECK: test_v8i16_to_v4i32:
318 ; CHECK-NEXT: // BB#0:
319 ; CHECK-NEXT: ret
320
321   %val = bitcast <8 x i16> %in to <4 x i32>
322   ret <4 x i32> %val
323 }
324
325 define <4 x float> @test_v8i16_to_v2f32(<8 x i16> %in) nounwind{
326 ; CHECK: test_v8i16_to_v2f32:
327 ; CHECK-NEXT: // BB#0:
328 ; CHECK-NEXT: ret
329
330   %val = bitcast <8 x i16> %in to <4 x float>
331   ret <4 x float> %val
332 }
333
334 define <8 x i16> @test_v8i16_to_v8i16(<8 x i16> %in) nounwind{
335 ; CHECK: test_v8i16_to_v8i16:
336 ; CHECK-NEXT: // BB#0:
337 ; CHECK-NEXT: ret
338
339   %val = bitcast <8 x i16> %in to <8 x i16>
340   ret <8 x i16> %val
341 }
342
343 define <16 x i8> @test_v8i16_to_v16i8(<8 x i16> %in) nounwind{
344 ; CHECK: test_v8i16_to_v16i8:
345 ; CHECK-NEXT: // BB#0:
346 ; CHECK-NEXT: ret
347
348   %val = bitcast <8 x i16> %in to <16 x i8>
349   ret <16 x i8> %val
350 }
351
352 ; From <4 x i32>
353
354 define <2 x double> @test_v4i32_to_v2f64(<4 x i32> %in) nounwind {
355 ; CHECK: test_v4i32_to_v2f64:
356 ; CHECK-NEXT: // BB#0:
357 ; CHECK-NEXT: ret
358
359   %val = bitcast <4 x i32> %in to <2 x double>
360   ret <2 x double> %val
361 }
362
363 define <2 x i64> @test_v4i32_to_v2i64(<4 x i32> %in) nounwind {
364 ; CHECK: test_v4i32_to_v2i64:
365 ; CHECK-NEXT: // BB#0:
366 ; CHECK-NEXT: ret
367
368   %val = bitcast <4 x i32> %in to <2 x i64>
369   ret <2 x i64> %val
370 }
371
372 define <4 x i32> @test_v4i32_to_v4i32(<4 x i32> %in) nounwind {
373 ; CHECK: test_v4i32_to_v4i32:
374 ; CHECK-NEXT: // BB#0:
375 ; CHECK-NEXT: ret
376
377   %val = bitcast <4 x i32> %in to <4 x i32>
378   ret <4 x i32> %val
379 }
380
381 define <4 x float> @test_v4i32_to_v2f32(<4 x i32> %in) nounwind{
382 ; CHECK: test_v4i32_to_v2f32:
383 ; CHECK-NEXT: // BB#0:
384 ; CHECK-NEXT: ret
385
386   %val = bitcast <4 x i32> %in to <4 x float>
387   ret <4 x float> %val
388 }
389
390 define <8 x i16> @test_v4i32_to_v8i16(<4 x i32> %in) nounwind{
391 ; CHECK: test_v4i32_to_v8i16:
392 ; CHECK-NEXT: // BB#0:
393 ; CHECK-NEXT: ret
394
395   %val = bitcast <4 x i32> %in to <8 x i16>
396   ret <8 x i16> %val
397 }
398
399 define <16 x i8> @test_v4i32_to_v16i8(<4 x i32> %in) nounwind{
400 ; CHECK: test_v4i32_to_v16i8:
401 ; CHECK-NEXT: // BB#0:
402 ; CHECK-NEXT: ret
403
404   %val = bitcast <4 x i32> %in to <16 x i8>
405   ret <16 x i8> %val
406 }
407
408 ; From <4 x float>
409
410 define <2 x double> @test_v4f32_to_v2f64(<4 x float> %in) nounwind {
411 ; CHECK: test_v4f32_to_v2f64:
412 ; CHECK-NEXT: // BB#0:
413 ; CHECK-NEXT: ret
414
415   %val = bitcast <4 x float> %in to <2 x double>
416   ret <2 x double> %val
417 }
418
419 define <2 x i64> @test_v4f32_to_v2i64(<4 x float> %in) nounwind {
420 ; CHECK: test_v4f32_to_v2i64:
421 ; CHECK-NEXT: // BB#0:
422 ; CHECK-NEXT: ret
423
424   %val = bitcast <4 x float> %in to <2 x i64>
425   ret <2 x i64> %val
426 }
427
428 define <4 x i32> @test_v4f32_to_v4i32(<4 x float> %in) nounwind {
429 ; CHECK: test_v4f32_to_v4i32:
430 ; CHECK-NEXT: // BB#0:
431 ; CHECK-NEXT: ret
432
433   %val = bitcast <4 x float> %in to <4 x i32>
434   ret <4 x i32> %val
435 }
436
437 define <4 x float> @test_v4f32_to_v4f32(<4 x float> %in) nounwind{
438 ; CHECK: test_v4f32_to_v4f32:
439 ; CHECK-NEXT: // BB#0:
440 ; CHECK-NEXT: ret
441
442   %val = bitcast <4 x float> %in to <4 x float>
443   ret <4 x float> %val
444 }
445
446 define <8 x i16> @test_v4f32_to_v8i16(<4 x float> %in) nounwind{
447 ; CHECK: test_v4f32_to_v8i16:
448 ; CHECK-NEXT: // BB#0:
449 ; CHECK-NEXT: ret
450
451   %val = bitcast <4 x float> %in to <8 x i16>
452   ret <8 x i16> %val
453 }
454
455 define <16 x i8> @test_v4f32_to_v16i8(<4 x float> %in) nounwind{
456 ; CHECK: test_v4f32_to_v16i8:
457 ; CHECK-NEXT: // BB#0:
458 ; CHECK-NEXT: ret
459
460   %val = bitcast <4 x float> %in to <16 x i8>
461   ret <16 x i8> %val
462 }
463
464 ; From <2 x i64>
465
466 define <2 x double> @test_v2i64_to_v2f64(<2 x i64> %in) nounwind {
467 ; CHECK: test_v2i64_to_v2f64:
468 ; CHECK-NEXT: // BB#0:
469 ; CHECK-NEXT: ret
470
471   %val = bitcast <2 x i64> %in to <2 x double>
472   ret <2 x double> %val
473 }
474
475 define <2 x i64> @test_v2i64_to_v2i64(<2 x i64> %in) nounwind {
476 ; CHECK: test_v2i64_to_v2i64:
477 ; CHECK-NEXT: // BB#0:
478 ; CHECK-NEXT: ret
479
480   %val = bitcast <2 x i64> %in to <2 x i64>
481   ret <2 x i64> %val
482 }
483
484 define <4 x i32> @test_v2i64_to_v4i32(<2 x i64> %in) nounwind {
485 ; CHECK: test_v2i64_to_v4i32:
486 ; CHECK-NEXT: // BB#0:
487 ; CHECK-NEXT: ret
488
489   %val = bitcast <2 x i64> %in to <4 x i32>
490   ret <4 x i32> %val
491 }
492
493 define <4 x float> @test_v2i64_to_v4f32(<2 x i64> %in) nounwind{
494 ; CHECK: test_v2i64_to_v4f32:
495 ; CHECK-NEXT: // BB#0:
496 ; CHECK-NEXT: ret
497
498   %val = bitcast <2 x i64> %in to <4 x float>
499   ret <4 x float> %val
500 }
501
502 define <8 x i16> @test_v2i64_to_v8i16(<2 x i64> %in) nounwind{
503 ; CHECK: test_v2i64_to_v8i16:
504 ; CHECK-NEXT: // BB#0:
505 ; CHECK-NEXT: ret
506
507   %val = bitcast <2 x i64> %in to <8 x i16>
508   ret <8 x i16> %val
509 }
510
511 define <16 x i8> @test_v2i64_to_v16i8(<2 x i64> %in) nounwind{
512 ; CHECK: test_v2i64_to_v16i8:
513 ; CHECK-NEXT: // BB#0:
514 ; CHECK-NEXT: ret
515
516   %val = bitcast <2 x i64> %in to <16 x i8>
517   ret <16 x i8> %val
518 }
519
520 ; From <2 x double>
521
522 define <2 x double> @test_v2f64_to_v2f64(<2 x double> %in) nounwind {
523 ; CHECK: test_v2f64_to_v2f64:
524 ; CHECK-NEXT: // BB#0:
525 ; CHECK-NEXT: ret
526
527   %val = bitcast <2 x double> %in to <2 x double>
528   ret <2 x double> %val
529 }
530
531 define <2 x i64> @test_v2f64_to_v2i64(<2 x double> %in) nounwind {
532 ; CHECK: test_v2f64_to_v2i64:
533 ; CHECK-NEXT: // BB#0:
534 ; CHECK-NEXT: ret
535
536   %val = bitcast <2 x double> %in to <2 x i64>
537   ret <2 x i64> %val
538 }
539
540 define <4 x i32> @test_v2f64_to_v4i32(<2 x double> %in) nounwind {
541 ; CHECK: test_v2f64_to_v4i32:
542 ; CHECK-NEXT: // BB#0:
543 ; CHECK-NEXT: ret
544
545   %val = bitcast <2 x double> %in to <4 x i32>
546   ret <4 x i32> %val
547 }
548
549 define <4 x float> @test_v2f64_to_v4f32(<2 x double> %in) nounwind{
550 ; CHECK: test_v2f64_to_v4f32:
551 ; CHECK-NEXT: // BB#0:
552 ; CHECK-NEXT: ret
553
554   %val = bitcast <2 x double> %in to <4 x float>
555   ret <4 x float> %val
556 }
557
558 define <8 x i16> @test_v2f64_to_v8i16(<2 x double> %in) nounwind{
559 ; CHECK: test_v2f64_to_v8i16:
560 ; CHECK-NEXT: // BB#0:
561 ; CHECK-NEXT: ret
562
563   %val = bitcast <2 x double> %in to <8 x i16>
564   ret <8 x i16> %val
565 }
566
567 define <16 x i8> @test_v2f64_to_v16i8(<2 x double> %in) nounwind{
568 ; CHECK: test_v2f64_to_v16i8:
569 ; CHECK-NEXT: // BB#0:
570 ; CHECK-NEXT: ret
571
572   %val = bitcast <2 x double> %in to <16 x i8>
573   ret <16 x i8> %val
574 }
575