OSDN Git Service

2010-11-08 Basile Starynkevitch <basile@starynkevitch.net>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / torture / va-arg-25.c
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
7 #include <stdarg.h>
8 #include <stdlib.h>
9 #include <limits.h>
10
11 #define vector __attribute__((vector_size(16)))
12
13 const vector unsigned int v1 = {10,11,12,13};
14 const vector unsigned int v2 = {20,21,22,23};
15
16 void foo(int a, ...)
17 {
18   va_list args;
19   vector unsigned int v;
20
21   va_start (args, a);
22   v = va_arg (args, vector unsigned int);
23   if (a != 1 || memcmp (&v, &v1, sizeof (v)) != 0)
24     abort ();
25   a = va_arg (args, int);
26   if (a != 2)
27     abort ();
28   v = va_arg (args, vector unsigned int);
29   if (memcmp (&v, &v2, sizeof (v)) != 0)
30     abort ();
31   va_end (args);
32 }
33
34 int main(void)
35 {
36 #if INT_MAX == 2147483647
37   foo (1, (vector unsigned int){10,11,12,13}, 2,
38        (vector unsigned int){20,21,22,23});
39 #endif
40   return 0;
41 }
42