diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-03 22:20:22 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-03 22:20:22 +0000 |
commit | 8e3caacfd31e8064785cba5c6ca2cec3a67d9f73 (patch) | |
tree | 564a1ff18b0904b5bdf6f6ddb4fe2fe6e2d05832 /gcc/testsuite/gcc.target/powerpc/altivec-varargs-1.c | |
parent | cfd96fcf019126965884e81fca9598be86537582 (diff) | |
download | gcc-8e3caacfd31e8064785cba5c6ca2cec3a67d9f73.tar.gz |
* gcc.target/powerpc: New directory.
* gcc.target/powerpc/powerpc.exp: New file.
* gcc.dg/20020118-1.c, gcc.dg/20030218-1.c, gcc.dg/20030505.c,
gcc.dg/20040121-1.c, gcc.dg/20040622-1.c, gcc.dg/20041111-1.c,
gcc.dg/20050603-1.c, gcc.dg/20050603-3.c, gcc.dg/20050830-1.c,
gcc.dg/980827-1.c, gcc.dg/altivec-1.c, gcc.dg/altivec-10.c,
gcc.dg/altivec-11.c, gcc.dg/altivec-12.c, gcc.dg/altivec-13.c,
gcc.dg/altivec-14.c, gcc.dg/altivec-15.c, gcc.dg/altivec-16.c,
gcc.dg/altivec-17.c, gcc.dg/altivec-18.c, gcc.dg/altivec-19.c,
gcc.dg/altivec-2.c, gcc.dg/altivec-20.c, gcc.dg/altivec-21.c,
gcc.dg/altivec-22.c, gcc.dg/altivec-3.c, gcc.dg/altivec-4.c,
gcc.dg/altivec-5.c, gcc.dg/altivec-6.c, gcc.dg/altivec-7.c,
gcc.dg/altivec-8.c, gcc.dg/altivec-9.c, gcc.dg/altivec-pr22085.c,
gcc.dg/altivec-types-1.c, gcc.dg/altivec-types-2.c,
gcc.dg/altivec-types-3.c, gcc.dg/altivec-types-4.c,
gcc.dg/altivec-varargs-1.c, gcc.dg/altivec-vec-merge.c,
gcc.dg/altivec_check.h, gcc.dg/compress-float-ppc-pic.c,
gcc.dg/compress-float-ppc.c, gcc.dg/darwin-abi-1.c,
gcc.dg/darwin-abi-2.c, gcc.dg/darwin-bool-1.c,
gcc.dg/darwin-bool-2.c, gcc.dg/darwin-longdouble.c,
gcc.dg/darwin-longlong.c, gcc.dg/darwin-misaligned.c,
gcc.dg/doloop-1.c, gcc.dg/macho-lo-sum.c, gcc.dg/ppc-and-1.c,
gcc.dg/ppc-bitfield1.c, gcc.dg/ppc-compare-1.c, gcc.dg/ppc-eabi.c,
gcc.dg/ppc-fmadd-1.c, gcc.dg/ppc-fmadd-2.c, gcc.dg/ppc-fmadd-3.c,
gcc.dg/ppc-fsel-1.c, gcc.dg/ppc-fsel-2.c, gcc.dg/ppc-fsel-3.c,
gcc.dg/ppc-ldstruct.c, gcc.dg/ppc-mov-1.c, gcc.dg/ppc-sdata-1.c,
gcc.dg/ppc-sdata-2.c, gcc.dg/ppc-spe.c, gcc.dg/ppc-spe64-1.c,
gcc.dg/ppc-stackalign-1.c, gcc.dg/ppc-stfiwx.c,
gcc.dg/ppc-vector-memcpy.c, gcc.dg/ppc-vector-memset.c,
gcc.dg/ppc64-abi-1.c, gcc.dg/ppc64-abi-2.c, gcc.dg/ppc64-abi-3.c,
gcc.dg/ppc64-toc.c, gcc.dg/pr16155.c, gcc.dg/pr16286.c,
gcc.dg/pr18096-1.c, gcc.dg/rs6000-fpint-2.c,
gcc.dg/rs6000-fpint.c, gcc.dg/rs6000-ldouble-1.c,
gcc.dg/rs6000-ldouble-2.c, gcc.dg/rs6000-power2-1.c,
gcc.dg/rs6000-power2-2.c, gcc.dg/spe1.c,
gcc.dg/stabs-attrib-vect-darwin.c: Move to gcc.target/powerpc.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@106453 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.target/powerpc/altivec-varargs-1.c')
-rw-r--r-- | gcc/testsuite/gcc.target/powerpc/altivec-varargs-1.c | 84 |
1 files changed, 84 insertions, 0 deletions
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 00000000000..135d3a9230f --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/altivec-varargs-1.c @@ -0,0 +1,84 @@ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-xfail-if "" { "powerpc-*-eabispe*" "powerpc-ibm-aix*" } { "-maltivec" } { "" } } */ +/* { dg-options "-maltivec -mabi=altivec -fno-inline" } */ + +#include <stdarg.h> +#include <signal.h> + +#include "altivec_check.h" + +#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) +{ + /* Exit on systems without AltiVec. */ + altivec_check (); + + return main1 (); +} |