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/testsuite/g++.dg/ext/altivec-cell-2.C | 141 ++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 gcc/testsuite/g++.dg/ext/altivec-cell-2.C (limited to 'gcc/testsuite/g++.dg/ext/altivec-cell-2.C') diff --git a/gcc/testsuite/g++.dg/ext/altivec-cell-2.C b/gcc/testsuite/g++.dg/ext/altivec-cell-2.C new file mode 100644 index 000000000..f0d3433cd --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/altivec-cell-2.C @@ -0,0 +1,141 @@ +/* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */ +/* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */ +/* { dg-require-effective-target powerpc_altivec_ok } */ +/* { dg-options "-maltivec" } */ +/* Test the vec_extract VMX intrinsics. */ +#include + +extern "C" void abort (void); + +vector int a = {0, 1, 2, 3}; +vector short b = {0, 1, 2, 3, 4, 5, 6, 7}; + +int f(vector int a, int b) +{ + return vec_extract (a, b); +} + +int f0 (vector int a) +{ + return vec_extract (a, 0); +} +int f1 (vector int a) +{ + return vec_extract (a, 1); +} +int f2 (vector int a) +{ + return vec_extract (a, 2); +} +int f3 (vector int a) +{ + return vec_extract (a, 3); +} +int f4 (vector int a) +{ + return vec_extract (a, 4); +} + +int g(vector short a, int b) +{ + return vec_extract (a, b); +} + +int g0 (vector short a) +{ + return vec_extract (a, 0); +} +int g1 (vector short a) +{ + return vec_extract (a, 1); +} +int g2 (vector short a) +{ + return vec_extract (a, 2); +} +int g3 (vector short a) +{ + return vec_extract (a, 3); +} + +int g4 (vector short a) +{ + return vec_extract (a, 4); +} +int g5 (vector short a) +{ + return vec_extract (a, 5); +} +int g6 (vector short a) +{ + return vec_extract (a, 6); +} +int g7 (vector short a) +{ + return vec_extract (a, 7); +} +int g8 (vector short a) +{ + return vec_extract (a, 8); +} +int main1(void) __attribute__((noinline)); +int main1(void) +{ + int i; + /* Check vec_extract with a non constant element numbering */ + for(i=0;i<10;i++) + { + if (f(a, i) != (i&0x3)) + abort (); + } + + /* Check vec_extract with a constant element numbering */ + if (f0(a) != 0) + abort (); + if (f1(a) != 1) + abort (); + if (f2(a) != 2) + abort (); + if (f3(a) != 3) + abort (); + /* Check that vec_extract works with a constant element higher than + the number of elements. */ + if (f4(a) != 0) + abort (); + + /* Check vec_extract with a non constant element numbering */ + for(i=0;i<10;i++) + { + if (g(b, i) != (i&0x7)) + abort (); + } + + /* Check vec_extract with a constant element numbering */ + if (g0(b) != 0) + abort (); + if (g1(b) != 1) + abort (); + if (g2(b) != 2) + abort (); + if (g3(b) != 3) + abort (); + if (g4(b) != 4) + abort (); + if (g5(b) != 5) + abort (); + if (g6(b) != 6) + abort (); + if (g7(b) != 7) + abort (); + /* Check that vec_extract works with a constant element higher than + the number of elements. */ + if (g8(b) != 0) + abort (); + + return 0; +} + +int main(void) +{ + return main1 (); +} -- cgit v1.2.3