xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/arm64_vcopy.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -O1 -triple arm64-apple-ios7 -target-feature +neon -ffreestanding -S -o - -emit-llvm %s | FileCheck %s
2*0a6a1f1dSLionel Sambuc 
3*0a6a1f1dSLionel Sambuc // Test ARM64 SIMD copy vector element to vector element: vcopyq_lane*
4*0a6a1f1dSLionel Sambuc 
5*0a6a1f1dSLionel Sambuc #include <arm_neon.h>
6*0a6a1f1dSLionel Sambuc 
test_vcopyq_laneq_s8(int8x16_t a1,int8x16_t a2)7*0a6a1f1dSLionel Sambuc int8x16_t test_vcopyq_laneq_s8(int8x16_t a1, int8x16_t a2) {
8*0a6a1f1dSLionel Sambuc   // CHECK-LABEL: test_vcopyq_laneq_s8
9*0a6a1f1dSLionel Sambuc   return vcopyq_laneq_s8(a1, (int64_t) 3, a2, (int64_t) 13);
10*0a6a1f1dSLionel Sambuc   // CHECK: shufflevector <16 x i8> %a1, <16 x i8> %a2, <16 x i32> <i32 0, i32 1, i32 2, i32 29, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
11*0a6a1f1dSLionel Sambuc }
12*0a6a1f1dSLionel Sambuc 
test_vcopyq_laneq_u8(uint8x16_t a1,uint8x16_t a2)13*0a6a1f1dSLionel Sambuc uint8x16_t test_vcopyq_laneq_u8(uint8x16_t a1, uint8x16_t a2) {
14*0a6a1f1dSLionel Sambuc   // CHECK-LABEL: test_vcopyq_laneq_u8
15*0a6a1f1dSLionel Sambuc   return vcopyq_laneq_u8(a1, (int64_t) 3, a2, (int64_t) 13);
16*0a6a1f1dSLionel Sambuc   // CHECK: shufflevector <16 x i8> %a1, <16 x i8> %a2, <16 x i32> <i32 0, i32 1, i32 2, i32 29, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
17*0a6a1f1dSLionel Sambuc 
18*0a6a1f1dSLionel Sambuc }
19*0a6a1f1dSLionel Sambuc 
test_vcopyq_laneq_s16(int16x8_t a1,int16x8_t a2)20*0a6a1f1dSLionel Sambuc int16x8_t test_vcopyq_laneq_s16(int16x8_t a1, int16x8_t a2) {
21*0a6a1f1dSLionel Sambuc   // CHECK-LABEL: test_vcopyq_laneq_s16
22*0a6a1f1dSLionel Sambuc   return vcopyq_laneq_s16(a1, (int64_t) 3, a2, (int64_t) 7);
23*0a6a1f1dSLionel Sambuc   // CHECK: shufflevector <8 x i16> %a1, <8 x i16> %a2, <8 x i32> <i32 0, i32 1, i32 2, i32 15, i32 4, i32 5, i32 6, i32 7>
24*0a6a1f1dSLionel Sambuc 
25*0a6a1f1dSLionel Sambuc }
26*0a6a1f1dSLionel Sambuc 
test_vcopyq_laneq_u16(uint16x8_t a1,uint16x8_t a2)27*0a6a1f1dSLionel Sambuc uint16x8_t test_vcopyq_laneq_u16(uint16x8_t a1, uint16x8_t a2) {
28*0a6a1f1dSLionel Sambuc   // CHECK-LABEL: test_vcopyq_laneq_u16
29*0a6a1f1dSLionel Sambuc   return vcopyq_laneq_u16(a1, (int64_t) 3, a2, (int64_t) 7);
30*0a6a1f1dSLionel Sambuc   // CHECK: shufflevector <8 x i16> %a1, <8 x i16> %a2, <8 x i32> <i32 0, i32 1, i32 2, i32 15, i32 4, i32 5, i32 6, i32 7>
31*0a6a1f1dSLionel Sambuc 
32*0a6a1f1dSLionel Sambuc }
33*0a6a1f1dSLionel Sambuc 
test_vcopyq_laneq_s32(int32x4_t a1,int32x4_t a2)34*0a6a1f1dSLionel Sambuc int32x4_t test_vcopyq_laneq_s32(int32x4_t a1, int32x4_t a2) {
35*0a6a1f1dSLionel Sambuc   // CHECK-LABEL: test_vcopyq_laneq_s32
36*0a6a1f1dSLionel Sambuc   return vcopyq_laneq_s32(a1, (int64_t) 3, a2, (int64_t) 3);
37*0a6a1f1dSLionel Sambuc   // CHECK: shufflevector <4 x i32> %a1, <4 x i32> %a2, <4 x i32> <i32 0, i32 1, i32 2, i32 7>
38*0a6a1f1dSLionel Sambuc }
39*0a6a1f1dSLionel Sambuc 
test_vcopyq_laneq_u32(uint32x4_t a1,uint32x4_t a2)40*0a6a1f1dSLionel Sambuc uint32x4_t test_vcopyq_laneq_u32(uint32x4_t a1, uint32x4_t a2) {
41*0a6a1f1dSLionel Sambuc   // CHECK-LABEL: test_vcopyq_laneq_u32
42*0a6a1f1dSLionel Sambuc   return vcopyq_laneq_u32(a1, (int64_t) 3, a2, (int64_t) 3);
43*0a6a1f1dSLionel Sambuc   // CHECK: shufflevector <4 x i32> %a1, <4 x i32> %a2, <4 x i32> <i32 0, i32 1, i32 2, i32 7>
44*0a6a1f1dSLionel Sambuc }
45*0a6a1f1dSLionel Sambuc 
test_vcopyq_laneq_s64(int64x2_t a1,int64x2_t a2)46*0a6a1f1dSLionel Sambuc int64x2_t test_vcopyq_laneq_s64(int64x2_t a1, int64x2_t a2) {
47*0a6a1f1dSLionel Sambuc   // CHECK-LABEL: test_vcopyq_laneq_s64
48*0a6a1f1dSLionel Sambuc   return vcopyq_laneq_s64(a1, (int64_t) 0, a2, (int64_t) 1);
49*0a6a1f1dSLionel Sambuc   // CHECK: shufflevector <2 x i64> %a1, <2 x i64> %a2, <2 x i32> <i32 3, i32 1>
50*0a6a1f1dSLionel Sambuc }
51*0a6a1f1dSLionel Sambuc 
test_vcopyq_laneq_u64(uint64x2_t a1,uint64x2_t a2)52*0a6a1f1dSLionel Sambuc uint64x2_t test_vcopyq_laneq_u64(uint64x2_t a1, uint64x2_t a2) {
53*0a6a1f1dSLionel Sambuc   // CHECK-LABEL: test_vcopyq_laneq_u64
54*0a6a1f1dSLionel Sambuc   return vcopyq_laneq_u64(a1, (int64_t) 0, a2, (int64_t) 1);
55*0a6a1f1dSLionel Sambuc   // CHECK: shufflevector <2 x i64> %a1, <2 x i64> %a2, <2 x i32> <i32 3, i32 1>
56*0a6a1f1dSLionel Sambuc }
57*0a6a1f1dSLionel Sambuc 
test_vcopyq_laneq_f32(float32x4_t a1,float32x4_t a2)58*0a6a1f1dSLionel Sambuc float32x4_t test_vcopyq_laneq_f32(float32x4_t a1, float32x4_t a2) {
59*0a6a1f1dSLionel Sambuc   // CHECK-LABEL: test_vcopyq_laneq_f32
60*0a6a1f1dSLionel Sambuc   return vcopyq_laneq_f32(a1, 0, a2, 3);
61*0a6a1f1dSLionel Sambuc   // CHECK: shufflevector <4 x float> %a1, <4 x float> %a2, <4 x i32> <i32 7, i32 1, i32 2, i32 3>
62*0a6a1f1dSLionel Sambuc }
63*0a6a1f1dSLionel Sambuc 
test_vcopyq_laneq_f64(float64x2_t a1,float64x2_t a2)64*0a6a1f1dSLionel Sambuc float64x2_t test_vcopyq_laneq_f64(float64x2_t a1, float64x2_t a2) {
65*0a6a1f1dSLionel Sambuc   // CHECK-LABEL: test_vcopyq_laneq_f64
66*0a6a1f1dSLionel Sambuc   return vcopyq_laneq_f64(a1, 0, a2, 1);
67*0a6a1f1dSLionel Sambuc   // CHECK: shufflevector <2 x double> %a1, <2 x double> %a2, <2 x i32> <i32 3, i32 1>
68*0a6a1f1dSLionel Sambuc }
69*0a6a1f1dSLionel Sambuc 
70