blob: 3310efc5999fe96b6c9e6c1c23b6d6dd324ebcdd [file] [log] [blame]
Bob Wilsonc692cb72009-08-21 20:54:19 +00001; RUN: llvm-as < %s | llc -march=arm -mattr=+neon | FileCheck %s
2
3%struct.__builtin_neon_v8qi2 = type { <8 x i8>, <8 x i8> }
4%struct.__builtin_neon_v4hi2 = type { <4 x i16>, <4 x i16> }
5%struct.__builtin_neon_v2si2 = type { <2 x i32>, <2 x i32> }
6%struct.__builtin_neon_v2sf2 = type { <2 x float>, <2 x float> }
7
8%struct.__builtin_neon_v16qi2 = type { <16 x i8>, <16 x i8> }
9%struct.__builtin_neon_v8hi2 = type { <8 x i16>, <8 x i16> }
10%struct.__builtin_neon_v4si2 = type { <4 x i32>, <4 x i32> }
11%struct.__builtin_neon_v4sf2 = type { <4 x float>, <4 x float> }
12
13define <8 x i8> @vtrni8(<8 x i8>* %A, <8 x i8>* %B) nounwind {
14;CHECK: vtrni8:
15;CHECK: vtrn.8
Bob Wilsonb6c68f92009-08-22 00:13:23 +000016;CHECK-NEXT: vadd.i8
Bob Wilsonc692cb72009-08-21 20:54:19 +000017 %tmp1 = load <8 x i8>* %A
18 %tmp2 = load <8 x i8>* %B
19 %tmp3 = shufflevector <8 x i8> %tmp1, <8 x i8> %tmp2, <8 x i32> <i32 0, i32 8, i32 2, i32 10, i32 4, i32 12, i32 6, i32 14>
20 %tmp4 = shufflevector <8 x i8> %tmp1, <8 x i8> %tmp2, <8 x i32> <i32 1, i32 9, i32 3, i32 11, i32 5, i32 13, i32 7, i32 15>
21 %tmp5 = add <8 x i8> %tmp3, %tmp4
22 ret <8 x i8> %tmp5
23}
24
25define <4 x i16> @vtrni16(<4 x i16>* %A, <4 x i16>* %B) nounwind {
26;CHECK: vtrni16:
27;CHECK: vtrn.16
Bob Wilsonb6c68f92009-08-22 00:13:23 +000028;CHECK-NEXT: vadd.i16
Bob Wilsonc692cb72009-08-21 20:54:19 +000029 %tmp1 = load <4 x i16>* %A
30 %tmp2 = load <4 x i16>* %B
31 %tmp3 = shufflevector <4 x i16> %tmp1, <4 x i16> %tmp2, <4 x i32> <i32 0, i32 4, i32 2, i32 6>
32 %tmp4 = shufflevector <4 x i16> %tmp1, <4 x i16> %tmp2, <4 x i32> <i32 1, i32 5, i32 3, i32 7>
33 %tmp5 = add <4 x i16> %tmp3, %tmp4
34 ret <4 x i16> %tmp5
35}
36
37define <2 x i32> @vtrni32(<2 x i32>* %A, <2 x i32>* %B) nounwind {
38;CHECK: vtrni32:
39;CHECK: vtrn.32
Bob Wilsonb6c68f92009-08-22 00:13:23 +000040;CHECK-NEXT: vadd.i32
Bob Wilsonc692cb72009-08-21 20:54:19 +000041 %tmp1 = load <2 x i32>* %A
42 %tmp2 = load <2 x i32>* %B
43 %tmp3 = shufflevector <2 x i32> %tmp1, <2 x i32> %tmp2, <2 x i32> <i32 0, i32 2>
44 %tmp4 = shufflevector <2 x i32> %tmp1, <2 x i32> %tmp2, <2 x i32> <i32 1, i32 3>
45 %tmp5 = add <2 x i32> %tmp3, %tmp4
46 ret <2 x i32> %tmp5
47}
48
49define <2 x float> @vtrnf(<2 x float>* %A, <2 x float>* %B) nounwind {
50;CHECK: vtrnf:
51;CHECK: vtrn.32
Bob Wilsonb6c68f92009-08-22 00:13:23 +000052;CHECK-NEXT: vadd.f32
Bob Wilsonc692cb72009-08-21 20:54:19 +000053 %tmp1 = load <2 x float>* %A
54 %tmp2 = load <2 x float>* %B
55 %tmp3 = shufflevector <2 x float> %tmp1, <2 x float> %tmp2, <2 x i32> <i32 0, i32 2>
56 %tmp4 = shufflevector <2 x float> %tmp1, <2 x float> %tmp2, <2 x i32> <i32 1, i32 3>
57 %tmp5 = add <2 x float> %tmp3, %tmp4
58 ret <2 x float> %tmp5
59}
60
61define <16 x i8> @vtrnQi8(<16 x i8>* %A, <16 x i8>* %B) nounwind {
62;CHECK: vtrnQi8:
63;CHECK: vtrn.8
Bob Wilsonb6c68f92009-08-22 00:13:23 +000064;CHECK-NEXT: vadd.i8
Bob Wilsonc692cb72009-08-21 20:54:19 +000065 %tmp1 = load <16 x i8>* %A
66 %tmp2 = load <16 x i8>* %B
67 %tmp3 = shufflevector <16 x i8> %tmp1, <16 x i8> %tmp2, <16 x i32> <i32 0, i32 16, i32 2, i32 18, i32 4, i32 20, i32 6, i32 22, i32 8, i32 24, i32 10, i32 26, i32 12, i32 28, i32 14, i32 30>
68 %tmp4 = shufflevector <16 x i8> %tmp1, <16 x i8> %tmp2, <16 x i32> <i32 1, i32 17, i32 3, i32 19, i32 5, i32 21, i32 7, i32 23, i32 9, i32 25, i32 11, i32 27, i32 13, i32 29, i32 15, i32 31>
69 %tmp5 = add <16 x i8> %tmp3, %tmp4
70 ret <16 x i8> %tmp5
71}
72
73define <8 x i16> @vtrnQi16(<8 x i16>* %A, <8 x i16>* %B) nounwind {
74;CHECK: vtrnQi16:
75;CHECK: vtrn.16
Bob Wilsonb6c68f92009-08-22 00:13:23 +000076;CHECK-NEXT: vadd.i16
Bob Wilsonc692cb72009-08-21 20:54:19 +000077 %tmp1 = load <8 x i16>* %A
78 %tmp2 = load <8 x i16>* %B
79 %tmp3 = shufflevector <8 x i16> %tmp1, <8 x i16> %tmp2, <8 x i32> <i32 0, i32 8, i32 2, i32 10, i32 4, i32 12, i32 6, i32 14>
80 %tmp4 = shufflevector <8 x i16> %tmp1, <8 x i16> %tmp2, <8 x i32> <i32 1, i32 9, i32 3, i32 11, i32 5, i32 13, i32 7, i32 15>
81 %tmp5 = add <8 x i16> %tmp3, %tmp4
82 ret <8 x i16> %tmp5
83}
84
85define <4 x i32> @vtrnQi32(<4 x i32>* %A, <4 x i32>* %B) nounwind {
86;CHECK: vtrnQi32:
87;CHECK: vtrn.32
Bob Wilsonb6c68f92009-08-22 00:13:23 +000088;CHECK-NEXT: vadd.i32
Bob Wilsonc692cb72009-08-21 20:54:19 +000089 %tmp1 = load <4 x i32>* %A
90 %tmp2 = load <4 x i32>* %B
91 %tmp3 = shufflevector <4 x i32> %tmp1, <4 x i32> %tmp2, <4 x i32> <i32 0, i32 4, i32 2, i32 6>
92 %tmp4 = shufflevector <4 x i32> %tmp1, <4 x i32> %tmp2, <4 x i32> <i32 1, i32 5, i32 3, i32 7>
93 %tmp5 = add <4 x i32> %tmp3, %tmp4
94 ret <4 x i32> %tmp5
95}
96
97define <4 x float> @vtrnQf(<4 x float>* %A, <4 x float>* %B) nounwind {
98;CHECK: vtrnQf:
99;CHECK: vtrn.32
Bob Wilsonb6c68f92009-08-22 00:13:23 +0000100;CHECK-NEXT: vadd.f32
Bob Wilsonc692cb72009-08-21 20:54:19 +0000101 %tmp1 = load <4 x float>* %A
102 %tmp2 = load <4 x float>* %B
103 %tmp3 = shufflevector <4 x float> %tmp1, <4 x float> %tmp2, <4 x i32> <i32 0, i32 4, i32 2, i32 6>
104 %tmp4 = shufflevector <4 x float> %tmp1, <4 x float> %tmp2, <4 x i32> <i32 1, i32 5, i32 3, i32 7>
105 %tmp5 = add <4 x float> %tmp3, %tmp4
106 ret <4 x float> %tmp5
107}