1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -triple arm64-apple-ios7 -target-feature +neon -ffreestanding -S -o - -emit-llvm %s | FileCheck %s
2*0a6a1f1dSLionel Sambuc
3*0a6a1f1dSLionel Sambuc // Test ARM64 extract intrinsics
4*0a6a1f1dSLionel Sambuc // can use as back end test by adding a run line with
5*0a6a1f1dSLionel Sambuc // -check-prefix=CHECK-CODEGEN on the FileCheck
6*0a6a1f1dSLionel Sambuc
7*0a6a1f1dSLionel Sambuc #include <arm_neon.h>
8*0a6a1f1dSLionel Sambuc
test_vext_s8()9*0a6a1f1dSLionel Sambuc void test_vext_s8()
10*0a6a1f1dSLionel Sambuc {
11*0a6a1f1dSLionel Sambuc // CHECK: test_vext_s8
12*0a6a1f1dSLionel Sambuc int8x8_t xS8x8;
13*0a6a1f1dSLionel Sambuc xS8x8 = vext_s8(xS8x8, xS8x8, 1);
14*0a6a1f1dSLionel Sambuc // CHECK: shufflevector
15*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: test_vext_s8:
16*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: {{ext.8.*#1}}
17*0a6a1f1dSLionel Sambuc }
18*0a6a1f1dSLionel Sambuc
test_vext_u8()19*0a6a1f1dSLionel Sambuc void test_vext_u8()
20*0a6a1f1dSLionel Sambuc {
21*0a6a1f1dSLionel Sambuc // CHECK: test_vext_u8
22*0a6a1f1dSLionel Sambuc uint8x8_t xU8x8;
23*0a6a1f1dSLionel Sambuc xU8x8 = vext_u8(xU8x8, xU8x8, 2);
24*0a6a1f1dSLionel Sambuc // CHECK: shufflevector
25*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: test_vext_u8:
26*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: {{ext.8.*#2}}
27*0a6a1f1dSLionel Sambuc }
28*0a6a1f1dSLionel Sambuc
test_vext_p8()29*0a6a1f1dSLionel Sambuc void test_vext_p8()
30*0a6a1f1dSLionel Sambuc {
31*0a6a1f1dSLionel Sambuc // CHECK: test_vext_p8
32*0a6a1f1dSLionel Sambuc poly8x8_t xP8x8;
33*0a6a1f1dSLionel Sambuc xP8x8 = vext_p8(xP8x8, xP8x8, 3);
34*0a6a1f1dSLionel Sambuc // CHECK: shufflevector
35*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: test_vext_p8:
36*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: {{ext.8.*#3}}
37*0a6a1f1dSLionel Sambuc }
38*0a6a1f1dSLionel Sambuc
test_vext_s16()39*0a6a1f1dSLionel Sambuc void test_vext_s16()
40*0a6a1f1dSLionel Sambuc {
41*0a6a1f1dSLionel Sambuc // CHECK: test_vext_s16
42*0a6a1f1dSLionel Sambuc int16x4_t xS16x4;
43*0a6a1f1dSLionel Sambuc xS16x4 = vext_s16(xS16x4, xS16x4, 1);
44*0a6a1f1dSLionel Sambuc // CHECK: shufflevector
45*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: test_vext_s16:
46*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: {{ext.8.*#2}}
47*0a6a1f1dSLionel Sambuc }
48*0a6a1f1dSLionel Sambuc
test_vext_u16()49*0a6a1f1dSLionel Sambuc void test_vext_u16()
50*0a6a1f1dSLionel Sambuc {
51*0a6a1f1dSLionel Sambuc // CHECK: test_vext_u16
52*0a6a1f1dSLionel Sambuc uint16x4_t xU16x4;
53*0a6a1f1dSLionel Sambuc xU16x4 = vext_u16(xU16x4, xU16x4, 2);
54*0a6a1f1dSLionel Sambuc // CHECK: shufflevector
55*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: test_vext_u16:
56*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: {{ext.8.*#4}}
57*0a6a1f1dSLionel Sambuc }
58*0a6a1f1dSLionel Sambuc
test_vext_p16()59*0a6a1f1dSLionel Sambuc void test_vext_p16()
60*0a6a1f1dSLionel Sambuc {
61*0a6a1f1dSLionel Sambuc // CHECK: test_vext_p16
62*0a6a1f1dSLionel Sambuc poly16x4_t xP16x4;
63*0a6a1f1dSLionel Sambuc xP16x4 = vext_p16(xP16x4, xP16x4, 3);
64*0a6a1f1dSLionel Sambuc // CHECK: shufflevector
65*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: test_vext_p16:
66*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: {{ext.8.*#6}}
67*0a6a1f1dSLionel Sambuc }
68*0a6a1f1dSLionel Sambuc
test_vext_s32()69*0a6a1f1dSLionel Sambuc void test_vext_s32()
70*0a6a1f1dSLionel Sambuc {
71*0a6a1f1dSLionel Sambuc // CHECK: test_vext_s32
72*0a6a1f1dSLionel Sambuc int32x2_t xS32x2;
73*0a6a1f1dSLionel Sambuc xS32x2 = vext_s32(xS32x2, xS32x2, 1);
74*0a6a1f1dSLionel Sambuc // CHECK: shufflevector
75*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: test_vext_s32:
76*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: {{ext.8.*#4}}
77*0a6a1f1dSLionel Sambuc }
78*0a6a1f1dSLionel Sambuc
test_vext_u32()79*0a6a1f1dSLionel Sambuc void test_vext_u32()
80*0a6a1f1dSLionel Sambuc {
81*0a6a1f1dSLionel Sambuc // CHECK: test_vext_u32
82*0a6a1f1dSLionel Sambuc uint32x2_t xU32x2;
83*0a6a1f1dSLionel Sambuc xU32x2 = vext_u32(xU32x2, xU32x2, 1);
84*0a6a1f1dSLionel Sambuc // CHECK: shufflevector
85*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: test_vext_u32:
86*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: {{ext.8.*#4}}
87*0a6a1f1dSLionel Sambuc }
88*0a6a1f1dSLionel Sambuc
test_vext_f32()89*0a6a1f1dSLionel Sambuc void test_vext_f32()
90*0a6a1f1dSLionel Sambuc {
91*0a6a1f1dSLionel Sambuc // CHECK: test_vext_f32
92*0a6a1f1dSLionel Sambuc float32x2_t xF32x2;
93*0a6a1f1dSLionel Sambuc xF32x2 = vext_f32(xF32x2, xF32x2, 1);
94*0a6a1f1dSLionel Sambuc // CHECK: shufflevector
95*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: test_vext_f32:
96*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: {{ext.8.*#4}}
97*0a6a1f1dSLionel Sambuc }
98*0a6a1f1dSLionel Sambuc
test_vext_s64()99*0a6a1f1dSLionel Sambuc void test_vext_s64()
100*0a6a1f1dSLionel Sambuc {
101*0a6a1f1dSLionel Sambuc // CHECK: test_vext_s64
102*0a6a1f1dSLionel Sambuc int64x1_t xS64x1;
103*0a6a1f1dSLionel Sambuc // FIXME don't use 1 as index or check for now, clang has a bug?
104*0a6a1f1dSLionel Sambuc xS64x1 = vext_s64(xS64x1, xS64x1, /*1*/0);
105*0a6a1f1dSLionel Sambuc // CHECK: shufflevector
106*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: test_vext_s64:
107*0a6a1f1dSLionel Sambuc // CHECK_FIXME: {{ext.8.*#0}}
108*0a6a1f1dSLionel Sambuc }
109*0a6a1f1dSLionel Sambuc
test_vext_u64()110*0a6a1f1dSLionel Sambuc void test_vext_u64()
111*0a6a1f1dSLionel Sambuc {
112*0a6a1f1dSLionel Sambuc // CHECK: test_vext_u64
113*0a6a1f1dSLionel Sambuc uint64x1_t xU64x1;
114*0a6a1f1dSLionel Sambuc // FIXME don't use 1 as index or check for now, clang has a bug?
115*0a6a1f1dSLionel Sambuc xU64x1 = vext_u64(xU64x1, xU64x1, /*1*/0);
116*0a6a1f1dSLionel Sambuc // CHECK: shufflevector
117*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: test_vext_u64:
118*0a6a1f1dSLionel Sambuc // CHECK_FIXME: {{ext.8.*#0}}
119*0a6a1f1dSLionel Sambuc }
120*0a6a1f1dSLionel Sambuc
test_vextq_s8()121*0a6a1f1dSLionel Sambuc void test_vextq_s8()
122*0a6a1f1dSLionel Sambuc {
123*0a6a1f1dSLionel Sambuc // CHECK: test_vextq_s8
124*0a6a1f1dSLionel Sambuc int8x16_t xS8x16;
125*0a6a1f1dSLionel Sambuc xS8x16 = vextq_s8(xS8x16, xS8x16, 4);
126*0a6a1f1dSLionel Sambuc // CHECK: shufflevector
127*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: test_vextq_s8:
128*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: {{ext.16.*#4}}
129*0a6a1f1dSLionel Sambuc }
130*0a6a1f1dSLionel Sambuc
test_vextq_u8()131*0a6a1f1dSLionel Sambuc void test_vextq_u8()
132*0a6a1f1dSLionel Sambuc {
133*0a6a1f1dSLionel Sambuc // CHECK: test_vextq_u8
134*0a6a1f1dSLionel Sambuc uint8x16_t xU8x16;
135*0a6a1f1dSLionel Sambuc xU8x16 = vextq_u8(xU8x16, xU8x16, 5);
136*0a6a1f1dSLionel Sambuc // CHECK: shufflevector
137*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: test_vextq_u8:
138*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: {{ext.16.*#5}}
139*0a6a1f1dSLionel Sambuc }
140*0a6a1f1dSLionel Sambuc
test_vextq_p8()141*0a6a1f1dSLionel Sambuc void test_vextq_p8()
142*0a6a1f1dSLionel Sambuc {
143*0a6a1f1dSLionel Sambuc // CHECK: test_vextq_p8
144*0a6a1f1dSLionel Sambuc poly8x16_t xP8x16;
145*0a6a1f1dSLionel Sambuc xP8x16 = vextq_p8(xP8x16, xP8x16, 6);
146*0a6a1f1dSLionel Sambuc // CHECK: shufflevector
147*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: test_vextq_p8:
148*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: {{ext.16.*#6}}
149*0a6a1f1dSLionel Sambuc }
150*0a6a1f1dSLionel Sambuc
test_vextq_s16()151*0a6a1f1dSLionel Sambuc void test_vextq_s16()
152*0a6a1f1dSLionel Sambuc {
153*0a6a1f1dSLionel Sambuc // CHECK: test_vextq_s16
154*0a6a1f1dSLionel Sambuc int16x8_t xS16x8;
155*0a6a1f1dSLionel Sambuc xS16x8 = vextq_s16(xS16x8, xS16x8, 7);
156*0a6a1f1dSLionel Sambuc // CHECK: shufflevector
157*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: test_vextq_s16:
158*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: {{ext.16.*#14}}
159*0a6a1f1dSLionel Sambuc }
160*0a6a1f1dSLionel Sambuc
test_vextq_u16()161*0a6a1f1dSLionel Sambuc void test_vextq_u16()
162*0a6a1f1dSLionel Sambuc {
163*0a6a1f1dSLionel Sambuc // CHECK: test_vextq_u16
164*0a6a1f1dSLionel Sambuc uint16x8_t xU16x8;
165*0a6a1f1dSLionel Sambuc xU16x8 = vextq_u16(xU16x8, xU16x8, 4);
166*0a6a1f1dSLionel Sambuc // CHECK: shufflevector
167*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: test_vextq_u16:
168*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: {{ext.16.*#8}}
169*0a6a1f1dSLionel Sambuc }
170*0a6a1f1dSLionel Sambuc
test_vextq_p16()171*0a6a1f1dSLionel Sambuc void test_vextq_p16()
172*0a6a1f1dSLionel Sambuc {
173*0a6a1f1dSLionel Sambuc // CHECK: test_vextq_p16
174*0a6a1f1dSLionel Sambuc poly16x8_t xP16x8;
175*0a6a1f1dSLionel Sambuc xP16x8 = vextq_p16(xP16x8, xP16x8, 5);
176*0a6a1f1dSLionel Sambuc // CHECK: shufflevector
177*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: test_vextq_p16:
178*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: {{ext.16.*#10}}
179*0a6a1f1dSLionel Sambuc }
180*0a6a1f1dSLionel Sambuc
test_vextq_s32()181*0a6a1f1dSLionel Sambuc void test_vextq_s32()
182*0a6a1f1dSLionel Sambuc {
183*0a6a1f1dSLionel Sambuc // CHECK: test_vextq_s32
184*0a6a1f1dSLionel Sambuc int32x4_t xS32x4;
185*0a6a1f1dSLionel Sambuc xS32x4 = vextq_s32(xS32x4, xS32x4, 1);
186*0a6a1f1dSLionel Sambuc // CHECK: shufflevector
187*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: test_vextq_s32:
188*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: {{ext.16.*#4}}
189*0a6a1f1dSLionel Sambuc }
190*0a6a1f1dSLionel Sambuc
test_vextq_u32()191*0a6a1f1dSLionel Sambuc void test_vextq_u32()
192*0a6a1f1dSLionel Sambuc {
193*0a6a1f1dSLionel Sambuc // CHECK: test_vextq_u32
194*0a6a1f1dSLionel Sambuc uint32x4_t xU32x4;
195*0a6a1f1dSLionel Sambuc xU32x4 = vextq_u32(xU32x4, xU32x4, 2);
196*0a6a1f1dSLionel Sambuc // CHECK: shufflevector
197*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: test_vextq_u32:
198*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: {{ext.16.*#8}}
199*0a6a1f1dSLionel Sambuc }
200*0a6a1f1dSLionel Sambuc
test_vextq_f32()201*0a6a1f1dSLionel Sambuc void test_vextq_f32()
202*0a6a1f1dSLionel Sambuc {
203*0a6a1f1dSLionel Sambuc // CHECK: test_vextq_f32
204*0a6a1f1dSLionel Sambuc float32x4_t xF32x4;
205*0a6a1f1dSLionel Sambuc xF32x4 = vextq_f32(xF32x4, xF32x4, 3);
206*0a6a1f1dSLionel Sambuc // CHECK: shufflevector
207*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: test_vextq_f32:
208*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: {{ext.16.*#12}}
209*0a6a1f1dSLionel Sambuc }
210*0a6a1f1dSLionel Sambuc
test_vextq_s64()211*0a6a1f1dSLionel Sambuc void test_vextq_s64()
212*0a6a1f1dSLionel Sambuc {
213*0a6a1f1dSLionel Sambuc // CHECK: test_vextq_s64
214*0a6a1f1dSLionel Sambuc int64x2_t xS64x2;
215*0a6a1f1dSLionel Sambuc xS64x2 = vextq_s64(xS64x2, xS64x2, 1);
216*0a6a1f1dSLionel Sambuc // CHECK: shufflevector
217*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: test_vextq_s64:
218*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: {{ext.16.*#8}}
219*0a6a1f1dSLionel Sambuc }
220*0a6a1f1dSLionel Sambuc
test_vextq_u64()221*0a6a1f1dSLionel Sambuc void test_vextq_u64()
222*0a6a1f1dSLionel Sambuc {
223*0a6a1f1dSLionel Sambuc // CHECK: test_vextq_u64
224*0a6a1f1dSLionel Sambuc uint64x2_t xU64x2;
225*0a6a1f1dSLionel Sambuc xU64x2 = vextq_u64(xU64x2, xU64x2, 1);
226*0a6a1f1dSLionel Sambuc // CHECK: shufflevector
227*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: test_vextq_u64:
228*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: {{ext.16.*#8}}
229*0a6a1f1dSLionel Sambuc }
230*0a6a1f1dSLionel Sambuc
test_vextq_f64()231*0a6a1f1dSLionel Sambuc void test_vextq_f64()
232*0a6a1f1dSLionel Sambuc {
233*0a6a1f1dSLionel Sambuc // CHECK: test_vextq_f64
234*0a6a1f1dSLionel Sambuc float64x2_t xF64x2;
235*0a6a1f1dSLionel Sambuc xF64x2 = vextq_f64(xF64x2, xF64x2, 1);
236*0a6a1f1dSLionel Sambuc // CHECK: shufflevector
237*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: test_vextq_u64:
238*0a6a1f1dSLionel Sambuc // CHECK-CODEGEN: {{ext.16.*#8}}
239*0a6a1f1dSLionel Sambuc }
240