summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordorit <dorit@138bc75d-0d04-0410-961f-82ee72b054a4>2007-10-30 05:25:10 +0000
committerdorit <dorit@138bc75d-0d04-0410-961f-82ee72b054a4>2007-10-30 05:25:10 +0000
commit2483fa6824054f570c6a4cf4875b8307797731b9 (patch)
tree98666a1ffa4711b44b4da76ac33052abebba122d
parented1c544cfa4663ffa31adabb11115802a9c21d1a (diff)
downloadgcc-2483fa6824054f570c6a4cf4875b8307797731b9.tar.gz
PR tree-optimization/32893
* tree-vectorize.c (vect_can_force_dr_alignment_p): Check STACK_BOUNDARY instead of PREFERRED_STACK_BOUNDARY. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@129764 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog60
-rw-r--r--gcc/testsuite/gcc.dg/vect/costmodel/i386/costmodel-vect-31.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-vect-31.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/no-scevccp-outer-6-global.c58
-rw-r--r--gcc/testsuite/gcc.dg/vect/no-scevccp-outer-6.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-31.c92
-rw-r--r--gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-34.c42
-rw-r--r--gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-36.c48
-rw-r--r--gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-64.c88
-rw-r--r--gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-65.c85
-rw-r--r--gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-66.c84
-rw-r--r--gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-68.c92
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-25.c5
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-13.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-17.c8
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-18.c8
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-19.c8
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-2.c5
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-20.c8
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-21.c8
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-22.c8
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-27.c5
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-29.c5
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-3.c17
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-31.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-34.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-36.c5
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-4.c7
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-5.c7
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-6.c8
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-64.c5
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-65.c1
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-66.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-68.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-7.c5
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-72.c5
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-73.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-76.c1
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-77-alignchecks.c56
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-77-global.c53
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-77.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-78-alignchecks.c57
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-78-global.c53
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-78.c7
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-86.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-all.c22
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect.exp2
-rw-r--r--gcc/testsuite/gcc.dg/vect/wrapv-vect-7.c5
-rw-r--r--gcc/testsuite/lib/target-supports.exp21
-rw-r--r--gcc/tree-vectorizer.c9
51 files changed, 991 insertions, 109 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8e85aae9a07..9e7199f0bb3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2007-10-29 Dorit Nuzman <dorit@il.ibm.com>
+
+ PR tree-optimization/32893
+ * tree-vectorize.c (vect_can_force_dr_alignment_p): Check
+ STACK_BOUNDARY instead of PREFERRED_STACK_BOUNDARY.
+
2007-10-29 Rask Ingemann Lambertsen <rask@sygehus.dk>
* longlong.h (add_ssaaaa): Support Intel asm syntax in i386 and
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b60bf928784..5befb1c01dc 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,63 @@
+2007-10-29 Dorit Nuzman <dorit@il.ibm.com>
+
+ PR tree-optimization/32893
+ * testsuite/lib/target-supports.exp
+ (check_effective_target_unaligned_stack): new keyword.
+ * testsuite/gcc.dg/vect/vect-2.c: Globalize arrays to make the test
+ not sensitive to unaligned_stack.
+ * testsuite/gcc.dg/vect/vect-3.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-4.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-5.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-6.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-7.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-13.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-17.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-18.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-19.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-20.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-21.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-22.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-27.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-29.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-64.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-65.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-66.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-72.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-73.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-86.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-all.c: Likewise.
+ * testsuite/gcc.dg/vect/slp-25.c: Likewise.
+ * testsuite/gcc.dg/vect/wrapv-vect-7.c: Likewise.
+ * testsuite/gcc.dg/vect/costmodel/i386/costmodel-vect-31.c: Likewise.
+ * testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-vect-31.c: Likewise.
+
+ * testsuite/gcc.dg/vect/vect-31.c: Removed alignment checks.
+ * testsuite/gcc.dg/vect/vect-34.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-36.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-64.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-65.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-66.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-68.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-76.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-77.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-78.c: Likewise.
+
+ * testsuite/gcc.dg/vect/no-section-anchors-vect-31.c: New test, Like the
+ original testcase (without no-section-anchors prefix) but with global arrays.
+ * testsuite/gcc.dg/vect/no-section-anchors-vect-34.c: Likewise.
+ * testsuite/gcc.dg/vect/no-section-anchors-vect-36.c: Likewsie.
+ * testsuite/gcc.dg/vect/no-section-anchors-vect-64.c: Likewise.
+ * testsuite/gcc.dg/vect/no-section-anchors-vect-65.c: Likewise.
+ * testsuite/gcc.dg/vect/no-section-anchors-vect-66.c: Likewise.
+ * testsuite/gcc.dg/vect/no-section-anchors-vect-68.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-77-global.c: Likewise.
+ * testsuite/gcc.dg/vect/vect-78-global.c: Likewise.
+
+ * testsuite/gcc.dg/vect/vect-77-alignchecks.c: New test. Like the
+ original testcase (without no-section-anchors prefix) but fix alignment checks
+ to also consider unaligned_stack targets.
+ * testsuite/gcc.dg/vect/vect-78-alignchecks.c: Likewise.
+
2007-10-29 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/33723
diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/i386/costmodel-vect-31.c b/gcc/testsuite/gcc.dg/vect/costmodel/i386/costmodel-vect-31.c
index efab30d4ac6..c61517aab42 100644
--- a/gcc/testsuite/gcc.dg/vect/costmodel/i386/costmodel-vect-31.c
+++ b/gcc/testsuite/gcc.dg/vect/costmodel/i386/costmodel-vect-31.c
@@ -18,10 +18,11 @@ struct s{
struct t e; /* unaligned (offset 2N+4N+4 B) */
};
+struct s tmp;
+
int main1 ()
{
int i;
- struct s tmp;
/* unaligned */
for (i = 0; i < N/2; i++)
diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-vect-31.c b/gcc/testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-vect-31.c
index efab30d4ac6..c61517aab42 100644
--- a/gcc/testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-vect-31.c
+++ b/gcc/testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-vect-31.c
@@ -18,10 +18,11 @@ struct s{
struct t e; /* unaligned (offset 2N+4N+4 B) */
};
+struct s tmp;
+
int main1 ()
{
int i;
- struct s tmp;
/* unaligned */
for (i = 0; i < N/2; i++)
diff --git a/gcc/testsuite/gcc.dg/vect/no-scevccp-outer-6-global.c b/gcc/testsuite/gcc.dg/vect/no-scevccp-outer-6-global.c
new file mode 100644
index 00000000000..a87367b3b08
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/no-scevccp-outer-6-global.c
@@ -0,0 +1,58 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 40
+
+int a[N];
+
+__attribute__ ((noinline)) int
+foo (int * __restrict__ b, int k){
+ int i,j;
+ int sum,x;
+
+ for (i = 0; i < N; i++) {
+ sum = b[i];
+ for (j = 0; j < N; j++) {
+ sum += j;
+ }
+ a[i] = sum;
+ }
+
+ return a[k];
+}
+
+int main (void)
+{
+ int i,j;
+ int sum;
+ int b[N];
+ int a[N];
+
+ check_vect ();
+
+ for (i=0; i<N; i++)
+ b[i] = i + 2;
+
+ for (i=0; i<N; i++)
+ a[i] = foo (b,i);
+
+ /* check results: */
+ for (i=0; i<N; i++)
+ {
+ sum = b[i];
+ for (j = 0; j < N; j++){
+ sum += j;
+ }
+ if (a[i] != sum)
+ abort();
+ }
+
+ return 0;
+}
+
+/* "Too many BBs in loop" */
+/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED." 1 "vect" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "vect_recog_widen_mult_pattern: detected" 1 "vect" { xfail *-*-* } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/no-scevccp-outer-6.c b/gcc/testsuite/gcc.dg/vect/no-scevccp-outer-6.c
index 58edfb5b129..70cf520d950 100644
--- a/gcc/testsuite/gcc.dg/vect/no-scevccp-outer-6.c
+++ b/gcc/testsuite/gcc.dg/vect/no-scevccp-outer-6.c
@@ -51,6 +51,6 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED." 1 "vect" { xfail vect_no_align } } } */
+/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED." 1 "vect" { xfail { unaligned_stack || vect_no_align } } } } */
/* { dg-final { scan-tree-dump-times "vect_recog_widen_mult_pattern: detected" 1 "vect" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-31.c b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-31.c
new file mode 100644
index 00000000000..21b87a39677
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-31.c
@@ -0,0 +1,92 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 32
+
+struct t{
+ int k[N];
+ int l;
+};
+
+struct s{
+ char a; /* aligned */
+ char b[N-1]; /* unaligned (offset 1B) */
+ char c[N]; /* aligned (offset NB) */
+ struct t d; /* aligned (offset 2NB) */
+ struct t e; /* unaligned (offset 2N+4N+4 B) */
+};
+
+struct s tmp;
+__attribute__ ((noinline))
+int main1 ()
+{
+ int i;
+
+ /* unaligned */
+ for (i = 0; i < N/2; i++)
+ {
+ tmp.b[i] = 5;
+ }
+
+ /* check results: */
+ for (i = 0; i <N/2; i++)
+ {
+ if (tmp.b[i] != 5)
+ abort ();
+ }
+
+ /* aligned */
+ for (i = 0; i < N/2; i++)
+ {
+ tmp.c[i] = 6;
+ }
+
+ /* check results: */
+ for (i = 0; i <N/2; i++)
+ {
+ if (tmp.c[i] != 6)
+ abort ();
+ }
+
+ /* aligned */
+ for (i = 0; i < N/2; i++)
+ {
+ tmp.d.k[i] = 7;
+ }
+
+ /* check results: */
+ for (i = 0; i <N/2; i++)
+ {
+ if (tmp.d.k[i] != 7)
+ abort ();
+ }
+
+ /* unaligned */
+ for (i = 0; i < N/2; i++)
+ {
+ tmp.e.k[i] = 8;
+ }
+
+ /* check results: */
+ for (i = 0; i <N/2; i++)
+ {
+ if (tmp.e.k[i] != 8)
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-34.c b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-34.c
new file mode 100644
index 00000000000..2eac33e414b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-34.c
@@ -0,0 +1,42 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 16
+
+struct {
+ char ca[N];
+} s;
+char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+
+__attribute__ ((noinline))
+int main1 ()
+{
+ int i;
+
+ for (i = 0; i < N; i++)
+ {
+ s.ca[i] = cb[i];
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (s.ca[i] != cb[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-36.c b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-36.c
new file mode 100644
index 00000000000..351463bb152
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-36.c
@@ -0,0 +1,48 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 16
+
+struct {
+ char ca[N];
+ char cb[N];
+} s;
+
+__attribute__ ((noinline))
+int main1 ()
+{
+ int i;
+
+ for (i = 0; i < N; i++)
+ {
+ s.cb[i] = 3*i;
+ }
+
+ for (i = 0; i < N; i++)
+ {
+ s.ca[i] = s.cb[i];
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (s.ca[i] != s.cb[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-64.c b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-64.c
new file mode 100644
index 00000000000..1ce3fa7f23b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-64.c
@@ -0,0 +1,88 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 16
+
+int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+int ia[N][4][N+1];
+int ic[N][N][3][13];
+int id[N][N][N];
+
+__attribute__ ((noinline))
+int main1 ()
+{
+ int i, j;
+
+ /* Multidimensional array. Not aligned: vectorizable. */
+ for (i = 0; i < N; i++)
+ {
+ for (j = 0; j < N; j++)
+ {
+ ia[i][1][j] = ib[i];
+ }
+ }
+
+ /* Multidimensional array. Aligned: vectorizable. */
+ for (i = 0; i < N; i++)
+ {
+ for (j = 0; j < N; j++)
+ {
+ ic[i][1][1][j] = ib[i];
+ }
+ }
+
+ /* Multidimensional array. Not aligned: vectorizable. */
+ for (i = 0; i < N; i++)
+ {
+ for (j = 0; j < N; j++)
+ {
+ id[i][1][j+1] = ib[i];
+ }
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ for (j = 0; j < N; j++)
+ {
+ if (ia[i][1][j] != ib[i])
+ abort();
+ }
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ for (j = 0; j < N; j++)
+ {
+ if (ic[i][1][1][j] != ib[i])
+ abort();
+ }
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ for (j = 0; j < N; j++)
+ {
+ if (id[i][1][j+1] != ib[i])
+ abort();
+ }
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-65.c b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-65.c
new file mode 100644
index 00000000000..b1e74a9f1de
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-65.c
@@ -0,0 +1,85 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 16
+#define M 4
+
+int ib[M][M][N] = {{{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
+ {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
+ {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
+ {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}},
+ {{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
+ {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
+ {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
+ {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}},
+ {{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
+ {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
+ {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
+ {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}},
+ {{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
+ {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
+ {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
+ {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}}};
+int ia[M][M][N];
+int ic[N];
+
+__attribute__ ((noinline))
+int main1 ()
+{
+ int i, j;
+
+ /* Multidimensional array. Aligned. The "inner" dimensions
+ are invariant in the inner loop. Load and store. */
+ for (i = 0; i < M; i++)
+ {
+ for (j = 0; j < N; j++)
+ {
+ ia[i][1][j] = ib[2][i][j];
+ }
+ }
+
+ /* check results: */
+ for (i = 0; i < M; i++)
+ {
+ for (j = 0; j < N; j++)
+ {
+ if (ia[i][1][j] != ib[2][i][j])
+ abort();
+ }
+ }
+
+ /* Multidimensional array. Aligned. The "inner" dimensions
+ are invariant in the inner loop. Load. */
+ for (i = 0; i < M; i++)
+ {
+ for (j = 0; j < N; j++)
+ {
+ ic[j] = ib[2][i][j];
+ }
+ }
+
+ /* check results: */
+ for (i = 0; i < M; i++)
+ {
+ for (j = 0; j < N; j++)
+ {
+ if (ic[j] != ib[2][i][j])
+ abort();
+ }
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-66.c b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-66.c
new file mode 100644
index 00000000000..2be14ea33b6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-66.c
@@ -0,0 +1,84 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 16
+
+int ib[6] = {0,3,6,9,12,15};
+int ia[8][5][6];
+int ic[16][16][5][6];
+
+__attribute__ ((noinline))
+int main1 ()
+{
+ int i, j;
+
+ /* Multidimensional array. Aligned. */
+ for (i = 0; i < 16; i++)
+ {
+ for (j = 0; j < 4; j++)
+ {
+ ia[2][6][j] = 5;
+ }
+ }
+
+ /* check results: */
+ for (i = 0; i < 16; i++)
+ {
+ for (j = 0; j < 4; j++)
+ {
+ if (ia[2][6][j] != 5)
+ abort();
+ }
+ }
+ /* Multidimensional array. Aligned. */
+ for (i = 0; i < 16; i++)
+ {
+ for (j = 0; j < 4; j++)
+ ia[3][6][j+2] = 5;
+ }
+
+ /* check results: */
+ for (i = 0; i < 16; i++)
+ {
+ for (j = 2; j < 6; j++)
+ {
+ if (ia[3][6][j] != 5)
+ abort();
+ }
+ }
+
+ /* Multidimensional array. Not aligned. */
+ for (i = 0; i < 16; i++)
+ {
+ for (j = 0; j < 4; j++)
+ {
+ ic[2][1][6][j+1] = 5;
+ }
+ }
+
+ /* check results: */
+ for (i = 0; i < 16; i++)
+ {
+ for (j = 0; j < 4; j++)
+ {
+ if (ic[2][1][6][j+1] != 5)
+ abort();
+ }
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-68.c b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-68.c
new file mode 100644
index 00000000000..de036e88ebf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-68.c
@@ -0,0 +1,92 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 32
+
+struct s{
+ int m;
+ int n[N][N][N];
+};
+
+struct test1{
+ struct s a; /* array a.n is unaligned */
+ int b;
+ int c;
+ struct s e; /* array e.n is aligned */
+};
+
+struct test1 tmp1;
+
+__attribute__ ((noinline))
+int main1 ()
+{
+ int i,j;
+
+ /* 1. unaligned */
+ for (i = 0; i < N; i++)
+ {
+ tmp1.a.n[1][2][i] = 5;
+ }
+
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (tmp1.a.n[1][2][i] != 5)
+ abort ();
+ }
+
+ /* 2. aligned */
+ for (i = 3; i < N-1; i++)
+ {
+ tmp1.a.n[1][2][i] = 6;
+ }
+
+ /* check results: */
+ for (i = 3; i < N-1; i++)
+ {
+ if (tmp1.a.n[1][2][i] != 6)
+ abort ();
+ }
+
+ /* 3. aligned */
+ for (i = 0; i < N; i++)
+ {
+ tmp1.e.n[1][2][i] = 7;
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (tmp1.e.n[1][2][i] != 7)
+ abort ();
+ }
+
+ /* 4. unaligned */
+ for (i = 3; i < N-3; i++)
+ {
+ tmp1.e.n[1][2][i] = 8;
+ }
+
+ /* check results: */
+ for (i = 3; i <N-3; i++)
+ {
+ if (tmp1.e.n[1][2][i] != 8)
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-25.c b/gcc/testsuite/gcc.dg/vect/slp-25.c
index 21f1900dc20..0b62a29bf68 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-25.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-25.c
@@ -7,11 +7,12 @@
/* Unaligned stores. */
+int ia[N+1];
+short sa[N+1];
+
int main1 (int n)
{
int i;
- int ia[N+1];
- short sa[N+1];
for (i = 1; i <= N/2; i++)
{
diff --git a/gcc/testsuite/gcc.dg/vect/vect-13.c b/gcc/testsuite/gcc.dg/vect/vect-13.c
index 5cbec8753ad..ba8665bdc07 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-13.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-13.c
@@ -7,12 +7,12 @@
int a[N];
int results[N] = {0,1,2,3,0,0,0,0,0,0,0,0,12,13,14,15};
+int b[N] = {0,1,2,3,-4,-5,-6,-7,-8,-9,-10,-11,12,13,14,15};
__attribute__ ((noinline))
int main1()
{
int i;
- int b[N] = {0,1,2,3,-4,-5,-6,-7,-8,-9,-10,-11,12,13,14,15};
/* Max pattern. */
for (i = 0; i < N; i++)
diff --git a/gcc/testsuite/gcc.dg/vect/vect-17.c b/gcc/testsuite/gcc.dg/vect/vect-17.c
index 57c72413e1b..f1bef7f49f2 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-17.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-17.c
@@ -5,10 +5,6 @@
#define N 64
-__attribute__ ((noinline)) int
-main1 ()
-{
- int i;
int ia[N];
int ib[N]=
{1,1,0,0,1,0,1,0,
@@ -72,6 +68,10 @@ main1 ()
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
+__attribute__ ((noinline)) int
+main1 ()
+{
+ int i;
/* Check ints. */
for (i = 0; i < N; i++)
diff --git a/gcc/testsuite/gcc.dg/vect/vect-18.c b/gcc/testsuite/gcc.dg/vect/vect-18.c
index caf6952c3bb..8a2baab3a8e 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-18.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-18.c
@@ -5,10 +5,6 @@
#define N 64
-__attribute__ ((noinline)) int
-main1 ()
-{
- int i;
int ia[N];
int ib[N]=
{1,1,0,0,1,0,1,0,
@@ -71,6 +67,10 @@ main1 ()
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
+__attribute__ ((noinline)) int
+main1 ()
+{
+ int i;
/* Check ints. */
for (i = 0; i < N; i++)
diff --git a/gcc/testsuite/gcc.dg/vect/vect-19.c b/gcc/testsuite/gcc.dg/vect/vect-19.c
index 6a2df60aef0..022ba1f7565 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-19.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-19.c
@@ -5,10 +5,6 @@
#define N 64
-__attribute__ ((noinline)) int
-main1 ()
-{
- int i;
int ia[N];
int ib[N]=
{1,1,0,0,1,0,1,0,
@@ -71,6 +67,10 @@ main1 ()
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
+__attribute__ ((noinline)) int
+main1 ()
+{
+ int i;
/* Check ints. */
for (i = 0; i < N; i++)
diff --git a/gcc/testsuite/gcc.dg/vect/vect-2.c b/gcc/testsuite/gcc.dg/vect/vect-2.c
index 21daf79b379..5d4fc914a97 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-2.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-2.c
@@ -5,11 +5,12 @@
#define N 16
+char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+char ca[N];
+
__attribute__ ((noinline))
int main1 ()
{
- char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
- char ca[N];
int i;
for (i = 0; i < N; i++)
diff --git a/gcc/testsuite/gcc.dg/vect/vect-20.c b/gcc/testsuite/gcc.dg/vect/vect-20.c
index 33479b170c0..deed2da4472 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-20.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-20.c
@@ -5,10 +5,6 @@
#define N 64
-__attribute__ ((noinline)) int
-main1 ()
-{
- int i;
int ia[N];
int ib[N]=
{1,1,0,0,1,0,1,0,
@@ -42,6 +38,10 @@ main1 ()
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
+__attribute__ ((noinline)) int
+main1 ()
+{
+ int i;
/* Check ints. */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-21.c b/gcc/testsuite/gcc.dg/vect/vect-21.c
index d0d9c2c6df3..7a57506a208 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-21.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-21.c
@@ -5,10 +5,6 @@
#define N 64
-__attribute__ ((noinline)) int
-main1 ()
-{
- int i;
int ia[N];
int ib[N]=
{1,1,0,0,1,0,1,0,
@@ -71,6 +67,10 @@ main1 ()
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
+__attribute__ ((noinline)) int
+main1 ()
+{
+ int i;
/* Check ints. */
for (i = 0; i < N; i++)
diff --git a/gcc/testsuite/gcc.dg/vect/vect-22.c b/gcc/testsuite/gcc.dg/vect/vect-22.c
index c7fe6bf59e9..369fab112e5 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-22.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-22.c
@@ -6,10 +6,6 @@
#define N 64
-__attribute__ ((noinline)) int
-main1 ()
-{
- int i;
int ia[N];
int ib[N]=
{1,1,0,0,1,0,1,0,
@@ -54,6 +50,10 @@ main1 ()
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
+__attribute__ ((noinline)) int
+main1 ()
+{
+ int i;
/* Check ints. */
for (i = 0; i < N; i++)
diff --git a/gcc/testsuite/gcc.dg/vect/vect-27.c b/gcc/testsuite/gcc.dg/vect/vect-27.c
index 376d6d49425..4a2da227e3c 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-27.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-27.c
@@ -7,12 +7,13 @@
/* unaligned load. */
+int ia[N];
+int ib[N+1];
+
__attribute__ ((noinline))
int main1 ()
{
int i;
- int ia[N];
- int ib[N+1];
for (i=0; i <= N; i++)
{
diff --git a/gcc/testsuite/gcc.dg/vect/vect-29.c b/gcc/testsuite/gcc.dg/vect/vect-29.c
index ac12c8225db..0ad28488056 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-29.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-29.c
@@ -8,12 +8,13 @@
/* unaligned load. */
+int ia[N];
+int ib[N+OFF];
+
__attribute__ ((noinline))
int main1 (int off)
{
int i;
- int ia[N];
- int ib[N+OFF];
for (i = 0; i < N+OFF; i++)
{
diff --git a/gcc/testsuite/gcc.dg/vect/vect-3.c b/gcc/testsuite/gcc.dg/vect/vect-3.c
index 026c2a4cbae..d494deb8507 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-3.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-3.c
@@ -6,18 +6,19 @@
#define N 20
+float a[N];
+float e[N];
+float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
+float d[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
+int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+int ia[N];
+
__attribute__ ((noinline)) int
main1 ()
{
int i;
- float a[N];
- float e[N];
- float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
- float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
- float d[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
- int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
- int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
- int ia[N];
for (i = 0; i < N; i++)
{
diff --git a/gcc/testsuite/gcc.dg/vect/vect-31.c b/gcc/testsuite/gcc.dg/vect/vect-31.c
index 67bb0de68b8..8719fc9d27e 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-31.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-31.c
@@ -87,6 +87,4 @@ int main (void)
}
/* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-34.c b/gcc/testsuite/gcc.dg/vect/vect-34.c
index 7dc176bcfef..4e80bd4cbf2 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-34.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-34.c
@@ -8,11 +8,11 @@
__attribute__ ((noinline))
int main1 ()
{
+ int i;
struct {
char ca[N];
} s;
char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
- int i;
for (i = 0; i < N; i++)
{
@@ -37,5 +37,4 @@ int main (void)
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-36.c b/gcc/testsuite/gcc.dg/vect/vect-36.c
index 65a1d30a7a2..bc6232dd111 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-36.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-36.c
@@ -8,11 +8,12 @@
__attribute__ ((noinline))
int main1 ()
{
+ int i;
struct {
char ca[N];
char cb[N];
} s;
- int i;
+
for (i = 0; i < N; i++)
{
@@ -42,6 +43,4 @@ int main (void)
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-4.c b/gcc/testsuite/gcc.dg/vect/vect-4.c
index 17ae2879f54..d86fea11e79 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-4.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-4.c
@@ -5,13 +5,14 @@
#define N 20
+float a[N];
+float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
+float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
+
__attribute__ ((noinline)) int
main1 ()
{
int i;
- float a[N];
- float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
- float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
for (i = 0; i < N; i++)
{
diff --git a/gcc/testsuite/gcc.dg/vect/vect-5.c b/gcc/testsuite/gcc.dg/vect/vect-5.c
index 291a05ee129..b5938ceae8d 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-5.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-5.c
@@ -5,13 +5,14 @@
#define N 16
+float a[N];
+float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
+float d[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
+
__attribute__ ((noinline))
int main1 ()
{
int i, j;
- float a[N];
- float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
- float d[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
i = 0;
j = 0;
diff --git a/gcc/testsuite/gcc.dg/vect/vect-6.c b/gcc/testsuite/gcc.dg/vect/vect-6.c
index 7ad5192d71e..5f2e0ea5936 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-6.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-6.c
@@ -7,15 +7,15 @@
float results1[N] = {192.00,240.00,288.00,336.00,384.00,432.00,480.00,528.00,0.00};
float results2[N] = {0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,54.00,120.00,198.00,288.00,390.00,504.00,630.00};
+float a[N] = {0};
+float e[N] = {0};
+float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
__attribute__ ((noinline))
int main1 ()
{
int i;
- float a[N] = {0};
- float e[N] = {0};
- float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
- float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
for (i = 0; i < N/2; i++)
{
diff --git a/gcc/testsuite/gcc.dg/vect/vect-64.c b/gcc/testsuite/gcc.dg/vect/vect-64.c
index e3d68555307..4f9d97bbb2b 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-64.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-64.c
@@ -5,11 +5,12 @@
#define N 16
+int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+
__attribute__ ((noinline))
int main1 ()
{
int i, j;
- int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int ia[N][4][N+1];
int ic[N][N][3][13];
int id[N][N][N];
@@ -82,6 +83,4 @@ int main (void)
}
/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-65.c b/gcc/testsuite/gcc.dg/vect/vect-65.c
index 614b8f75a8e..ba3ab3a9b15 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-65.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-65.c
@@ -80,5 +80,4 @@ int main (void)
}
/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-66.c b/gcc/testsuite/gcc.dg/vect/vect-66.c
index 6d37d05bc46..4f93bc05d67 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-66.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-66.c
@@ -78,6 +78,4 @@ int main (void)
}
/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-68.c b/gcc/testsuite/gcc.dg/vect/vect-68.c
index 511de7bc422..c4f8857ba8a 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-68.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-68.c
@@ -86,6 +86,4 @@ int main (void)
}
/* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-7.c b/gcc/testsuite/gcc.dg/vect/vect-7.c
index 3b31a629519..35dc08bbd2c 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-7.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-7.c
@@ -5,12 +5,13 @@
#define N 128
+short sa[N];
+short sb[N];
+
__attribute__ ((noinline))
int main1 ()
{
int i;
- short sa[N];
- short sb[N];
for (i = 0; i < N; i++)
{
diff --git a/gcc/testsuite/gcc.dg/vect/vect-72.c b/gcc/testsuite/gcc.dg/vect/vect-72.c
index 3d678a8c58c..95bc7caede0 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-72.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-72.c
@@ -7,12 +7,13 @@
/* unaligned load. */
+char ia[N];
+char ib[N+1];
+
__attribute__ ((noinline))
int main1 ()
{
int i;
- char ia[N];
- char ib[N+1];
for (i=0; i < N+1; i++)
{
diff --git a/gcc/testsuite/gcc.dg/vect/vect-73.c b/gcc/testsuite/gcc.dg/vect/vect-73.c
index a19d1984563..ee3c6e60e15 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-73.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-73.c
@@ -6,6 +6,7 @@
#define N 16
int ic[N*2];
+int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
#define ia (ic+N)
@@ -13,7 +14,6 @@ __attribute__ ((noinline))
int main1 ()
{
int i, j;
- int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
for (i = 0; i < N; i++)
{
diff --git a/gcc/testsuite/gcc.dg/vect/vect-76.c b/gcc/testsuite/gcc.dg/vect/vect-76.c
index 1902f0c648d..908ccd249c3 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-76.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-76.c
@@ -71,5 +71,4 @@ int main (void)
/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail vect_no_align } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-77-alignchecks.c b/gcc/testsuite/gcc.dg/vect/vect-77-alignchecks.c
new file mode 100644
index 00000000000..a3d1b4cd6e9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-77-alignchecks.c
@@ -0,0 +1,56 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 8
+#define OFF 8
+
+/* Check handling of accesses for which the "initial condition" -
+ the expression that represents the first location accessed - is
+ more involved than just an ssa_name. */
+
+int ib[N+OFF] __attribute__ ((__aligned__(16))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10, 14, 22, 26, 34};
+
+__attribute__ ((noinline))
+int main1 (int *ib, int off)
+{
+ int i;
+ int ia[N];
+
+ for (i = 0; i < N; i++)
+ {
+ ia[i] = ib[i+off];
+ }
+
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (ia[i] != ib[i+off])
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ main1 (ib, 8);
+ return 0;
+}
+
+/* For targets that don't support misaligned loads we version for the load.
+ The store is aligned if alignment can be forced on the stack. Otherwise, we need to
+ peel the loop in order to align the store. For targets that can't align variables
+ using peeling (don't guarantee natural alignment) versioning the loop is required
+ both for the load and the store. */
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { vect_no_align } } } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { {! vect_no_align} && { unaligned_stack && vector_alignment_reachable } } } } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 1 "vect" { target { { {! unaligned_stack} && vect_no_align } || {unaligned_stack && { {! vector_alignment_reachable} && {! vect_no_align} } } } } } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 2 "vect" { target { { unaligned_stack && { vector_alignment_reachable && vect_no_align } } || {unaligned_stack && { {! vector_alignment_reachable} && vect_no_align } } } } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-77-global.c b/gcc/testsuite/gcc.dg/vect/vect-77-global.c
new file mode 100644
index 00000000000..38f1443bb39
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-77-global.c
@@ -0,0 +1,53 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 8
+#define OFF 8
+
+/* Check handling of accesses for which the "initial condition" -
+ the expression that represents the first location accessed - is
+ more involved than just an ssa_name. */
+
+int ib[N+OFF] __attribute__ ((__aligned__(16))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10, 14, 22, 26, 34};
+int ia[N];
+
+__attribute__ ((noinline))
+int main1 (int *ib, int off)
+{
+ int i;
+
+ for (i = 0; i < N; i++)
+ {
+ ia[i] = ib[i+off];
+ }
+
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (ia[i] != ib[i+off])
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ main1 (ib, 8);
+ return 0;
+}
+
+/* For targets that don't support misaligned loads we version for the load.
+ (The store is aligned). */
+/* Requires versioning for aliasing. */
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { vect_no_align } } } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 1 "vect" { target vect_no_align } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-77.c b/gcc/testsuite/gcc.dg/vect/vect-77.c
index d443804133c..a6eb2ad8f23 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-77.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-77.c
@@ -42,11 +42,5 @@ int main (void)
return 0;
}
-/* For targets that don't support misaligned loads we version for the load.
- (The store is aligned). */
-
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { vect_no_align } } } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 1 "vect" { target vect_no_align } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-78-alignchecks.c b/gcc/testsuite/gcc.dg/vect/vect-78-alignchecks.c
new file mode 100644
index 00000000000..5c97b410962
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-78-alignchecks.c
@@ -0,0 +1,57 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 8
+#define OFF 8
+
+/* Check handling of accesses for which the "initial condition" -
+ the expression that represents the first location accessed - is
+ more involved than just an ssa_name. */
+
+int ib[N+OFF] __attribute__ ((__aligned__(16))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10, 14, 22, 26, 34};
+int off = 8;
+
+__attribute__ ((noinline))
+int main1 (int *ib)
+{
+ int i;
+ int ia[N];
+
+ for (i = 0; i < N; i++)
+ {
+ ia[i] = ib[i+off];
+ }
+
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (ia[i] != ib[i+off])
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ main1 (ib);
+ return 0;
+}
+
+/* For targets that don't support misaligned loads we version for the load.
+ The store is aligned if alignment can be forced on the stack. Otherwise, we need to
+ peel the loop in order to align the store. For targets that can't align variables
+ using peeling (don't guarantee natural alignment) versioning the loop is required
+ both for the load and the store. */
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { vect_no_align } } } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { {! vect_no_align} && { unaligned_stack && vector_alignment_reachable } } } } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 1 "vect" { target { { {! unaligned_stack} && vect_no_align } || {unaligned_stack && { {! vector_alignment_reachable} && {! vect_no_align} } } } } } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 2 "vect" { target { { unaligned_stack && { vector_alignment_reachable && vect_no_align } } || {unaligned_stack && { {! vector_alignment_reachable} && vect_no_align } } } } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-78-global.c b/gcc/testsuite/gcc.dg/vect/vect-78-global.c
new file mode 100644
index 00000000000..dccc83903da
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-78-global.c
@@ -0,0 +1,53 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 8
+#define OFF 8
+
+/* Check handling of accesses for which the "initial condition" -
+ the expression that represents the first location accessed - is
+ more involved than just an ssa_name. */
+
+int ia[N];
+int ib[N+OFF] __attribute__ ((__aligned__(16))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10, 14, 22, 26, 34};
+int off = 8;
+
+__attribute__ ((noinline))
+int main1 (int *ib)
+{
+ int i;
+
+ for (i = 0; i < N; i++)
+ {
+ ia[i] = ib[i+off];
+ }
+
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (ia[i] != ib[i+off])
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ main1 (ib);
+ return 0;
+}
+
+/* For targets that don't support misaligned loads we version for the load.
+ (The store is aligned). */
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { vect_no_align } } } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 1 "vect" { target vect_no_align } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-78.c b/gcc/testsuite/gcc.dg/vect/vect-78.c
index bcf88581688..67ce20fda1b 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-78.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-78.c
@@ -24,7 +24,6 @@ int main1 (int *ib)
ia[i] = ib[i+off];
}
-
/* check results: */
for (i = 0; i < N; i++)
{
@@ -43,11 +42,5 @@ int main (void)
return 0;
}
-/* For targets that don't support misaligned loads we version for the load.
- (The store is aligned). */
-
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { vect_no_align } } } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 1 "vect" { target vect_no_align } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-86.c b/gcc/testsuite/gcc.dg/vect/vect-86.c
index a1183b55ecd..334e54ee46d 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-86.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-86.c
@@ -5,11 +5,13 @@
#define N 16
+int a[N];
+
__attribute__ ((noinline))
int main1 (int n)
{
int i, j, k;
- int a[N], b[N];
+ int b[N];
for (i = 0; i < n; i++)
{
diff --git a/gcc/testsuite/gcc.dg/vect/vect-all.c b/gcc/testsuite/gcc.dg/vect/vect-all.c
index 29bd3ea2f6e..6adb7bf88bd 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-all.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-all.c
@@ -65,6 +65,17 @@ fbar2 (float *a)
fcheck_results (a, fresults2);
}
+float a[N];
+float e[N];
+float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
+float d[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
+int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+int ia[N];
+char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+char ca[N];
+short sa[N];
/* All of the loops below are currently vectorizable. */
@@ -72,17 +83,6 @@ __attribute__ ((noinline)) int
main1 ()
{
int i,j;
- float a[N];
- float e[N];
- float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
- float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
- float d[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
- int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
- int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
- int ia[N];
- char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
- char ca[N];
- short sa[N];
/* Test 1: copy chars. */
for (i = 0; i < N; i++)
diff --git a/gcc/testsuite/gcc.dg/vect/vect.exp b/gcc/testsuite/gcc.dg/vect/vect.exp
index e58f5809d09..ad7683381fc 100644
--- a/gcc/testsuite/gcc.dg/vect/vect.exp
+++ b/gcc/testsuite/gcc.dg/vect/vect.exp
@@ -109,7 +109,7 @@ lappend DEFAULT_VECTCFLAGS "-O2"
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/nodump-*.\[cS\]]] \
"" $DEFAULT_VECTCFLAGS
-lappend DEFAULT_VECTCFLAGS "-fdump-tree-vect-details"
+lappend DEFAULT_VECTCFLAGS "-fdump-tree-vect-details"
# Main loop.
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/pr*.\[cS\]]] \
diff --git a/gcc/testsuite/gcc.dg/vect/wrapv-vect-7.c b/gcc/testsuite/gcc.dg/vect/wrapv-vect-7.c
index ffc5eaca5ca..5d495440f36 100644
--- a/gcc/testsuite/gcc.dg/vect/wrapv-vect-7.c
+++ b/gcc/testsuite/gcc.dg/vect/wrapv-vect-7.c
@@ -5,11 +5,12 @@
#define N 128
+short sa[N];
+short sb[N];
+
int main1 ()
{
int i;
- short sa[N];
- short sb[N];
for (i = 0; i < N; i++)
{
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index e4e9c589e2f..5fe2059dc1e 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2109,6 +2109,27 @@ proc check_effective_target_vect_unpack { } {
return $et_vect_unpack_saved
}
+# Return 1 if the target plus current options does not guarantee
+# that its STACK_BOUNDARY is >= the reguired vector alignment.
+#
+# This won't change for different subtargets so cache the result.
+
+proc check_effective_target_unaligned_stack { } {
+ global et_unaligned_stack_saved
+
+ if [info exists et_unaligned_stack_saved] {
+ verbose "check_effective_target_unaligned_stack: using cached result" 2
+ } else {
+ set et_unaligned_stack_saved 0
+ if { ( [istarget i?86-*-*] || [istarget x86_64-*-*] )
+ && (! [istarget *-*-darwin*] ) } {
+ set et_unaligned_stack_saved 1
+ }
+ }
+ verbose "check_effective_target_unaligned_stack: returning $et_unaligned_stack_saved" 2
+ return $et_unaligned_stack_saved
+}
+
# Return 1 if the target plus current options does not support a vector
# alignment mechanism, 0 otherwise.
#
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index 29acfac5289..43b51a7da19 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -1606,12 +1606,9 @@ vect_can_force_dr_alignment_p (const_tree decl, unsigned int alignment)
if (TREE_STATIC (decl))
return (alignment <= MAX_OFILE_ALIGNMENT);
else
- /* This is not 100% correct. The absolute correct stack alignment
- is STACK_BOUNDARY. We're supposed to hope, but not assume, that
- PREFERRED_STACK_BOUNDARY is honored by all translation units.
- However, until someone implements forced stack alignment, SSE
- isn't really usable without this. */
- return (alignment <= PREFERRED_STACK_BOUNDARY);
+ /* This used to be PREFERRED_STACK_BOUNDARY, however, that is not 100%
+ correct until someone implements forced stack alignment. */
+ return (alignment <= STACK_BOUNDARY);
}