1 /* Test vdup_lane intrinsics work correctly. */
3 /* { dg-options "--save-temps -O1" } */
7 extern void abort (void);
9 float32x2_t
__attribute__ ((noinline
))
10 wrap_vdup_lane_f32_0 (float32x2_t a
)
12 return vdup_lane_f32 (a
, 0);
15 float32x2_t
__attribute__ ((noinline
))
16 wrap_vdup_lane_f32_1 (float32x2_t a
)
18 return vdup_lane_f32 (a
, 1);
21 int __attribute__ ((noinline
))
27 float32_t c
[2] = { 0.0 , 3.14 };
31 b
= wrap_vdup_lane_f32_0 (a
);
33 for (i
= 0; i
< 2; i
++)
37 b
= wrap_vdup_lane_f32_1 (a
);
39 for (i
= 0; i
< 2; i
++)
45 float32x4_t
__attribute__ ((noinline
))
46 wrap_vdupq_lane_f32_0 (float32x2_t a
)
48 return vdupq_lane_f32 (a
, 0);
51 float32x4_t
__attribute__ ((noinline
))
52 wrap_vdupq_lane_f32_1 (float32x2_t a
)
54 return vdupq_lane_f32 (a
, 1);
57 int __attribute__ ((noinline
))
58 test_vdupq_lane_f32 ()
63 float32_t c
[2] = { 0.0 , 3.14 };
67 b
= wrap_vdupq_lane_f32_0 (a
);
69 for (i
= 0; i
< 4; i
++)
73 b
= wrap_vdupq_lane_f32_1 (a
);
75 for (i
= 0; i
< 4; i
++)
81 int8x8_t
__attribute__ ((noinline
))
82 wrap_vdup_lane_s8_0 (int8x8_t a
)
84 return vdup_lane_s8 (a
, 0);
87 int8x8_t
__attribute__ ((noinline
))
88 wrap_vdup_lane_s8_1 (int8x8_t a
)
90 return vdup_lane_s8 (a
, 1);
93 int __attribute__ ((noinline
))
99 /* Only two first cases are interesting. */
100 int8_t c
[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };
104 b
= wrap_vdup_lane_s8_0 (a
);
106 for (i
= 0; i
< 8; i
++)
110 b
= wrap_vdup_lane_s8_1 (a
);
112 for (i
= 0; i
< 8; i
++)
118 int8x16_t
__attribute__ ((noinline
))
119 wrap_vdupq_lane_s8_0 (int8x8_t a
)
121 return vdupq_lane_s8 (a
, 0);
124 int8x16_t
__attribute__ ((noinline
))
125 wrap_vdupq_lane_s8_1 (int8x8_t a
)
127 return vdupq_lane_s8 (a
, 1);
130 int __attribute__ ((noinline
))
131 test_vdupq_lane_s8 ()
136 /* Only two first cases are interesting. */
137 int8_t c
[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };
141 b
= wrap_vdupq_lane_s8_0 (a
);
143 for (i
= 0; i
< 16; i
++)
147 b
= wrap_vdupq_lane_s8_1 (a
);
149 for (i
= 0; i
< 16; i
++)
155 int16x4_t
__attribute__ ((noinline
))
156 wrap_vdup_lane_s16_0 (int16x4_t a
)
158 return vdup_lane_s16 (a
, 0);
161 int16x4_t
__attribute__ ((noinline
))
162 wrap_vdup_lane_s16_1 (int16x4_t a
)
164 return vdup_lane_s16 (a
, 1);
167 int __attribute__ ((noinline
))
168 test_vdup_lane_s16 ()
173 /* Only two first cases are interesting. */
174 int16_t c
[4] = { 0, 1, 2, 3 };
178 b
= wrap_vdup_lane_s16_0 (a
);
180 for (i
= 0; i
< 4; i
++)
184 b
= wrap_vdup_lane_s16_1 (a
);
186 for (i
= 0; i
< 4; i
++)
192 int16x8_t
__attribute__ ((noinline
))
193 wrap_vdupq_lane_s16_0 (int16x4_t a
)
195 return vdupq_lane_s16 (a
, 0);
198 int16x8_t
__attribute__ ((noinline
))
199 wrap_vdupq_lane_s16_1 (int16x4_t a
)
201 return vdupq_lane_s16 (a
, 1);
204 int __attribute__ ((noinline
))
205 test_vdupq_lane_s16 ()
210 /* Only two first cases are interesting. */
211 int16_t c
[4] = { 0, 1, 2, 3 };
215 b
= wrap_vdupq_lane_s16_0 (a
);
217 for (i
= 0; i
< 8; i
++)
221 b
= wrap_vdupq_lane_s16_1 (a
);
223 for (i
= 0; i
< 8; i
++)
229 int32x2_t
__attribute__ ((noinline
))
230 wrap_vdup_lane_s32_0 (int32x2_t a
)
232 return vdup_lane_s32 (a
, 0);
235 int32x2_t
__attribute__ ((noinline
))
236 wrap_vdup_lane_s32_1 (int32x2_t a
)
238 return vdup_lane_s32 (a
, 1);
241 int __attribute__ ((noinline
))
242 test_vdup_lane_s32 ()
247 int32_t c
[2] = { 0, 1 };
251 b
= wrap_vdup_lane_s32_0 (a
);
253 for (i
= 0; i
< 2; i
++)
257 b
= wrap_vdup_lane_s32_1 (a
);
259 for (i
= 0; i
< 2; i
++)
265 int32x4_t
__attribute__ ((noinline
))
266 wrap_vdupq_lane_s32_0 (int32x2_t a
)
268 return vdupq_lane_s32 (a
, 0);
271 int32x4_t
__attribute__ ((noinline
))
272 wrap_vdupq_lane_s32_1 (int32x2_t a
)
274 return vdupq_lane_s32 (a
, 1);
277 int __attribute__ ((noinline
))
278 test_vdupq_lane_s32 ()
283 int32_t c
[2] = { 0, 1 };
287 b
= wrap_vdupq_lane_s32_0 (a
);
289 for (i
= 0; i
< 4; i
++)
293 b
= wrap_vdupq_lane_s32_1 (a
);
295 for (i
= 0; i
< 4; i
++)
301 int64x1_t
__attribute__ ((noinline
))
302 wrap_vdup_lane_s64_0 (int64x1_t a
)
304 return vdup_lane_s64 (a
, 0);
307 int64x1_t
__attribute__ ((noinline
))
308 wrap_vdup_lane_s64_1 (int64x1_t a
)
310 return vdup_lane_s64 (a
, 1);
313 int __attribute__ ((noinline
))
314 test_vdup_lane_s64 ()
323 b
= wrap_vdup_lane_s64_0 (a
);
330 b
= wrap_vdup_lane_s64_1 (a
);
337 int64x2_t
__attribute__ ((noinline
))
338 wrap_vdupq_lane_s64_0 (int64x1_t a
)
340 return vdupq_lane_s64 (a
, 0);
343 int64x2_t
__attribute__ ((noinline
))
344 wrap_vdupq_lane_s64_1 (int64x1_t a
)
346 return vdupq_lane_s64 (a
, 1);
349 int __attribute__ ((noinline
))
350 test_vdupq_lane_s64 ()
360 b
= wrap_vdupq_lane_s64_0 (a
);
362 for (i
= 0; i
< 2; i
++)
368 b
= wrap_vdupq_lane_s64_1 (a
);
370 for (i
= 0; i
< 2; i
++)
380 if (test_vdup_lane_f32 ())
382 if (test_vdup_lane_s8 ())
384 if (test_vdup_lane_s16 ())
386 if (test_vdup_lane_s32 ())
388 if (test_vdup_lane_s64 ())
390 if (test_vdupq_lane_f32 ())
392 if (test_vdupq_lane_s8 ())
394 if (test_vdupq_lane_s16 ())
396 if (test_vdupq_lane_s32 ())
398 if (test_vdupq_lane_s64 ())
404 /* Asm check for test_vdup_lane_s8. */
405 /* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.8b, v\[0-9\]+\.b\\\[0\\\]" 1 } } */
406 /* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.8b, v\[0-9\]+\.b\\\[1\\\]" 1 } } */
408 /* Asm check for test_vdupq_lane_s8. */
409 /* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.16b, v\[0-9\]+\.b\\\[0\\\]" 1 } } */
410 /* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.16b, v\[0-9\]+\.b\\\[1\\\]" 1 } } */
412 /* Asm check for test_vdup_lane_s16. */
413 /* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.4h, v\[0-9\]+\.h\\\[0\\\]" 1 } } */
414 /* Asm check for test_vdup_lane_s16. */
415 /* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.4h, v\[0-9\]+\.h\\\[1\\\]" 1 } } */
417 /* Asm check for test_vdupq_lane_s16. */
418 /* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.8h, v\[0-9\]+\.h\\\[0\\\]" 1 } } */
419 /* Asm check for test_vdupq_lane_s16. */
420 /* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.8h, v\[0-9\]+\.h\\\[1\\\]" 1 } } */
422 /* Asm check for test_vdup_lane_f32 and test_vdup_lane_s32. */
423 /* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.2s, v\[0-9\]+\.s\\\[0\\\]" 2 } } */
424 /* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.2s, v\[0-9\]+\.s\\\[1\\\]" 2 } } */
426 /* Asm check for test_vdupq_lane_f32 and test_vdupq_lane_s32. */
427 /* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.4s, v\[0-9\]+\.s\\\[0\\\]" 2 } } */
428 /* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.4s, v\[0-9\]+\.s\\\[1\\\]" 2 } } */
430 /* { dg-final { cleanup-saved-temps } } */