summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/var-expand3.c
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.dg/var-expand3.c
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
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.
Diffstat (limited to 'gcc/testsuite/gcc.dg/var-expand3.c')
-rw-r--r--gcc/testsuite/gcc.dg/var-expand3.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/var-expand3.c b/gcc/testsuite/gcc.dg/var-expand3.c
new file mode 100644
index 000000000..a9d0fe917
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/var-expand3.c
@@ -0,0 +1,58 @@
+/* { dg-do run { target { powerpc*-*-* && vmx_hw } } }} */
+/* { dg-options "-O2 -funroll-loops -ffast-math -fvariable-expansion-in-unroller -maltivec -fdump-rtl-loop2_unroll" } */
+
+#include "altivec.h"
+extern void abort (void);
+extern void exit (int);
+
+#define N 256
+
+float in1[N] __attribute__ ((__aligned__ (16))) = {0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57};
+float in2[N] __attribute__ ((__aligned__ (16))) = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
+
+float
+foo (int n)
+{
+ unsigned i;
+ vector float vp1, vp2, vp3, vaccum, vzero, vtmp;
+ float accum = 1.0;
+
+ vzero = (vector float){0, 0, 0, 0};
+
+ vaccum = vzero;
+
+ for (i = 0; i < n; i++)
+ {
+ vp1 = vec_ld (i * 16, in1);
+ vp2 = vec_ld (i * 16, in2);
+
+ vaccum = vec_madd (vp1, vp2, vaccum);
+
+ }
+ vtmp = vec_sld (vaccum, vaccum, 8);
+ vp1 = vec_add (vaccum, vtmp);
+ vtmp = vec_sld (vp1, vp1, 4);
+ vp2 = vec_add (vp1, vtmp);
+
+ vec_ste (vp2, 0, &accum);
+ if (accum != 1518)
+ return 0;
+
+ return accum;
+}
+
+int
+main (void)
+{
+ if (!foo (3))
+ abort ();
+
+ exit (0);
+}
+
+/* { dg-final { scan-rtl-dump "Expanding Accumulator" "loop2_unroll" } } */
+/* { dg-final { cleanup-rtl-dump "loop*" } } */
+
+
+
+