1 /* { dg-do run { target aarch64_sve_hw } } */
2 /* { dg-options "-O0 -fstack-clash-protection -g" } */
3 
4 #include <arm_sve.h>
5 #include <stdarg.h>
6 
7 void __attribute__((noipa))
callee(int foo,...)8 callee (int foo, ...)
9 {
10   va_list va;
11   svbool_t pg, p;
12   svint8_t s8;
13   svuint16x4_t u16;
14   svfloat32x3_t f32;
15   svint64x2_t s64;
16 
17   va_start (va, foo);
18   p = va_arg (va, svbool_t);
19   s8 = va_arg (va, svint8_t);
20   u16 = va_arg (va, svuint16x4_t);
21   f32 = va_arg (va, svfloat32x3_t);
22   s64 = va_arg (va, svint64x2_t);
23 
24   pg = svptrue_b8 ();
25 
26   if (svptest_any (pg, sveor_z (pg, p, svptrue_pat_b8 (SV_VL7))))
27     __builtin_abort ();
28 
29   if (svptest_any (pg, svcmpne (pg, s8, svindex_s8 (1, 2))))
30     __builtin_abort ();
31 
32   if (svptest_any (pg, svcmpne (pg, svget4 (u16, 0), svindex_u16 (2, 3))))
33     __builtin_abort ();
34 
35   if (svptest_any (pg, svcmpne (pg, svget4 (u16, 1), svindex_u16 (3, 4))))
36     __builtin_abort ();
37 
38   if (svptest_any (pg, svcmpne (pg, svget4 (u16, 2), svindex_u16 (4, 5))))
39     __builtin_abort ();
40 
41   if (svptest_any (pg, svcmpne (pg, svget4 (u16, 3), svindex_u16 (5, 6))))
42     __builtin_abort ();
43 
44   if (svptest_any (pg, svcmpne (pg, svget3 (f32, 0), svdup_f32 (1.0))))
45     __builtin_abort ();
46 
47   if (svptest_any (pg, svcmpne (pg, svget3 (f32, 1), svdup_f32 (2.0))))
48     __builtin_abort ();
49 
50   if (svptest_any (pg, svcmpne (pg, svget3 (f32, 2), svdup_f32 (3.0))))
51     __builtin_abort ();
52 
53   if (svptest_any (pg, svcmpne (pg, svget2 (s64, 0), svindex_s64 (6, 7))))
54     __builtin_abort ();
55 
56   if (svptest_any (pg, svcmpne (pg, svget2 (s64, 1), svindex_s64 (7, 8))))
57     __builtin_abort ();
58 }
59 
60 int __attribute__((noipa))
main(void)61 main (void)
62 {
63   callee (100,
64 	  svptrue_pat_b8 (SV_VL7),
65 	  svindex_s8 (1, 2),
66 	  svcreate4 (svindex_u16 (2, 3),
67 		     svindex_u16 (3, 4),
68 		     svindex_u16 (4, 5),
69 		     svindex_u16 (5, 6)),
70 	  svcreate3 (svdup_f32 (1.0),
71 		     svdup_f32 (2.0),
72 		     svdup_f32 (3.0)),
73 	  svcreate2 (svindex_s64 (6, 7),
74 		     svindex_s64 (7, 8)));
75 }
76