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_vcreateq_f16(
8 // CHECK-NEXT: entry:
9 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x i64> undef, i64 [[A:%.*]], i64 0
10 // CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x i64> [[TMP0]], i64 [[B:%.*]], i64 1
11 // CHECK-NEXT: [[TMP2:%.*]] = bitcast <2 x i64> [[TMP1]] to <8 x half>
12 // CHECK-NEXT: ret <8 x half> [[TMP2]]
13 //
test_vcreateq_f16(uint64_t a,uint64_t b)14 float16x8_t test_vcreateq_f16(uint64_t a, uint64_t b)
15 {
16 return vcreateq_f16(a, b);
17 }
18
19 // CHECK-LABEL: @test_vcreateq_f32(
20 // CHECK-NEXT: entry:
21 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x i64> undef, i64 [[A:%.*]], i64 0
22 // CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x i64> [[TMP0]], i64 [[B:%.*]], i64 1
23 // CHECK-NEXT: [[TMP2:%.*]] = bitcast <2 x i64> [[TMP1]] to <4 x float>
24 // CHECK-NEXT: ret <4 x float> [[TMP2]]
25 //
test_vcreateq_f32(uint64_t a,uint64_t b)26 float32x4_t test_vcreateq_f32(uint64_t a, uint64_t b)
27 {
28 return vcreateq_f32(a, b);
29 }
30
31 // CHECK-LABEL: @test_vcreateq_s16(
32 // CHECK-NEXT: entry:
33 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x i64> undef, i64 [[A:%.*]], i64 0
34 // CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x i64> [[TMP0]], i64 [[B:%.*]], i64 1
35 // CHECK-NEXT: [[TMP2:%.*]] = bitcast <2 x i64> [[TMP1]] to <8 x i16>
36 // CHECK-NEXT: ret <8 x i16> [[TMP2]]
37 //
test_vcreateq_s16(uint64_t a,uint64_t b)38 int16x8_t test_vcreateq_s16(uint64_t a, uint64_t b)
39 {
40 return vcreateq_s16(a, b);
41 }
42
43 // CHECK-LABEL: @test_vcreateq_s32(
44 // CHECK-NEXT: entry:
45 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x i64> undef, i64 [[A:%.*]], i64 0
46 // CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x i64> [[TMP0]], i64 [[B:%.*]], i64 1
47 // CHECK-NEXT: [[TMP2:%.*]] = bitcast <2 x i64> [[TMP1]] to <4 x i32>
48 // CHECK-NEXT: ret <4 x i32> [[TMP2]]
49 //
test_vcreateq_s32(uint64_t a,uint64_t b)50 int32x4_t test_vcreateq_s32(uint64_t a, uint64_t b)
51 {
52 return vcreateq_s32(a, b);
53 }
54
55 // CHECK-LABEL: @test_vcreateq_s64(
56 // CHECK-NEXT: entry:
57 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x i64> undef, i64 [[A:%.*]], i64 0
58 // CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x i64> [[TMP0]], i64 [[B:%.*]], i64 1
59 // CHECK-NEXT: ret <2 x i64> [[TMP1]]
60 //
test_vcreateq_s64(uint64_t a,uint64_t b)61 int64x2_t test_vcreateq_s64(uint64_t a, uint64_t b)
62 {
63 return vcreateq_s64(a, b);
64 }
65
66 // CHECK-LABEL: @test_vcreateq_s8(
67 // CHECK-NEXT: entry:
68 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x i64> undef, i64 [[A:%.*]], i64 0
69 // CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x i64> [[TMP0]], i64 [[B:%.*]], i64 1
70 // CHECK-NEXT: [[TMP2:%.*]] = bitcast <2 x i64> [[TMP1]] to <16 x i8>
71 // CHECK-NEXT: ret <16 x i8> [[TMP2]]
72 //
test_vcreateq_s8(uint64_t a,uint64_t b)73 int8x16_t test_vcreateq_s8(uint64_t a, uint64_t b)
74 {
75 return vcreateq_s8(a, b);
76 }
77
78 // CHECK-LABEL: @test_vcreateq_u16(
79 // CHECK-NEXT: entry:
80 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x i64> undef, i64 [[A:%.*]], i64 0
81 // CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x i64> [[TMP0]], i64 [[B:%.*]], i64 1
82 // CHECK-NEXT: [[TMP2:%.*]] = bitcast <2 x i64> [[TMP1]] to <8 x i16>
83 // CHECK-NEXT: ret <8 x i16> [[TMP2]]
84 //
test_vcreateq_u16(uint64_t a,uint64_t b)85 uint16x8_t test_vcreateq_u16(uint64_t a, uint64_t b)
86 {
87 return vcreateq_u16(a, b);
88 }
89
90 // CHECK-LABEL: @test_vcreateq_u32(
91 // CHECK-NEXT: entry:
92 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x i64> undef, i64 [[A:%.*]], i64 0
93 // CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x i64> [[TMP0]], i64 [[B:%.*]], i64 1
94 // CHECK-NEXT: [[TMP2:%.*]] = bitcast <2 x i64> [[TMP1]] to <4 x i32>
95 // CHECK-NEXT: ret <4 x i32> [[TMP2]]
96 //
test_vcreateq_u32(uint64_t a,uint64_t b)97 uint32x4_t test_vcreateq_u32(uint64_t a, uint64_t b)
98 {
99 return vcreateq_u32(a, b);
100 }
101
102 // CHECK-LABEL: @test_vcreateq_u64(
103 // CHECK-NEXT: entry:
104 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x i64> undef, i64 [[A:%.*]], i64 0
105 // CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x i64> [[TMP0]], i64 [[B:%.*]], i64 1
106 // CHECK-NEXT: ret <2 x i64> [[TMP1]]
107 //
test_vcreateq_u64(uint64_t a,uint64_t b)108 uint64x2_t test_vcreateq_u64(uint64_t a, uint64_t b)
109 {
110 return vcreateq_u64(a, b);
111 }
112
113 // CHECK-LABEL: @test_vcreateq_u8(
114 // CHECK-NEXT: entry:
115 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x i64> undef, i64 [[A:%.*]], i64 0
116 // CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x i64> [[TMP0]], i64 [[B:%.*]], i64 1
117 // CHECK-NEXT: [[TMP2:%.*]] = bitcast <2 x i64> [[TMP1]] to <16 x i8>
118 // CHECK-NEXT: ret <16 x i8> [[TMP2]]
119 //
test_vcreateq_u8(uint64_t a,uint64_t b)120 uint8x16_t test_vcreateq_u8(uint64_t a, uint64_t b)
121 {
122 return vcreateq_u8(a, b);
123 }
124
125 // CHECK-LABEL: @test_vuninitializedq_polymorphic_f16(
126 // CHECK-NEXT: entry:
127 // CHECK-NEXT: ret <8 x half> undef
128 //
test_vuninitializedq_polymorphic_f16(float16x8_t (* funcptr)(void))129 float16x8_t test_vuninitializedq_polymorphic_f16(float16x8_t (*funcptr)(void))
130 {
131 return vuninitializedq(funcptr());
132 }
133
134 // CHECK-LABEL: @test_vuninitializedq_polymorphic_f32(
135 // CHECK-NEXT: entry:
136 // CHECK-NEXT: ret <4 x float> undef
137 //
test_vuninitializedq_polymorphic_f32(float32x4_t (* funcptr)(void))138 float32x4_t test_vuninitializedq_polymorphic_f32(float32x4_t (*funcptr)(void))
139 {
140 return vuninitializedq(funcptr());
141 }
142
143 // CHECK-LABEL: @test_vuninitializedq_polymorphic_s8(
144 // CHECK-NEXT: entry:
145 // CHECK-NEXT: ret <16 x i8> undef
146 //
test_vuninitializedq_polymorphic_s8(int8x16_t (* funcptr)(void))147 int8x16_t test_vuninitializedq_polymorphic_s8(int8x16_t (*funcptr)(void))
148 {
149 return vuninitializedq(funcptr());
150 }
151
152 // CHECK-LABEL: @test_vuninitializedq_polymorphic_s16(
153 // CHECK-NEXT: entry:
154 // CHECK-NEXT: ret <8 x i16> undef
155 //
test_vuninitializedq_polymorphic_s16(int16x8_t (* funcptr)(void))156 int16x8_t test_vuninitializedq_polymorphic_s16(int16x8_t (*funcptr)(void))
157 {
158 return vuninitializedq(funcptr());
159 }
160
161 // CHECK-LABEL: @test_vuninitializedq_polymorphic_s32(
162 // CHECK-NEXT: entry:
163 // CHECK-NEXT: ret <4 x i32> undef
164 //
test_vuninitializedq_polymorphic_s32(int32x4_t (* funcptr)(void))165 int32x4_t test_vuninitializedq_polymorphic_s32(int32x4_t (*funcptr)(void))
166 {
167 return vuninitializedq(funcptr());
168 }
169
170 // CHECK-LABEL: @test_vuninitializedq_polymorphic_s64(
171 // CHECK-NEXT: entry:
172 // CHECK-NEXT: ret <2 x i64> undef
173 //
test_vuninitializedq_polymorphic_s64(int64x2_t (* funcptr)(void))174 int64x2_t test_vuninitializedq_polymorphic_s64(int64x2_t (*funcptr)(void))
175 {
176 return vuninitializedq(funcptr());
177 }
178
179 // CHECK-LABEL: @test_vuninitializedq_polymorphic_u8(
180 // CHECK-NEXT: entry:
181 // CHECK-NEXT: ret <16 x i8> undef
182 //
test_vuninitializedq_polymorphic_u8(uint8x16_t (* funcptr)(void))183 uint8x16_t test_vuninitializedq_polymorphic_u8(uint8x16_t (*funcptr)(void))
184 {
185 return vuninitializedq(funcptr());
186 }
187
188 // CHECK-LABEL: @test_vuninitializedq_polymorphic_u16(
189 // CHECK-NEXT: entry:
190 // CHECK-NEXT: ret <8 x i16> undef
191 //
test_vuninitializedq_polymorphic_u16(uint16x8_t (* funcptr)(void))192 uint16x8_t test_vuninitializedq_polymorphic_u16(uint16x8_t (*funcptr)(void))
193 {
194 return vuninitializedq(funcptr());
195 }
196
197 // CHECK-LABEL: @test_vuninitializedq_polymorphic_u32(
198 // CHECK-NEXT: entry:
199 // CHECK-NEXT: ret <4 x i32> undef
200 //
test_vuninitializedq_polymorphic_u32(uint32x4_t (* funcptr)(void))201 uint32x4_t test_vuninitializedq_polymorphic_u32(uint32x4_t (*funcptr)(void))
202 {
203 return vuninitializedq(funcptr());
204 }
205
206 // CHECK-LABEL: @test_vuninitializedq_polymorphic_u64(
207 // CHECK-NEXT: entry:
208 // CHECK-NEXT: ret <2 x i64> undef
209 //
test_vuninitializedq_polymorphic_u64(uint64x2_t (* funcptr)(void))210 uint64x2_t test_vuninitializedq_polymorphic_u64(uint64x2_t (*funcptr)(void))
211 {
212 return vuninitializedq(funcptr());
213 }
214
215 // CHECK-LABEL: @test_vuninitializedq_f16(
216 // CHECK-NEXT: entry:
217 // CHECK-NEXT: ret <8 x half> undef
218 //
test_vuninitializedq_f16(void)219 float16x8_t test_vuninitializedq_f16(void)
220 {
221 return vuninitializedq_f16();
222 }
223
224 // CHECK-LABEL: @test_vuninitializedq_f32(
225 // CHECK-NEXT: entry:
226 // CHECK-NEXT: ret <4 x float> undef
227 //
test_vuninitializedq_f32(void)228 float32x4_t test_vuninitializedq_f32(void)
229 {
230 return vuninitializedq_f32();
231 }
232
233 // CHECK-LABEL: @test_vuninitializedq_s16(
234 // CHECK-NEXT: entry:
235 // CHECK-NEXT: ret <8 x i16> undef
236 //
test_vuninitializedq_s16(void)237 int16x8_t test_vuninitializedq_s16(void)
238 {
239 return vuninitializedq_s16();
240 }
241
242 // CHECK-LABEL: @test_vuninitializedq_s32(
243 // CHECK-NEXT: entry:
244 // CHECK-NEXT: ret <4 x i32> undef
245 //
test_vuninitializedq_s32(void)246 int32x4_t test_vuninitializedq_s32(void)
247 {
248 return vuninitializedq_s32();
249 }
250
251 // CHECK-LABEL: @test_vuninitializedq_s64(
252 // CHECK-NEXT: entry:
253 // CHECK-NEXT: ret <2 x i64> undef
254 //
test_vuninitializedq_s64(void)255 int64x2_t test_vuninitializedq_s64(void)
256 {
257 return vuninitializedq_s64();
258 }
259
260 // CHECK-LABEL: @test_vuninitializedq_s8(
261 // CHECK-NEXT: entry:
262 // CHECK-NEXT: ret <16 x i8> undef
263 //
test_vuninitializedq_s8(void)264 int8x16_t test_vuninitializedq_s8(void)
265 {
266 return vuninitializedq_s8();
267 }
268
269 // CHECK-LABEL: @test_vuninitializedq_u16(
270 // CHECK-NEXT: entry:
271 // CHECK-NEXT: ret <8 x i16> undef
272 //
test_vuninitializedq_u16(void)273 uint16x8_t test_vuninitializedq_u16(void)
274 {
275 return vuninitializedq_u16();
276 }
277
278 // CHECK-LABEL: @test_vuninitializedq_u32(
279 // CHECK-NEXT: entry:
280 // CHECK-NEXT: ret <4 x i32> undef
281 //
test_vuninitializedq_u32(void)282 uint32x4_t test_vuninitializedq_u32(void)
283 {
284 return vuninitializedq_u32();
285 }
286
287 // CHECK-LABEL: @test_vuninitializedq_u64(
288 // CHECK-NEXT: entry:
289 // CHECK-NEXT: ret <2 x i64> undef
290 //
test_vuninitializedq_u64(void)291 uint64x2_t test_vuninitializedq_u64(void)
292 {
293 return vuninitializedq_u64();
294 }
295
296 // CHECK-LABEL: @test_vuninitializedq_u8(
297 // CHECK-NEXT: entry:
298 // CHECK-NEXT: ret <16 x i8> undef
299 //
test_vuninitializedq_u8(void)300 uint8x16_t test_vuninitializedq_u8(void)
301 {
302 return vuninitializedq_u8();
303 }
304
305