Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / gcc.target / powerpc / altivec-varargs-1.c
blob8fba66956e37b479d4c1550d5acedf1e516149a4
1 /* { dg-do run { target powerpc*-*-* } } */
2 /* { dg-xfail-if "" { "powerpc-*-eabispe*" "powerpc-ibm-aix*" } { "*" } { "" } } */
3 /* { dg-options "-maltivec -mabi=altivec -fno-inline" } */
5 #include <stdarg.h>
6 #include <signal.h>
8 #include "altivec_check.h"
10 #define vector __attribute__((vector_size (16)))
12 const vector unsigned int v1 = {10,11,12,13};
13 const vector unsigned int v2 = {20,21,22,23};
14 const vector unsigned int v3 = {30,31,32,33};
15 const vector unsigned int v4 = {40,41,42,43};
17 void foo(vector unsigned int a, ...)
19 va_list args;
20 vector unsigned int v;
22 va_start (args, a);
23 if (memcmp (&a, &v1, sizeof (v)) != 0)
24 abort ();
25 v = va_arg (args, vector unsigned int);
26 if (memcmp (&v, &v2, sizeof (v)) != 0)
27 abort ();
28 v = va_arg (args, vector unsigned int);
29 if (memcmp (&v, &v3, sizeof (v)) != 0)
30 abort ();
31 v = va_arg (args, vector unsigned int);
32 if (memcmp (&v, &v4, sizeof (v)) != 0)
33 abort ();
34 va_end (args);
37 void bar(vector unsigned int a, ...)
39 va_list args;
40 vector unsigned int v;
41 int b;
43 va_start (args, a);
44 if (memcmp (&a, &v1, sizeof (v)) != 0)
45 abort ();
46 b = va_arg (args, int);
47 if (b != 2)
48 abort ();
49 v = va_arg (args, vector unsigned int);
50 if (memcmp (&v, &v2, sizeof (v)) != 0)
51 abort ();
52 v = va_arg (args, vector unsigned int);
53 if (memcmp (&v, &v3, sizeof (v)) != 0)
54 abort ();
55 va_end (args);
59 int main1(void)
61 /* In this call, in the Darwin ABI, the first argument goes into v2
62 the second one into r9-r10 and memory,
63 and the next two in memory. */
64 foo ((vector unsigned int){10,11,12,13},
65 (vector unsigned int){20,21,22,23},
66 (vector unsigned int){30,31,32,33},
67 (vector unsigned int){40,41,42,43});
68 /* In this call, in the Darwin ABI, the first argument goes into v2
69 the second one into r9, then r10 is reserved and
70 there are two words of padding in memory, and the next two arguments
71 go after the padding. */
72 bar ((vector unsigned int){10,11,12,13}, 2,
73 (vector unsigned int){20,21,22,23},
74 (vector unsigned int){30,31,32,33});
75 return 0;
78 int main (void)
80 /* Exit on systems without AltiVec. */
81 altivec_check ();
83 return main1 ();