1 /* Varargs and vectors!  */
2 
3 /* { dg-do run } */
4 /* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */
5 /* { dg-require-effective-target sse_runtime { target { i?86-*-* x86_64-*-* } } } */
6 /* { dg-options "-mabi=altivec -maltivec" { target { powerpc-*-* powerpc64-*-* } } } */
7 /* { dg-require-effective-target vmx_hw { target { powerpc-*-* powerpc64-*-* } } } */
8 
9 #include <stdarg.h>
10 #include <stdlib.h>
11 #include <limits.h>
12 
13 #define vector __attribute__((vector_size(16)))
14 
15 const vector unsigned int v1 = {10,11,12,13};
16 const vector unsigned int v2 = {20,21,22,23};
17 
18 extern int memcmp (const void *, const void *, size_t);
19 
foo(int a,...)20 void foo(int a, ...)
21 {
22   va_list args;
23   vector unsigned int v;
24 
25   va_start (args, a);
26   v = va_arg (args, vector unsigned int);
27   if (a != 1 || memcmp (&v, &v1, sizeof (v)) != 0)
28     abort ();
29   a = va_arg (args, int);
30   if (a != 2)
31     abort ();
32   v = va_arg (args, vector unsigned int);
33   if (memcmp (&v, &v2, sizeof (v)) != 0)
34     abort ();
35   va_end (args);
36 }
37 
main(void)38 int main(void)
39 {
40 #if INT_MAX == 2147483647
41   foo (1, (vector unsigned int){10,11,12,13}, 2,
42        (vector unsigned int){20,21,22,23});
43 #endif
44   return 0;
45 }
46 
47