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