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 int __attribute__ ((noinline
))
308 test_vdup_lane_s64 ()
317 b
= wrap_vdup_lane_s64_0 (a
);
325 int64x2_t
__attribute__ ((noinline
))
326 wrap_vdupq_lane_s64_0 (int64x1_t a
)
328 return vdupq_lane_s64 (a
, 0);
331 int __attribute__ ((noinline
))
332 test_vdupq_lane_s64 ()
342 b
= wrap_vdupq_lane_s64_0 (a
);
344 for (i
= 0; i
< 2; i
++)
354 if (test_vdup_lane_f32 ())
356 if (test_vdup_lane_s8 ())
358 if (test_vdup_lane_s16 ())
360 if (test_vdup_lane_s32 ())
362 if (test_vdup_lane_s64 ())
364 if (test_vdupq_lane_f32 ())
366 if (test_vdupq_lane_s8 ())
368 if (test_vdupq_lane_s16 ())
370 if (test_vdupq_lane_s32 ())
372 if (test_vdupq_lane_s64 ())
378 /* Asm check for test_vdup_lane_s8. */
379 /* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.8b, v\[0-9\]+\.b\\\[0\\\]" 1 } } */
380 /* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.8b, v\[0-9\]+\.b\\\[1\\\]" 1 } } */
382 /* Asm check for test_vdupq_lane_s8. */
383 /* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.16b, v\[0-9\]+\.b\\\[0\\\]" 1 } } */
384 /* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.16b, v\[0-9\]+\.b\\\[1\\\]" 1 } } */
386 /* Asm check for test_vdup_lane_s16. */
387 /* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.4h, v\[0-9\]+\.h\\\[0\\\]" 1 } } */
388 /* Asm check for test_vdup_lane_s16. */
389 /* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.4h, v\[0-9\]+\.h\\\[1\\\]" 1 } } */
391 /* Asm check for test_vdupq_lane_s16. */
392 /* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.8h, v\[0-9\]+\.h\\\[0\\\]" 1 } } */
393 /* Asm check for test_vdupq_lane_s16. */
394 /* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.8h, v\[0-9\]+\.h\\\[1\\\]" 1 } } */
396 /* Asm check for test_vdup_lane_f32 and test_vdup_lane_s32. */
397 /* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.2s, v\[0-9\]+\.s\\\[0\\\]" 2 } } */
398 /* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.2s, v\[0-9\]+\.s\\\[1\\\]" 2 } } */
400 /* Asm check for test_vdupq_lane_f32 and test_vdupq_lane_s32. */
401 /* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.4s, v\[0-9\]+\.s\\\[0\\\]" 2 } } */
402 /* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.4s, v\[0-9\]+\.s\\\[1\\\]" 2 } } */
404 /* { dg-final { cleanup-saved-temps } } */