From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- .../gcc.target/powerpc/altivec-varargs-1.c | 82 ++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 gcc/testsuite/gcc.target/powerpc/altivec-varargs-1.c (limited to 'gcc/testsuite/gcc.target/powerpc/altivec-varargs-1.c') diff --git a/gcc/testsuite/gcc.target/powerpc/altivec-varargs-1.c b/gcc/testsuite/gcc.target/powerpc/altivec-varargs-1.c new file mode 100644 index 000000000..1349ae590 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/altivec-varargs-1.c @@ -0,0 +1,82 @@ +/* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */ +/* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */ +/* { dg-require-effective-target powerpc_altivec_ok } */ +/* { dg-options "-maltivec -mabi=altivec -fno-inline" } */ + +#include + +extern void exit (int); +extern void abort (void); + +#define vector __attribute__((vector_size (16))) + +const vector unsigned int v1 = {10,11,12,13}; +const vector unsigned int v2 = {20,21,22,23}; +const vector unsigned int v3 = {30,31,32,33}; +const vector unsigned int v4 = {40,41,42,43}; + +void foo(vector unsigned int a, ...) +{ + va_list args; + vector unsigned int v; + + va_start (args, a); + if (memcmp (&a, &v1, sizeof (v)) != 0) + abort (); + v = va_arg (args, vector unsigned int); + if (memcmp (&v, &v2, sizeof (v)) != 0) + abort (); + v = va_arg (args, vector unsigned int); + if (memcmp (&v, &v3, sizeof (v)) != 0) + abort (); + v = va_arg (args, vector unsigned int); + if (memcmp (&v, &v4, sizeof (v)) != 0) + abort (); + va_end (args); +} + +void bar(vector unsigned int a, ...) +{ + va_list args; + vector unsigned int v; + int b; + + va_start (args, a); + if (memcmp (&a, &v1, sizeof (v)) != 0) + abort (); + b = va_arg (args, int); + if (b != 2) + abort (); + v = va_arg (args, vector unsigned int); + if (memcmp (&v, &v2, sizeof (v)) != 0) + abort (); + v = va_arg (args, vector unsigned int); + if (memcmp (&v, &v3, sizeof (v)) != 0) + abort (); + va_end (args); +} + + +int main1(void) +{ + /* In this call, in the Darwin ABI, the first argument goes into v2 + the second one into r9-r10 and memory, + and the next two in memory. */ + foo ((vector unsigned int){10,11,12,13}, + (vector unsigned int){20,21,22,23}, + (vector unsigned int){30,31,32,33}, + (vector unsigned int){40,41,42,43}); + /* In this call, in the Darwin ABI, the first argument goes into v2 + the second one into r9, then r10 is reserved and + there are two words of padding in memory, and the next two arguments + go after the padding. */ + bar ((vector unsigned int){10,11,12,13}, 2, + (vector unsigned int){20,21,22,23}, + (vector unsigned int){30,31,32,33}); + return 0; +} + +int main (void) +{ + return main1 (); +} -- cgit v1.2.3