summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vect/vect-93.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-93.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-93.c')
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-93.c85
1 files changed, 85 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/vect/vect-93.c b/gcc/testsuite/gcc.dg/vect/vect-93.c
new file mode 100644
index 000000000..65403eb72
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-93.c
@@ -0,0 +1,85 @@
+/* { dg-require-effective-target vect_float } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 3001
+
+
+__attribute__ ((noinline))
+main1 (float *pa)
+{
+ int i;
+
+ for (i = 0; i < 3001; i++)
+ {
+ pa[i] = 2.0;
+ }
+
+ /* check results: */
+ for (i = 0; i < 3001; i++)
+ {
+ if (pa[i] != 2.0)
+ abort ();
+ }
+
+ for (i = 1; i <= 10; i++)
+ {
+ pa[i] = 3.0;
+ }
+
+ /* check results: */
+ for (i = 1; i <= 10; i++)
+ {
+ if (pa[i] != 3.0)
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ int i;
+ float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+ float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+
+ check_vect ();
+
+ /* from bzip2: */
+ for (i=0; i<N; i++) b[i] = i;
+ a[0] = 0;
+ for (i = 1; i <= 256; i++) a[i] = b[i-1];
+
+ /* check results: */
+ for (i = 1; i <= 256; i++)
+ {
+ if (a[i] != i-1)
+ abort ();
+ }
+ if (a[0] != 0)
+ abort ();
+
+ main1 (a);
+
+ return 0;
+}
+
+/* 2 loops vectorized in main1, 2 loops vectorized in main:
+ the first loop in main requires vectorization of conversions,
+ the second loop in main requires vectorization of misaligned load. */
+
+/* main && main1 together: */
+/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 2 "vect" { target powerpc*-*-* i?86-*-* x86_64-*-* } } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { target { vect_no_align && {! vector_alignment_reachable} } } } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 3 "vect" { xfail { { vect_no_align } || { { ! vector_alignment_reachable} || vect_element_align } } } } } */
+
+/* in main1: */
+/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target !powerpc*-*-* !i?86-*-* !x86_64-*-* } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target vect_no_align } } } */
+
+/* in main: */
+/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" { target vect_no_align } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { vect_no_align } } } } */
+
+/* { dg-final { cleanup-tree-dump "vect" } } */