xref: /aosp_15_r20/external/clang/test/CodeGen/aarch64-neon-extract.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // REQUIRES: aarch64-registered-target
2*67e74705SXin Li // RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon \
3*67e74705SXin Li // RUN:   -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s
4*67e74705SXin Li 
5*67e74705SXin Li // Test new aarch64 intrinsics and types
6*67e74705SXin Li 
7*67e74705SXin Li #include <arm_neon.h>
8*67e74705SXin Li 
9*67e74705SXin Li // CHECK-LABEL: define <8 x i8> @test_vext_s8(<8 x i8> %a, <8 x i8> %b) #0 {
10*67e74705SXin Li // CHECK:   [[VEXT:%.*]] = shufflevector <8 x i8> %a, <8 x i8> %b, <8 x i32> <i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9>
11*67e74705SXin Li // CHECK:   ret <8 x i8> [[VEXT]]
test_vext_s8(int8x8_t a,int8x8_t b)12*67e74705SXin Li int8x8_t test_vext_s8(int8x8_t a, int8x8_t b) {
13*67e74705SXin Li   return vext_s8(a, b, 2);
14*67e74705SXin Li }
15*67e74705SXin Li 
16*67e74705SXin Li // CHECK-LABEL: define <4 x i16> @test_vext_s16(<4 x i16> %a, <4 x i16> %b) #0 {
17*67e74705SXin Li // CHECK:   [[TMP0:%.*]] = bitcast <4 x i16> %a to <8 x i8>
18*67e74705SXin Li // CHECK:   [[TMP1:%.*]] = bitcast <4 x i16> %b to <8 x i8>
19*67e74705SXin Li // CHECK:   [[TMP2:%.*]] = bitcast <8 x i8> [[TMP0]] to <4 x i16>
20*67e74705SXin Li // CHECK:   [[TMP3:%.*]] = bitcast <8 x i8> [[TMP1]] to <4 x i16>
21*67e74705SXin Li // CHECK:   [[VEXT:%.*]] = shufflevector <4 x i16> [[TMP2]], <4 x i16> [[TMP3]], <4 x i32> <i32 3, i32 4, i32 5, i32 6>
22*67e74705SXin Li // CHECK:   ret <4 x i16> [[VEXT]]
test_vext_s16(int16x4_t a,int16x4_t b)23*67e74705SXin Li int16x4_t test_vext_s16(int16x4_t a, int16x4_t b) {
24*67e74705SXin Li   return vext_s16(a, b, 3);
25*67e74705SXin Li }
26*67e74705SXin Li 
27*67e74705SXin Li // CHECK-LABEL: define <2 x i32> @test_vext_s32(<2 x i32> %a, <2 x i32> %b) #0 {
28*67e74705SXin Li // CHECK:   [[TMP0:%.*]] = bitcast <2 x i32> %a to <8 x i8>
29*67e74705SXin Li // CHECK:   [[TMP1:%.*]] = bitcast <2 x i32> %b to <8 x i8>
30*67e74705SXin Li // CHECK:   [[TMP2:%.*]] = bitcast <8 x i8> [[TMP0]] to <2 x i32>
31*67e74705SXin Li // CHECK:   [[TMP3:%.*]] = bitcast <8 x i8> [[TMP1]] to <2 x i32>
32*67e74705SXin Li // CHECK:   [[VEXT:%.*]] = shufflevector <2 x i32> [[TMP2]], <2 x i32> [[TMP3]], <2 x i32> <i32 1, i32 2>
33*67e74705SXin Li // CHECK:   ret <2 x i32> [[VEXT]]
test_vext_s32(int32x2_t a,int32x2_t b)34*67e74705SXin Li int32x2_t test_vext_s32(int32x2_t a, int32x2_t b) {
35*67e74705SXin Li   return vext_s32(a, b, 1);
36*67e74705SXin Li }
37*67e74705SXin Li 
38*67e74705SXin Li // CHECK-LABEL: define <1 x i64> @test_vext_s64(<1 x i64> %a, <1 x i64> %b) #0 {
39*67e74705SXin Li // CHECK:   [[TMP0:%.*]] = bitcast <1 x i64> %a to <8 x i8>
40*67e74705SXin Li // CHECK:   [[TMP1:%.*]] = bitcast <1 x i64> %b to <8 x i8>
41*67e74705SXin Li // CHECK:   [[TMP2:%.*]] = bitcast <8 x i8> [[TMP0]] to <1 x i64>
42*67e74705SXin Li // CHECK:   [[TMP3:%.*]] = bitcast <8 x i8> [[TMP1]] to <1 x i64>
43*67e74705SXin Li // CHECK:   [[VEXT:%.*]] = shufflevector <1 x i64> [[TMP2]], <1 x i64> [[TMP3]], <1 x i32> zeroinitializer
44*67e74705SXin Li // CHECK:   ret <1 x i64> [[VEXT]]
test_vext_s64(int64x1_t a,int64x1_t b)45*67e74705SXin Li int64x1_t test_vext_s64(int64x1_t a, int64x1_t b) {
46*67e74705SXin Li   return vext_s64(a, b, 0);
47*67e74705SXin Li }
48*67e74705SXin Li 
49*67e74705SXin Li // CHECK-LABEL: define <16 x i8> @test_vextq_s8(<16 x i8> %a, <16 x i8> %b) #0 {
50*67e74705SXin Li // CHECK:   [[VEXT:%.*]] = shufflevector <16 x i8> %a, <16 x i8> %b, <16 x i32> <i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17>
51*67e74705SXin Li // CHECK:   ret <16 x i8> [[VEXT]]
test_vextq_s8(int8x16_t a,int8x16_t b)52*67e74705SXin Li int8x16_t test_vextq_s8(int8x16_t a, int8x16_t b) {
53*67e74705SXin Li   return vextq_s8(a, b, 2);
54*67e74705SXin Li }
55*67e74705SXin Li 
56*67e74705SXin Li // CHECK-LABEL: define <8 x i16> @test_vextq_s16(<8 x i16> %a, <8 x i16> %b) #0 {
57*67e74705SXin Li // CHECK:   [[TMP0:%.*]] = bitcast <8 x i16> %a to <16 x i8>
58*67e74705SXin Li // CHECK:   [[TMP1:%.*]] = bitcast <8 x i16> %b to <16 x i8>
59*67e74705SXin Li // CHECK:   [[TMP2:%.*]] = bitcast <16 x i8> [[TMP0]] to <8 x i16>
60*67e74705SXin Li // CHECK:   [[TMP3:%.*]] = bitcast <16 x i8> [[TMP1]] to <8 x i16>
61*67e74705SXin Li // CHECK:   [[VEXT:%.*]] = shufflevector <8 x i16> [[TMP2]], <8 x i16> [[TMP3]], <8 x i32> <i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10>
62*67e74705SXin Li // CHECK:   ret <8 x i16> [[VEXT]]
test_vextq_s16(int16x8_t a,int16x8_t b)63*67e74705SXin Li int16x8_t test_vextq_s16(int16x8_t a, int16x8_t b) {
64*67e74705SXin Li   return vextq_s16(a, b, 3);
65*67e74705SXin Li }
66*67e74705SXin Li 
67*67e74705SXin Li // CHECK-LABEL: define <4 x i32> @test_vextq_s32(<4 x i32> %a, <4 x i32> %b) #0 {
68*67e74705SXin Li // CHECK:   [[TMP0:%.*]] = bitcast <4 x i32> %a to <16 x i8>
69*67e74705SXin Li // CHECK:   [[TMP1:%.*]] = bitcast <4 x i32> %b to <16 x i8>
70*67e74705SXin Li // CHECK:   [[TMP2:%.*]] = bitcast <16 x i8> [[TMP0]] to <4 x i32>
71*67e74705SXin Li // CHECK:   [[TMP3:%.*]] = bitcast <16 x i8> [[TMP1]] to <4 x i32>
72*67e74705SXin Li // CHECK:   [[VEXT:%.*]] = shufflevector <4 x i32> [[TMP2]], <4 x i32> [[TMP3]], <4 x i32> <i32 1, i32 2, i32 3, i32 4>
73*67e74705SXin Li // CHECK:   ret <4 x i32> [[VEXT]]
test_vextq_s32(int32x4_t a,int32x4_t b)74*67e74705SXin Li int32x4_t test_vextq_s32(int32x4_t a, int32x4_t b) {
75*67e74705SXin Li   return vextq_s32(a, b, 1);
76*67e74705SXin Li }
77*67e74705SXin Li 
78*67e74705SXin Li // CHECK-LABEL: define <2 x i64> @test_vextq_s64(<2 x i64> %a, <2 x i64> %b) #0 {
79*67e74705SXin Li // CHECK:   [[TMP0:%.*]] = bitcast <2 x i64> %a to <16 x i8>
80*67e74705SXin Li // CHECK:   [[TMP1:%.*]] = bitcast <2 x i64> %b to <16 x i8>
81*67e74705SXin Li // CHECK:   [[TMP2:%.*]] = bitcast <16 x i8> [[TMP0]] to <2 x i64>
82*67e74705SXin Li // CHECK:   [[TMP3:%.*]] = bitcast <16 x i8> [[TMP1]] to <2 x i64>
83*67e74705SXin Li // CHECK:   [[VEXT:%.*]] = shufflevector <2 x i64> [[TMP2]], <2 x i64> [[TMP3]], <2 x i32> <i32 1, i32 2>
84*67e74705SXin Li // CHECK:   ret <2 x i64> [[VEXT]]
test_vextq_s64(int64x2_t a,int64x2_t b)85*67e74705SXin Li int64x2_t test_vextq_s64(int64x2_t a, int64x2_t b) {
86*67e74705SXin Li   return vextq_s64(a, b, 1);
87*67e74705SXin Li }
88*67e74705SXin Li 
89*67e74705SXin Li // CHECK-LABEL: define <8 x i8> @test_vext_u8(<8 x i8> %a, <8 x i8> %b) #0 {
90*67e74705SXin Li // CHECK:   [[VEXT:%.*]] = shufflevector <8 x i8> %a, <8 x i8> %b, <8 x i32> <i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9>
91*67e74705SXin Li // CHECK:   ret <8 x i8> [[VEXT]]
test_vext_u8(uint8x8_t a,uint8x8_t b)92*67e74705SXin Li uint8x8_t test_vext_u8(uint8x8_t a, uint8x8_t b) {
93*67e74705SXin Li   return vext_u8(a, b, 2);
94*67e74705SXin Li }
95*67e74705SXin Li 
96*67e74705SXin Li // CHECK-LABEL: define <4 x i16> @test_vext_u16(<4 x i16> %a, <4 x i16> %b) #0 {
97*67e74705SXin Li // CHECK:   [[TMP0:%.*]] = bitcast <4 x i16> %a to <8 x i8>
98*67e74705SXin Li // CHECK:   [[TMP1:%.*]] = bitcast <4 x i16> %b to <8 x i8>
99*67e74705SXin Li // CHECK:   [[TMP2:%.*]] = bitcast <8 x i8> [[TMP0]] to <4 x i16>
100*67e74705SXin Li // CHECK:   [[TMP3:%.*]] = bitcast <8 x i8> [[TMP1]] to <4 x i16>
101*67e74705SXin Li // CHECK:   [[VEXT:%.*]] = shufflevector <4 x i16> [[TMP2]], <4 x i16> [[TMP3]], <4 x i32> <i32 3, i32 4, i32 5, i32 6>
102*67e74705SXin Li // CHECK:   ret <4 x i16> [[VEXT]]
test_vext_u16(uint16x4_t a,uint16x4_t b)103*67e74705SXin Li uint16x4_t test_vext_u16(uint16x4_t a, uint16x4_t b) {
104*67e74705SXin Li   return vext_u16(a, b, 3);
105*67e74705SXin Li }
106*67e74705SXin Li 
107*67e74705SXin Li // CHECK-LABEL: define <2 x i32> @test_vext_u32(<2 x i32> %a, <2 x i32> %b) #0 {
108*67e74705SXin Li // CHECK:   [[TMP0:%.*]] = bitcast <2 x i32> %a to <8 x i8>
109*67e74705SXin Li // CHECK:   [[TMP1:%.*]] = bitcast <2 x i32> %b to <8 x i8>
110*67e74705SXin Li // CHECK:   [[TMP2:%.*]] = bitcast <8 x i8> [[TMP0]] to <2 x i32>
111*67e74705SXin Li // CHECK:   [[TMP3:%.*]] = bitcast <8 x i8> [[TMP1]] to <2 x i32>
112*67e74705SXin Li // CHECK:   [[VEXT:%.*]] = shufflevector <2 x i32> [[TMP2]], <2 x i32> [[TMP3]], <2 x i32> <i32 1, i32 2>
113*67e74705SXin Li // CHECK:   ret <2 x i32> [[VEXT]]
test_vext_u32(uint32x2_t a,uint32x2_t b)114*67e74705SXin Li uint32x2_t test_vext_u32(uint32x2_t a, uint32x2_t b) {
115*67e74705SXin Li   return vext_u32(a, b, 1);
116*67e74705SXin Li }
117*67e74705SXin Li 
118*67e74705SXin Li // CHECK-LABEL: define <1 x i64> @test_vext_u64(<1 x i64> %a, <1 x i64> %b) #0 {
119*67e74705SXin Li // CHECK:   [[TMP0:%.*]] = bitcast <1 x i64> %a to <8 x i8>
120*67e74705SXin Li // CHECK:   [[TMP1:%.*]] = bitcast <1 x i64> %b to <8 x i8>
121*67e74705SXin Li // CHECK:   [[TMP2:%.*]] = bitcast <8 x i8> [[TMP0]] to <1 x i64>
122*67e74705SXin Li // CHECK:   [[TMP3:%.*]] = bitcast <8 x i8> [[TMP1]] to <1 x i64>
123*67e74705SXin Li // CHECK:   [[VEXT:%.*]] = shufflevector <1 x i64> [[TMP2]], <1 x i64> [[TMP3]], <1 x i32> zeroinitializer
124*67e74705SXin Li // CHECK:   ret <1 x i64> [[VEXT]]
test_vext_u64(uint64x1_t a,uint64x1_t b)125*67e74705SXin Li uint64x1_t test_vext_u64(uint64x1_t a, uint64x1_t b) {
126*67e74705SXin Li   return vext_u64(a, b, 0);
127*67e74705SXin Li }
128*67e74705SXin Li 
129*67e74705SXin Li // CHECK-LABEL: define <16 x i8> @test_vextq_u8(<16 x i8> %a, <16 x i8> %b) #0 {
130*67e74705SXin Li // CHECK:   [[VEXT:%.*]] = shufflevector <16 x i8> %a, <16 x i8> %b, <16 x i32> <i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17>
131*67e74705SXin Li // CHECK:   ret <16 x i8> [[VEXT]]
test_vextq_u8(uint8x16_t a,uint8x16_t b)132*67e74705SXin Li uint8x16_t test_vextq_u8(uint8x16_t a, uint8x16_t b) {
133*67e74705SXin Li   return vextq_u8(a, b, 2);
134*67e74705SXin Li }
135*67e74705SXin Li 
136*67e74705SXin Li // CHECK-LABEL: define <8 x i16> @test_vextq_u16(<8 x i16> %a, <8 x i16> %b) #0 {
137*67e74705SXin Li // CHECK:   [[TMP0:%.*]] = bitcast <8 x i16> %a to <16 x i8>
138*67e74705SXin Li // CHECK:   [[TMP1:%.*]] = bitcast <8 x i16> %b to <16 x i8>
139*67e74705SXin Li // CHECK:   [[TMP2:%.*]] = bitcast <16 x i8> [[TMP0]] to <8 x i16>
140*67e74705SXin Li // CHECK:   [[TMP3:%.*]] = bitcast <16 x i8> [[TMP1]] to <8 x i16>
141*67e74705SXin Li // CHECK:   [[VEXT:%.*]] = shufflevector <8 x i16> [[TMP2]], <8 x i16> [[TMP3]], <8 x i32> <i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10>
142*67e74705SXin Li // CHECK:   ret <8 x i16> [[VEXT]]
test_vextq_u16(uint16x8_t a,uint16x8_t b)143*67e74705SXin Li uint16x8_t test_vextq_u16(uint16x8_t a, uint16x8_t b) {
144*67e74705SXin Li   return vextq_u16(a, b, 3);
145*67e74705SXin Li }
146*67e74705SXin Li 
147*67e74705SXin Li // CHECK-LABEL: define <4 x i32> @test_vextq_u32(<4 x i32> %a, <4 x i32> %b) #0 {
148*67e74705SXin Li // CHECK:   [[TMP0:%.*]] = bitcast <4 x i32> %a to <16 x i8>
149*67e74705SXin Li // CHECK:   [[TMP1:%.*]] = bitcast <4 x i32> %b to <16 x i8>
150*67e74705SXin Li // CHECK:   [[TMP2:%.*]] = bitcast <16 x i8> [[TMP0]] to <4 x i32>
151*67e74705SXin Li // CHECK:   [[TMP3:%.*]] = bitcast <16 x i8> [[TMP1]] to <4 x i32>
152*67e74705SXin Li // CHECK:   [[VEXT:%.*]] = shufflevector <4 x i32> [[TMP2]], <4 x i32> [[TMP3]], <4 x i32> <i32 1, i32 2, i32 3, i32 4>
153*67e74705SXin Li // CHECK:   ret <4 x i32> [[VEXT]]
test_vextq_u32(uint32x4_t a,uint32x4_t b)154*67e74705SXin Li uint32x4_t test_vextq_u32(uint32x4_t a, uint32x4_t b) {
155*67e74705SXin Li   return vextq_u32(a, b, 1);
156*67e74705SXin Li }
157*67e74705SXin Li 
158*67e74705SXin Li // CHECK-LABEL: define <2 x i64> @test_vextq_u64(<2 x i64> %a, <2 x i64> %b) #0 {
159*67e74705SXin Li // CHECK:   [[TMP0:%.*]] = bitcast <2 x i64> %a to <16 x i8>
160*67e74705SXin Li // CHECK:   [[TMP1:%.*]] = bitcast <2 x i64> %b to <16 x i8>
161*67e74705SXin Li // CHECK:   [[TMP2:%.*]] = bitcast <16 x i8> [[TMP0]] to <2 x i64>
162*67e74705SXin Li // CHECK:   [[TMP3:%.*]] = bitcast <16 x i8> [[TMP1]] to <2 x i64>
163*67e74705SXin Li // CHECK:   [[VEXT:%.*]] = shufflevector <2 x i64> [[TMP2]], <2 x i64> [[TMP3]], <2 x i32> <i32 1, i32 2>
164*67e74705SXin Li // CHECK:   ret <2 x i64> [[VEXT]]
test_vextq_u64(uint64x2_t a,uint64x2_t b)165*67e74705SXin Li uint64x2_t test_vextq_u64(uint64x2_t a, uint64x2_t b) {
166*67e74705SXin Li   return vextq_u64(a, b, 1);
167*67e74705SXin Li }
168*67e74705SXin Li 
169*67e74705SXin Li // CHECK-LABEL: define <2 x float> @test_vext_f32(<2 x float> %a, <2 x float> %b) #0 {
170*67e74705SXin Li // CHECK:   [[TMP0:%.*]] = bitcast <2 x float> %a to <8 x i8>
171*67e74705SXin Li // CHECK:   [[TMP1:%.*]] = bitcast <2 x float> %b to <8 x i8>
172*67e74705SXin Li // CHECK:   [[TMP2:%.*]] = bitcast <8 x i8> [[TMP0]] to <2 x float>
173*67e74705SXin Li // CHECK:   [[TMP3:%.*]] = bitcast <8 x i8> [[TMP1]] to <2 x float>
174*67e74705SXin Li // CHECK:   [[VEXT:%.*]] = shufflevector <2 x float> [[TMP2]], <2 x float> [[TMP3]], <2 x i32> <i32 1, i32 2>
175*67e74705SXin Li // CHECK:   ret <2 x float> [[VEXT]]
test_vext_f32(float32x2_t a,float32x2_t b)176*67e74705SXin Li float32x2_t test_vext_f32(float32x2_t a, float32x2_t b) {
177*67e74705SXin Li   return vext_f32(a, b, 1);
178*67e74705SXin Li }
179*67e74705SXin Li 
180*67e74705SXin Li // CHECK-LABEL: define <1 x double> @test_vext_f64(<1 x double> %a, <1 x double> %b) #0 {
181*67e74705SXin Li // CHECK:   [[TMP0:%.*]] = bitcast <1 x double> %a to <8 x i8>
182*67e74705SXin Li // CHECK:   [[TMP1:%.*]] = bitcast <1 x double> %b to <8 x i8>
183*67e74705SXin Li // CHECK:   [[TMP2:%.*]] = bitcast <8 x i8> [[TMP0]] to <1 x double>
184*67e74705SXin Li // CHECK:   [[TMP3:%.*]] = bitcast <8 x i8> [[TMP1]] to <1 x double>
185*67e74705SXin Li // CHECK:   [[VEXT:%.*]] = shufflevector <1 x double> [[TMP2]], <1 x double> [[TMP3]], <1 x i32> zeroinitializer
186*67e74705SXin Li // CHECK:   ret <1 x double> [[VEXT]]
test_vext_f64(float64x1_t a,float64x1_t b)187*67e74705SXin Li float64x1_t test_vext_f64(float64x1_t a, float64x1_t b) {
188*67e74705SXin Li   return vext_f64(a, b, 0);
189*67e74705SXin Li }
190*67e74705SXin Li 
191*67e74705SXin Li // CHECK-LABEL: define <4 x float> @test_vextq_f32(<4 x float> %a, <4 x float> %b) #0 {
192*67e74705SXin Li // CHECK:   [[TMP0:%.*]] = bitcast <4 x float> %a to <16 x i8>
193*67e74705SXin Li // CHECK:   [[TMP1:%.*]] = bitcast <4 x float> %b to <16 x i8>
194*67e74705SXin Li // CHECK:   [[TMP2:%.*]] = bitcast <16 x i8> [[TMP0]] to <4 x float>
195*67e74705SXin Li // CHECK:   [[TMP3:%.*]] = bitcast <16 x i8> [[TMP1]] to <4 x float>
196*67e74705SXin Li // CHECK:   [[VEXT:%.*]] = shufflevector <4 x float> [[TMP2]], <4 x float> [[TMP3]], <4 x i32> <i32 1, i32 2, i32 3, i32 4>
197*67e74705SXin Li // CHECK:   ret <4 x float> [[VEXT]]
test_vextq_f32(float32x4_t a,float32x4_t b)198*67e74705SXin Li float32x4_t test_vextq_f32(float32x4_t a, float32x4_t b) {
199*67e74705SXin Li   return vextq_f32(a, b, 1);
200*67e74705SXin Li }
201*67e74705SXin Li 
202*67e74705SXin Li // CHECK-LABEL: define <2 x double> @test_vextq_f64(<2 x double> %a, <2 x double> %b) #0 {
203*67e74705SXin Li // CHECK:   [[TMP0:%.*]] = bitcast <2 x double> %a to <16 x i8>
204*67e74705SXin Li // CHECK:   [[TMP1:%.*]] = bitcast <2 x double> %b to <16 x i8>
205*67e74705SXin Li // CHECK:   [[TMP2:%.*]] = bitcast <16 x i8> [[TMP0]] to <2 x double>
206*67e74705SXin Li // CHECK:   [[TMP3:%.*]] = bitcast <16 x i8> [[TMP1]] to <2 x double>
207*67e74705SXin Li // CHECK:   [[VEXT:%.*]] = shufflevector <2 x double> [[TMP2]], <2 x double> [[TMP3]], <2 x i32> <i32 1, i32 2>
208*67e74705SXin Li // CHECK:   ret <2 x double> [[VEXT]]
test_vextq_f64(float64x2_t a,float64x2_t b)209*67e74705SXin Li float64x2_t test_vextq_f64(float64x2_t a, float64x2_t b) {
210*67e74705SXin Li   return vextq_f64(a, b, 1);
211*67e74705SXin Li }
212*67e74705SXin Li 
213*67e74705SXin Li // CHECK-LABEL: define <8 x i8> @test_vext_p8(<8 x i8> %a, <8 x i8> %b) #0 {
214*67e74705SXin Li // CHECK:   [[VEXT:%.*]] = shufflevector <8 x i8> %a, <8 x i8> %b, <8 x i32> <i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9>
215*67e74705SXin Li // CHECK:   ret <8 x i8> [[VEXT]]
test_vext_p8(poly8x8_t a,poly8x8_t b)216*67e74705SXin Li poly8x8_t test_vext_p8(poly8x8_t a, poly8x8_t b) {
217*67e74705SXin Li   return vext_p8(a, b, 2);
218*67e74705SXin Li }
219*67e74705SXin Li 
220*67e74705SXin Li // CHECK-LABEL: define <4 x i16> @test_vext_p16(<4 x i16> %a, <4 x i16> %b) #0 {
221*67e74705SXin Li // CHECK:   [[TMP0:%.*]] = bitcast <4 x i16> %a to <8 x i8>
222*67e74705SXin Li // CHECK:   [[TMP1:%.*]] = bitcast <4 x i16> %b to <8 x i8>
223*67e74705SXin Li // CHECK:   [[TMP2:%.*]] = bitcast <8 x i8> [[TMP0]] to <4 x i16>
224*67e74705SXin Li // CHECK:   [[TMP3:%.*]] = bitcast <8 x i8> [[TMP1]] to <4 x i16>
225*67e74705SXin Li // CHECK:   [[VEXT:%.*]] = shufflevector <4 x i16> [[TMP2]], <4 x i16> [[TMP3]], <4 x i32> <i32 3, i32 4, i32 5, i32 6>
226*67e74705SXin Li // CHECK:   ret <4 x i16> [[VEXT]]
test_vext_p16(poly16x4_t a,poly16x4_t b)227*67e74705SXin Li poly16x4_t test_vext_p16(poly16x4_t a, poly16x4_t b) {
228*67e74705SXin Li   return vext_p16(a, b, 3);
229*67e74705SXin Li }
230*67e74705SXin Li 
231*67e74705SXin Li // CHECK-LABEL: define <16 x i8> @test_vextq_p8(<16 x i8> %a, <16 x i8> %b) #0 {
232*67e74705SXin Li // CHECK:   [[VEXT:%.*]] = shufflevector <16 x i8> %a, <16 x i8> %b, <16 x i32> <i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17>
233*67e74705SXin Li // CHECK:   ret <16 x i8> [[VEXT]]
test_vextq_p8(poly8x16_t a,poly8x16_t b)234*67e74705SXin Li poly8x16_t test_vextq_p8(poly8x16_t a, poly8x16_t b) {
235*67e74705SXin Li   return vextq_p8(a, b, 2);
236*67e74705SXin Li }
237*67e74705SXin Li 
238*67e74705SXin Li // CHECK-LABEL: define <8 x i16> @test_vextq_p16(<8 x i16> %a, <8 x i16> %b) #0 {
239*67e74705SXin Li // CHECK:   [[TMP0:%.*]] = bitcast <8 x i16> %a to <16 x i8>
240*67e74705SXin Li // CHECK:   [[TMP1:%.*]] = bitcast <8 x i16> %b to <16 x i8>
241*67e74705SXin Li // CHECK:   [[TMP2:%.*]] = bitcast <16 x i8> [[TMP0]] to <8 x i16>
242*67e74705SXin Li // CHECK:   [[TMP3:%.*]] = bitcast <16 x i8> [[TMP1]] to <8 x i16>
243*67e74705SXin Li // CHECK:   [[VEXT:%.*]] = shufflevector <8 x i16> [[TMP2]], <8 x i16> [[TMP3]], <8 x i32> <i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10>
244*67e74705SXin Li // CHECK:   ret <8 x i16> [[VEXT]]
test_vextq_p16(poly16x8_t a,poly16x8_t b)245*67e74705SXin Li poly16x8_t test_vextq_p16(poly16x8_t a, poly16x8_t b) {
246*67e74705SXin Li   return vextq_p16(a, b, 3);
247*67e74705SXin Li }
248