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