summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vect/vect-complex-4.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/vect/vect-complex-4.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/vect/vect-complex-4.c')
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-complex-4.c108
1 files changed, 108 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/vect/vect-complex-4.c b/gcc/testsuite/gcc.dg/vect/vect-complex-4.c
new file mode 100644
index 000000000..288ff07c1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-complex-4.c
@@ -0,0 +1,108 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 16
+
+struct foostr {
+ _Complex short f1;
+ _Complex short f2;
+};
+
+struct foostr a[16] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
+ {
+ 11 + 23i, 24 + 22i,
+ 11 + 26i, 24 + 35i,
+ 19 + 20i, 29 + 14i,
+ 23 + 31i, 26 + 30i,
+ 29 + 39i, 24 + 18i,
+ 20 + 32i, 16 + 23i,
+ 13 + 26i, 37 + 34i,
+ 12 + 23i, 26 + 14i,
+ 36 + 14i, 31 + 17i,
+ 35 + 17i, 17 + 36i,
+ 13 + 34i, 19 + 12i,
+ 27 + 34i, 36 + 19i,
+ 21 + 39i, 16 + 33i,
+ 28 + 18i, 39 + 26i,
+ 32 + 27i, 13 + 38i,
+ 35 + 36i, 34 + 28i,
+ };
+
+struct foostr b[16] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
+ {
+ 37 + 12i, 23 + 15i,
+ 14 + 11i, 13 + 25i,
+ 35 + 29i, 22 + 34i,
+ 24 + 34i, 16 + 39i,
+ 34 + 32i, 26 + 21i,
+ 34 + 36i, 11 + 37i,
+ 25 + 21i, 10 + 39i,
+ 10 + 36i, 35 + 22i,
+ 39 + 29i, 23 + 21i,
+ 34 + 33i, 39 + 14i,
+ 16 + 31i, 32 + 33i,
+ 20 + 14i, 35 + 30i,
+ 26 + 24i, 36 + 37i,
+ 31 + 20i, 32 + 28i,
+ 25 + 27i, 15 + 30i,
+ 10 + 31i, 37 + 37i,
+ };
+struct foostr c[16] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+struct foostr res[N] =
+ {
+ 48 + 35i, 47 + 37i,
+ 25 + 37i, 37 + 60i,
+ 54 + 49i, 51 + 48i,
+ 47 + 65i, 42 + 69i,
+ 63 + 71i, 50 + 39i,
+ 54 + 68i, 27 + 60i,
+ 38 + 47i, 47 + 73i,
+ 22 + 59i, 61 + 36i,
+ 75 + 43i, 54 + 38i,
+ 69 + 50i, 56 + 50i,
+ 29 + 65i, 51 + 45i,
+ 47 + 48i, 71 + 49i,
+ 47 + 63i, 52 + 70i,
+ 59 + 38i, 71 + 54i,
+ 57 + 54i, 28 + 68i,
+ 45 + 67i, 71 + 65i,
+ };
+
+__attribute__ ((noinline)) void
+foo (void)
+{
+ int i;
+
+ for (i = 0; i < N; i++)
+ {
+ c[i].f1 = a[i].f1 + b[i].f1;
+ c[i].f2 = a[i].f2 + b[i].f2;
+ }
+
+}
+
+int
+main (void)
+{
+ int i;
+ check_vect ();
+
+ foo ();
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (c[i].f1 != res[i].f1)
+ abort ();
+ if (c[i].f2 != res[i].f2)
+ abort ();
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */