+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
+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
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++)
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++)
--- /dev/null
+/* { 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" } } */
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" } } */
--- /dev/null
+/* { 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" } } */
--- /dev/null
+/* { 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" } } */
--- /dev/null
+/* { 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" } } */
--- /dev/null
+/* { 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" } } */
--- /dev/null
+/* { 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" } } */
--- /dev/null
+/* { 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" } } */
--- /dev/null
+/* { 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" } } */
/* 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++)
{
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++)
#define N 64
-__attribute__ ((noinline)) int
-main1 ()
-{
- int i;
int ia[N];
int ib[N]=
{1,1,0,0,1,0,1,0,
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++)
#define N 64
-__attribute__ ((noinline)) int
-main1 ()
-{
- int i;
int ia[N];
int ib[N]=
{1,1,0,0,1,0,1,0,
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++)
#define N 64
-__attribute__ ((noinline)) int
-main1 ()
-{
- int i;
int ia[N];
int ib[N]=
{1,1,0,0,1,0,1,0,
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++)
#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++)
#define N 64
-__attribute__ ((noinline)) int
-main1 ()
-{
- int i;
int ia[N];
int ib[N]=
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
+__attribute__ ((noinline)) int
+main1 ()
+{
+ int i;
/* Check ints. */
#define N 64
-__attribute__ ((noinline)) int
-main1 ()
-{
- int i;
int ia[N];
int ib[N]=
{1,1,0,0,1,0,1,0,
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++)
#define N 64
-__attribute__ ((noinline)) int
-main1 ()
-{
- int i;
int ia[N];
int ib[N]=
{1,1,0,0,1,0,1,0,
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++)
/* 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++)
{
/* 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++)
{
#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++)
{
}
/* { 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" } } */
__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++)
{
}
/* { 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" } } */
__attribute__ ((noinline))
int main1 ()
{
+ int i;
struct {
char ca[N];
char cb[N];
} s;
- int i;
+
for (i = 0; i < N; i++)
{
}
/* { 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" } } */
#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++)
{
#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;
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++)
{
#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];
}
/* { 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" } } */
}
/* { 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" } } */
}
/* { 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" } } */
}
/* { 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" } } */
#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++)
{
/* 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++)
{
#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)
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++)
{
/* { 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" } } */
--- /dev/null
+/* { 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" } } */
--- /dev/null
+/* { 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" } } */
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" } } */
--- /dev/null
+/* { 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" } } */
--- /dev/null
+/* { 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" } } */
ia[i] = ib[i+off];
}
-
/* check results: */
for (i = 0; i < N; i++)
{
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" } } */
#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++)
{
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. */
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++)
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\]]] \
#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++)
{
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.
#
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);
}