1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // RUN: %clang_cc1 -triple thumbv8.1m.main-none-none-eabi -target-feature +mve.fp -mfloat-abi hard -fallow-half-arguments-and-returns -O0 -disable-O0-optnone -S -emit-llvm -o - %s | opt -S -mem2reg -sroa -early-cse | FileCheck %s
3 // RUN: %clang_cc1 -triple thumbv8.1m.main-none-none-eabi -target-feature +mve.fp -mfloat-abi hard -fallow-half-arguments-and-returns -O0 -disable-O0-optnone -DPOLYMORPHIC -S -emit-llvm -o - %s | opt -S -mem2reg -sroa -early-cse | FileCheck %s
4
5 #include <arm_mve.h>
6
7 // CHECK-LABEL: @test_vgetq_lane_f16(
8 // CHECK-NEXT: entry:
9 // CHECK-NEXT: [[TMP0:%.*]] = extractelement <8 x half> [[A:%.*]], i32 2
10 // CHECK-NEXT: ret half [[TMP0]]
11 //
test_vgetq_lane_f16(float16x8_t a)12 float16_t test_vgetq_lane_f16(float16x8_t a)
13 {
14 #ifdef POLYMORPHIC
15 return vgetq_lane(a, 2);
16 #else /* POLYMORPHIC */
17 return vgetq_lane_f16(a, 2);
18 #endif /* POLYMORPHIC */
19 }
20
21 // CHECK-LABEL: @test_vgetq_lane_f32(
22 // CHECK-NEXT: entry:
23 // CHECK-NEXT: [[TMP0:%.*]] = extractelement <4 x float> [[A:%.*]], i32 3
24 // CHECK-NEXT: ret float [[TMP0]]
25 //
test_vgetq_lane_f32(float32x4_t a)26 float32_t test_vgetq_lane_f32(float32x4_t a)
27 {
28 #ifdef POLYMORPHIC
29 return vgetq_lane(a, 3);
30 #else /* POLYMORPHIC */
31 return vgetq_lane_f32(a, 3);
32 #endif /* POLYMORPHIC */
33 }
34
35 // CHECK-LABEL: @test_vgetq_lane_s16(
36 // CHECK-NEXT: entry:
37 // CHECK-NEXT: [[TMP0:%.*]] = extractelement <8 x i16> [[A:%.*]], i32 4
38 // CHECK-NEXT: ret i16 [[TMP0]]
39 //
test_vgetq_lane_s16(int16x8_t a)40 int16_t test_vgetq_lane_s16(int16x8_t a)
41 {
42 #ifdef POLYMORPHIC
43 return vgetq_lane(a, 4);
44 #else /* POLYMORPHIC */
45 return vgetq_lane_s16(a, 4);
46 #endif /* POLYMORPHIC */
47 }
48
49 // CHECK-LABEL: @test_vgetq_lane_s32(
50 // CHECK-NEXT: entry:
51 // CHECK-NEXT: [[TMP0:%.*]] = extractelement <4 x i32> [[A:%.*]], i32 0
52 // CHECK-NEXT: ret i32 [[TMP0]]
53 //
test_vgetq_lane_s32(int32x4_t a)54 int32_t test_vgetq_lane_s32(int32x4_t a)
55 {
56 #ifdef POLYMORPHIC
57 return vgetq_lane(a, 0);
58 #else /* POLYMORPHIC */
59 return vgetq_lane_s32(a, 0);
60 #endif /* POLYMORPHIC */
61 }
62
63 // CHECK-LABEL: @test_vgetq_lane_s64(
64 // CHECK-NEXT: entry:
65 // CHECK-NEXT: [[TMP0:%.*]] = extractelement <2 x i64> [[A:%.*]], i32 0
66 // CHECK-NEXT: ret i64 [[TMP0]]
67 //
test_vgetq_lane_s64(int64x2_t a)68 int64_t test_vgetq_lane_s64(int64x2_t a)
69 {
70 #ifdef POLYMORPHIC
71 return vgetq_lane(a, 0);
72 #else /* POLYMORPHIC */
73 return vgetq_lane_s64(a, 0);
74 #endif /* POLYMORPHIC */
75 }
76
77 // CHECK-LABEL: @test_vgetq_lane_s8(
78 // CHECK-NEXT: entry:
79 // CHECK-NEXT: [[TMP0:%.*]] = extractelement <16 x i8> [[A:%.*]], i32 10
80 // CHECK-NEXT: ret i8 [[TMP0]]
81 //
test_vgetq_lane_s8(int8x16_t a)82 int8_t test_vgetq_lane_s8(int8x16_t a)
83 {
84 #ifdef POLYMORPHIC
85 return vgetq_lane(a, 10);
86 #else /* POLYMORPHIC */
87 return vgetq_lane_s8(a, 10);
88 #endif /* POLYMORPHIC */
89 }
90
91 // CHECK-LABEL: @test_vgetq_lane_u16(
92 // CHECK-NEXT: entry:
93 // CHECK-NEXT: [[TMP0:%.*]] = extractelement <8 x i16> [[A:%.*]], i32 3
94 // CHECK-NEXT: ret i16 [[TMP0]]
95 //
test_vgetq_lane_u16(uint16x8_t a)96 uint16_t test_vgetq_lane_u16(uint16x8_t a)
97 {
98 #ifdef POLYMORPHIC
99 return vgetq_lane(a, 3);
100 #else /* POLYMORPHIC */
101 return vgetq_lane_u16(a, 3);
102 #endif /* POLYMORPHIC */
103 }
104
105 // CHECK-LABEL: @test_vgetq_lane_u32(
106 // CHECK-NEXT: entry:
107 // CHECK-NEXT: [[TMP0:%.*]] = extractelement <4 x i32> [[A:%.*]], i32 3
108 // CHECK-NEXT: ret i32 [[TMP0]]
109 //
test_vgetq_lane_u32(uint32x4_t a)110 uint32_t test_vgetq_lane_u32(uint32x4_t a)
111 {
112 #ifdef POLYMORPHIC
113 return vgetq_lane(a, 3);
114 #else /* POLYMORPHIC */
115 return vgetq_lane_u32(a, 3);
116 #endif /* POLYMORPHIC */
117 }
118
119 // CHECK-LABEL: @test_vgetq_lane_u64(
120 // CHECK-NEXT: entry:
121 // CHECK-NEXT: [[TMP0:%.*]] = extractelement <2 x i64> [[A:%.*]], i32 1
122 // CHECK-NEXT: ret i64 [[TMP0]]
123 //
test_vgetq_lane_u64(uint64x2_t a)124 uint64_t test_vgetq_lane_u64(uint64x2_t a)
125 {
126 #ifdef POLYMORPHIC
127 return vgetq_lane(a, 1);
128 #else /* POLYMORPHIC */
129 return vgetq_lane_u64(a, 1);
130 #endif /* POLYMORPHIC */
131 }
132
133 // CHECK-LABEL: @test_vgetq_lane_u8(
134 // CHECK-NEXT: entry:
135 // CHECK-NEXT: [[TMP0:%.*]] = extractelement <16 x i8> [[A:%.*]], i32 1
136 // CHECK-NEXT: ret i8 [[TMP0]]
137 //
test_vgetq_lane_u8(uint8x16_t a)138 uint8_t test_vgetq_lane_u8(uint8x16_t a)
139 {
140 #ifdef POLYMORPHIC
141 return vgetq_lane(a, 1);
142 #else /* POLYMORPHIC */
143 return vgetq_lane_u8(a, 1);
144 #endif /* POLYMORPHIC */
145 }
146
147 // CHECK-LABEL: @test_vsetq_lane_f16(
148 // CHECK-NEXT: entry:
149 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <8 x half> [[B:%.*]], half [[A:%.*]], i32 4
150 // CHECK-NEXT: ret <8 x half> [[TMP0]]
151 //
test_vsetq_lane_f16(float16_t a,float16x8_t b)152 float16x8_t test_vsetq_lane_f16(float16_t a, float16x8_t b)
153 {
154 #ifdef POLYMORPHIC
155 return vsetq_lane(a, b, 4);
156 #else /* POLYMORPHIC */
157 return vsetq_lane_f16(a, b, 4);
158 #endif /* POLYMORPHIC */
159 }
160
161 // CHECK-LABEL: @test_vsetq_lane_f32(
162 // CHECK-NEXT: entry:
163 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <4 x float> [[B:%.*]], float [[A:%.*]], i32 2
164 // CHECK-NEXT: ret <4 x float> [[TMP0]]
165 //
test_vsetq_lane_f32(float32_t a,float32x4_t b)166 float32x4_t test_vsetq_lane_f32(float32_t a, float32x4_t b)
167 {
168 #ifdef POLYMORPHIC
169 return vsetq_lane(a, b, 2);
170 #else /* POLYMORPHIC */
171 return vsetq_lane_f32(a, b, 2);
172 #endif /* POLYMORPHIC */
173 }
174
175 // CHECK-LABEL: @test_vsetq_lane_s8(
176 // CHECK-NEXT: entry:
177 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <16 x i8> [[B:%.*]], i8 [[A:%.*]], i32 12
178 // CHECK-NEXT: ret <16 x i8> [[TMP0]]
179 //
test_vsetq_lane_s8(int8_t a,int8x16_t b)180 int8x16_t test_vsetq_lane_s8(int8_t a, int8x16_t b)
181 {
182 #ifdef POLYMORPHIC
183 return vsetq_lane(a, b, 12);
184 #else /* POLYMORPHIC */
185 return vsetq_lane_s8(a, b, 12);
186 #endif /* POLYMORPHIC */
187 }
188
189 // CHECK-LABEL: @test_vsetq_lane_s16(
190 // CHECK-NEXT: entry:
191 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <8 x i16> [[B:%.*]], i16 [[A:%.*]], i32 6
192 // CHECK-NEXT: ret <8 x i16> [[TMP0]]
193 //
test_vsetq_lane_s16(int16_t a,int16x8_t b)194 int16x8_t test_vsetq_lane_s16(int16_t a, int16x8_t b)
195 {
196 #ifdef POLYMORPHIC
197 return vsetq_lane(a, b, 6);
198 #else /* POLYMORPHIC */
199 return vsetq_lane_s16(a, b, 6);
200 #endif /* POLYMORPHIC */
201 }
202
203 // CHECK-LABEL: @test_vsetq_lane_s32(
204 // CHECK-NEXT: entry:
205 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <4 x i32> [[B:%.*]], i32 [[A:%.*]], i32 2
206 // CHECK-NEXT: ret <4 x i32> [[TMP0]]
207 //
test_vsetq_lane_s32(int32_t a,int32x4_t b)208 int32x4_t test_vsetq_lane_s32(int32_t a, int32x4_t b)
209 {
210 #ifdef POLYMORPHIC
211 return vsetq_lane(a, b, 2);
212 #else /* POLYMORPHIC */
213 return vsetq_lane_s32(a, b, 2);
214 #endif /* POLYMORPHIC */
215 }
216
217 // CHECK-LABEL: @test_vsetq_lane_s64(
218 // CHECK-NEXT: entry:
219 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x i64> [[B:%.*]], i64 [[A:%.*]], i32 0
220 // CHECK-NEXT: ret <2 x i64> [[TMP0]]
221 //
test_vsetq_lane_s64(int64_t a,int64x2_t b)222 int64x2_t test_vsetq_lane_s64(int64_t a, int64x2_t b)
223 {
224 #ifdef POLYMORPHIC
225 return vsetq_lane(a, b, 0);
226 #else /* POLYMORPHIC */
227 return vsetq_lane_s64(a, b, 0);
228 #endif /* POLYMORPHIC */
229 }
230
231 // CHECK-LABEL: @test_vsetq_lane_u8(
232 // CHECK-NEXT: entry:
233 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <16 x i8> [[B:%.*]], i8 [[A:%.*]], i32 2
234 // CHECK-NEXT: ret <16 x i8> [[TMP0]]
235 //
test_vsetq_lane_u8(uint8_t a,uint8x16_t b)236 uint8x16_t test_vsetq_lane_u8(uint8_t a, uint8x16_t b)
237 {
238 #ifdef POLYMORPHIC
239 return vsetq_lane(a, b, 2);
240 #else /* POLYMORPHIC */
241 return vsetq_lane_u8(a, b, 2);
242 #endif /* POLYMORPHIC */
243 }
244
245 // CHECK-LABEL: @test_vsetq_lane_u16(
246 // CHECK-NEXT: entry:
247 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <8 x i16> [[B:%.*]], i16 [[A:%.*]], i32 7
248 // CHECK-NEXT: ret <8 x i16> [[TMP0]]
249 //
test_vsetq_lane_u16(uint16_t a,uint16x8_t b)250 uint16x8_t test_vsetq_lane_u16(uint16_t a, uint16x8_t b)
251 {
252 #ifdef POLYMORPHIC
253 return vsetq_lane(a, b, 7);
254 #else /* POLYMORPHIC */
255 return vsetq_lane_u16(a, b, 7);
256 #endif /* POLYMORPHIC */
257 }
258
259 // CHECK-LABEL: @test_vsetq_lane_u32(
260 // CHECK-NEXT: entry:
261 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <4 x i32> [[B:%.*]], i32 [[A:%.*]], i32 0
262 // CHECK-NEXT: ret <4 x i32> [[TMP0]]
263 //
test_vsetq_lane_u32(uint32_t a,uint32x4_t b)264 uint32x4_t test_vsetq_lane_u32(uint32_t a, uint32x4_t b)
265 {
266 #ifdef POLYMORPHIC
267 return vsetq_lane(a, b, 0);
268 #else /* POLYMORPHIC */
269 return vsetq_lane_u32(a, b, 0);
270 #endif /* POLYMORPHIC */
271 }
272
273 // CHECK-LABEL: @test_vsetq_lane_u64(
274 // CHECK-NEXT: entry:
275 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x i64> [[B:%.*]], i64 [[A:%.*]], i32 1
276 // CHECK-NEXT: ret <2 x i64> [[TMP0]]
277 //
test_vsetq_lane_u64(uint64_t a,uint64x2_t b)278 uint64x2_t test_vsetq_lane_u64(uint64_t a, uint64x2_t b)
279 {
280 #ifdef POLYMORPHIC
281 return vsetq_lane(a, b, 1);
282 #else /* POLYMORPHIC */
283 return vsetq_lane_u64(a, b, 1);
284 #endif /* POLYMORPHIC */
285 }
286