2015-09-24 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / va-arg-25.c
blob0fff6239be6c5b5888749ec420f662a450c27443
1 /* Varargs and vectors! */
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-*-* } } } */
9 #include <stdarg.h>
10 #include <stdlib.h>
11 #include <limits.h>
13 #define vector __attribute__((vector_size(16)))
15 const vector unsigned int v1 = {10,11,12,13};
16 const vector unsigned int v2 = {20,21,22,23};
18 extern int memcmp (const void *, const void *, size_t);
20 void foo(int a, ...)
22 va_list args;
23 vector unsigned int v;
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);
38 int main(void)
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;