Commit 1c95fbad by Dorit Nuzman Committed by Dorit Nuzman

vect-40.c: Remove pointers to "aligned types".

        * gcc.dg/vect/vect-40.c: Remove pointers to "aligned types".
        Use pointers to local alignable arrays instead. Added comments.
        * gcc.dg/vect/vect-46.c: Likewise.
        * gcc.dg/vect/vect-48.c: Likewise.
        * gcc.dg/vect/vect-49.c: Likewise.
        * gcc.dg/vect/vect-52.c: Likewise.
        * gcc.dg/vect/vect-53.c: Likewise.
        * gcc.dg/vect/vect-54.c: Likewise.
        * gcc.dg/vect/vect-56.c: Likewise.
        * gcc.dg/vect/vect-57.c: Likewise.
        * gcc.dg/vect/vect-58.c: Likewise.
        * gcc.dg/vect/vect-60.c: Likewise.
        * gcc.dg/vect/vect-61.c: Likewise.

        * gcc.dg/vect/vect-42.c: Remove pointers to "aligned types".
        The test is no longer vectorizable on vect_no_align targets.
        * gcc.dg/vect/vect-43.c: Likewsie.

        * gcc.dg/vect/vect-44.c: Added comments.
        * gcc.dg/vect/vect-45.c: Added comments.
        * gcc.dg/vect/vect-50.c: Added comments.
        * gcc.dg/vect/vect-51.c: Added comments.

        * gcc.dg/vect/vect-95.c: Use aligned arrays instead of arrays to
        aligned type.
        * gcc.dg/vect/Os-vect-95.c: Likewise.

        * gcc.dg/vect/vect-41.c: Test removed.
        * gcc.dg/vect/vect-47.c: Test removed.
        * gcc.dg/vect/vect-55.c: Test removed.
        * gcc.dg/vect/vect-59.c: Test removed.

From-SVN: r104448
parent 39278c14
2005-09-20 Dorit Nuzman <dorit@il.ibm.com>
* gcc.dg/vect/vect-40.c: Remove pointers to "aligned types".
Use pointers to local alignable arrays instead. Added comments.
* gcc.dg/vect/vect-46.c: Likewise.
* gcc.dg/vect/vect-48.c: Likewise.
* gcc.dg/vect/vect-49.c: Likewise.
* gcc.dg/vect/vect-52.c: Likewise.
* gcc.dg/vect/vect-53.c: Likewise.
* gcc.dg/vect/vect-54.c: Likewise.
* gcc.dg/vect/vect-56.c: Likewise.
* gcc.dg/vect/vect-57.c: Likewise.
* gcc.dg/vect/vect-58.c: Likewise.
* gcc.dg/vect/vect-60.c: Likewise.
* gcc.dg/vect/vect-61.c: Likewise.
* gcc.dg/vect/vect-42.c: Remove pointers to "aligned types".
The test is no longer vectorizable on vect_no_align targets.
* gcc.dg/vect/vect-43.c: Likewsie.
* gcc.dg/vect/vect-44.c: Added comments.
* gcc.dg/vect/vect-45.c: Added comments.
* gcc.dg/vect/vect-50.c: Added comments.
* gcc.dg/vect/vect-51.c: Added comments.
* gcc.dg/vect/vect-95.c: Use aligned arrays instead of arrays to
aligned type.
* gcc.dg/vect/Os-vect-95.c: Likewise.
* gcc.dg/vect/vect-41.c: Test removed.
* gcc.dg/vect/vect-47.c: Test removed.
* gcc.dg/vect/vect-55.c: Test removed.
* gcc.dg/vect/vect-59.c: Test removed.
2005-09-20 Dorit Nuzman <dorit@il.ibm.com>
* gcc.dg/vect/pr16105.c: Replace "aligned types" with regular types.
No longer vectorizable on vect_no_align targets.
......@@ -5,8 +5,6 @@
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (float *pd, float *pa, float *pb, float *pc)
{
int i;
......@@ -43,8 +41,8 @@ main1 (int n, float * __restrict__ pd, float * __restrict__ pa, float * __restri
int main (void)
{
int i;
afloat a[N];
afloat d[N+1];
float a[N] __attribute__ ((__aligned__(16)));
float d[N+1] __attribute__ ((__aligned__(16)));
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};
......
......@@ -5,9 +5,7 @@
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (afloat *pa, afloat *pb, afloat *pc)
void bar (float *pa, float *pb, float *pc)
{
int i;
......@@ -21,31 +19,37 @@ void bar (afloat *pa, afloat *pb, afloat *pc)
return;
}
/* Aligned pointer accesses.
The loop bound is known and divisible by the vectorization factor.
No aliasing problems.
vect-46.c is similar to this one with one difference:
the loop bound is unknown. */
int
main1 (afloat * __restrict__ pa, afloat * __restrict__ pb, afloat * __restrict__ pc)
main1 ()
{
int i;
float a[N] __attribute__ ((__aligned__(16)));
float b[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 c[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 *pa = a;
float *pb = b;
float *pc = c;
for (i = 0; i < N; i++)
{
pa[i] = pb[i] * pc[i];
}
bar (pa,pb,pc);
return 0;
}
int main (void)
{
int i;
float a[N] __attribute__ ((__aligned__(16)));
float b[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 c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (a,b,c);
bar (a,b,c);
main1 ();
return 0;
}
......
/* { dg-require-effective-target vect_float } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (afloat *pa, afloat *pb, afloat *pc)
{
int i;
/* check results: */
for (i = 0; i < N; i++)
{
if (pa[i] != (pb[i] * pc[i]))
abort ();
}
return;
}
int
main1 (afloat * pa, afloat * pb, afloat * pc)
{
int i;
for (i = 0; i < N; i++)
{
pa[i] = pb[i] * pc[i];
}
bar (pa,pb,pc);
return 0;
}
int main (void)
{
int i;
float a[N] __attribute__ ((__aligned__(16)));
float b[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 c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (a,b,c);
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */
/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
......@@ -5,9 +5,7 @@
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (afloat *pa, afloat *pb, afloat *pc)
void bar (float *pa, float *pb, float *pc)
{
int i;
......@@ -21,15 +19,19 @@ void bar (afloat *pa, afloat *pb, afloat *pc)
return;
}
/* Unaligned write access, aligned read accesses.
Since we are handling an unaligned store by peeling the loop,
the loads will become unaligned.
The loop bound is known and divisible by the vectorization factor.
No aliasing problems. */
int
main1 (afloat * __restrict__ pa)
main1 (float * __restrict__ pa)
{
int i;
float pb[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 pc[N] __attribute__ ((__aligned__(16))) = {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++)
{
pa[i] = pb[i] * pc[i];
......@@ -52,6 +54,7 @@ int main (void)
return 0;
}
/* { 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 "vectorized 1 loops" 1 "vect" { xfail vect_no_align } } } */
/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail vect_no_align } } } */
/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_no_align } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
......@@ -5,9 +5,7 @@
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (afloat *pa, afloat *pb, afloat *pc)
void bar (float *pa, float *pb, float *pc)
{
int i;
......@@ -23,7 +21,7 @@ void bar (afloat *pa, afloat *pb, afloat *pc)
int
main1 (afloat * pa)
main1 (float *pa)
{
int i;
float pb[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
......@@ -41,11 +39,11 @@ main1 (afloat * pa)
}
int
main2 (afloat * pa)
main2 (float * pa)
{
int i;
afloat pb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
afloat pc[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
float pb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
float pc[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
/* Vectorizable: pb and pc addresses do not escape. */
for (i = 0; i < N; i++)
......@@ -67,8 +65,6 @@ int main (void)
{
int i;
float a[N] __attribute__ ((__aligned__(16)));
float b[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 c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
......@@ -77,6 +73,5 @@ int main (void)
return 0;
}
/* { 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 "vectorized 1 loops" 1 "vect" { xfail vect_no_align } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
......@@ -19,6 +19,14 @@ void bar (float *pa, float *pb, float *pc)
return;
}
/* Unaligned pointer accesses, with unknown alignment.
The loop bound is known and divisible by the vectorization factor.
No aliasing problems.
vect-50.c is similar to this one with one difference:
the loop bound is unknown.
vect-45.c is similar to this one with one difference:
can't prove that pointers don't alias. */
int
main1 (float * __restrict__ pa, float * __restrict__ pb, float * __restrict__ pc)
{
......
......@@ -5,7 +5,6 @@
#define N 256
void bar (const float *pa, const float *pb, const float *pc)
{
int i;
......@@ -20,6 +19,13 @@ void bar (const float *pa, const float *pb, const float *pc)
return;
}
/* Unaligned pointer accesses, with unknown alignment.
The loop bound is known and divisible by the vectorization factor.
Can't prove that the pointers don't alias.
vect-51.c is similar to this one with one difference:
the loop bound is unknown.
vect-44.c is similar to this one with one difference:
Aliasing is not a problem. */
int
main1 (float *pa, float *pb, float *pc)
......
......@@ -5,9 +5,7 @@
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (afloat *pa, afloat *pb, afloat *pc)
void bar (float *pa, float *pb, float *pc)
{
int i;
......@@ -21,17 +19,28 @@ void bar (afloat *pa, afloat *pb, afloat *pc)
return;
}
/* Aligned pointer accesses.
The loop bound is unknown.
No aliasing problems.
vect-40.c is similar to this one with one difference:
the loop bound is known. */
int
main1 (int n , afloat * __restrict__ pa, afloat * __restrict__ pb, afloat * __restrict__ pc)
main1 (int n)
{
int i;
float a[N] __attribute__ ((__aligned__(16))); float b[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 c[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 *pa = a;
float *pb = b;
float *pc = c;
for (i = 0; i < n; i++)
{
pa[i] = pb[i] * pc[i];
}
bar (pa,pb,pc);
return 0;
}
......@@ -39,14 +48,8 @@ int main (void)
{
int i;
int n=N;
float a[N] __attribute__ ((__aligned__(16)));
float b[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 c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (n,a,b,c);
bar (a,b,c);
main1 (n);
return 0;
}
......
/* { dg-require-effective-target vect_float } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (afloat *pa, afloat *pb, afloat *pc)
{
int i;
/* check results: */
for (i = 0; i < N; i++)
{
if (pa[i] != (pb[i] * pc[i]))
abort ();
}
return;
}
int
main1 (int n , afloat * pa, afloat * pb, afloat * pc)
{
int i;
for (i = 0; i < n; i++)
{
pa[i] = pb[i] * pc[i];
}
bar (pa,pb,pc);
return 0;
}
int main (void)
{
int i;
int n=N;
float a[N] __attribute__ ((__aligned__(16)));
float b[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 c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (n,a,b,c);
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */
/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
......@@ -5,49 +5,47 @@
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
/* Unaligned pointer read accesses, aligned write access.
The loop bound is known and divisible by the vectorization factor.
No aliasing problems.
vect-56.c is similar to this one with one difference:
the alignment of the read accesses is known.
vect-52.c is similar to this one with one difference:
the loop bound is unknown.
vect-49.c is similar to this one with one difference:
aliasing is a problem. */
void bar (float *pa, float *pb, float *pc)
int
main1 (float *pb, float *pc)
{
float pa[N] __attribute__ ((__aligned__(16)));
int i;
/* check results: */
for (i = 0; i < N; i++)
{
if (pa[i] != (pb[i] * pc[i]))
abort ();
pa[i] = pb[i] * pc[i];
}
return;
}
int
main1 (afloat * __restrict__ pa, float * __restrict__ pb, float * __restrict__ pc)
{
int i;
/* check results: */
for (i = 0; i < N; i++)
{
pa[i] = pb[i] * pc[i];
if (pa[i] != (pb[i] * pc[i]))
abort ();
}
bar (pa,pb,pc);
return 0;
}
int main (void)
{
int i;
float a[N] __attribute__ ((__aligned__(16)));
float b[N+1] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60};
float c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (a,b,c);
main1 (a,&b[1],c);
main1 (b,c);
main1 (&b[1],c);
return 0;
}
......
......@@ -5,9 +5,7 @@
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (const float *pa, const float *pb, const float *pc)
void bar (float *pa, float *pb, float *pc)
{
int i;
......@@ -21,10 +19,18 @@ void bar (const float *pa, const float *pb, const float *pc)
return;
}
/* Unaligned pointer read accesses, aligned pointer write access.
The loop bound is known and divisible by the vectorization factor.
Can't prove that the pointers don't alias.
vect-53.c is similar to this one with one difference:
the loop bound is unknown.
vect-48.c is similar to this one with one difference:
aliasing is not a problem. */
int
main1 (afloat *pa, float *pb, float *pc)
main1 (float *pb, float *pc)
{
float pa[N] __attribute__ ((__aligned__(16)));
int i;
for (i = 0; i < N; i++)
......@@ -40,13 +46,14 @@ main1 (afloat *pa, float *pb, float *pc)
int main (void)
{
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};
float b[N+1] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60};
float c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (a,b,c);
main1 (b,c);
main1 (&b[1],c);
return 0;
}
......
......@@ -5,7 +5,6 @@
#define N 256
void bar (float *pa, float *pb, float *pc)
{
int i;
......@@ -20,7 +19,6 @@ void bar (float *pa, float *pb, float *pc)
return;
}
int
main1 (int n, float * __restrict__ pa, float * __restrict__ pb, float * __restrict__ pc)
{
......@@ -36,6 +34,14 @@ main1 (int n, float * __restrict__ pa, float * __restrict__ pb, float * __restri
return 0;
}
/* Unaligned pointer accesses, with unknown alignment.
The loop bound is unknown.
No aliasing problems.
vect-44.c is similar to this one with one difference:
the loop bound is known.
vect-51.c is similar to this one with one difference:
can't prove that pointers don't alias. */
int main (void)
{
int i;
......
......@@ -5,7 +5,6 @@
#define N 256
void bar (const float *pa, const float *pb, const float *pc)
{
int i;
......@@ -20,6 +19,13 @@ void bar (const float *pa, const float *pb, const float *pc)
return;
}
/* Unaligned pointer accesses, with unknown alignment.
The loop bound is unknown.
Can't prove that the pointers don't alias.
vect-45.c is similar to this one with one difference:
the loop bound is known.
vect-50.c is similar to this one with one difference:
Aliasing is not a problem. */
int
main1 (int n, float *pa, float *pb, float *pc)
......
......@@ -5,26 +5,20 @@
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (float *pa, float *pb, float *pc)
{
int i;
/* check results: */
for (i = 0; i < N; i++)
{
if (pa[i] != (pb[i] * pc[i]))
abort ();
}
return;
}
/* Unaligned pointer read accesses, aligned write access.
The loop bound is unknown.
No aliasing problems.
vect-60.c is similar to this one with one difference:
the alignment of the read accesses is known.
vect-48.c is similar to this one with one difference:
the loop bound is known.
vect-53.c is similar to this one with one difference:
aliasing is a problem. */
int
main1 (int n, afloat * __restrict__ pa, float * __restrict__ pb, float * __restrict__ pc)
main1 (int n, float *pb, float *pc)
{
float pa[N] __attribute__ ((__aligned__(16)));
int i;
for (i = 0; i < n; i++)
......@@ -32,7 +26,12 @@ main1 (int n, afloat * __restrict__ pa, float * __restrict__ pb, float * __restr
pa[i] = pb[i] * pc[i];
}
bar (pa,pb,pc);
/* check results: */
for (i = 0; i < N; i++)
{
if (pa[i] != (pb[i] * pc[i]))
abort ();
}
return 0;
}
......@@ -46,8 +45,9 @@ int main (void)
check_vect ();
main1 (N,a,&b[1],c);
main1 (N,a,&b[1],&c[1]);
main1 (N,&b[1],c);
main1 (N,&b[1],&c[1]);
return 0;
}
......
......@@ -5,8 +5,6 @@
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (const float *pa, const float *pb, const float *pc)
{
int i;
......@@ -21,10 +19,18 @@ void bar (const float *pa, const float *pb, const float *pc)
return;
}
/* Unaligned pointer read accesses, aligned pointer write access.
The loop bound is unknown.
Can't prove that the pointers don't alias.
vect-49.c is similar to this one with one difference:
the loop bound is known.
vect-52.c is similar to this one with one difference:
aliasing is not a problem. */
int
main1 (int n, afloat *pa, float *pb, float *pc)
main1 (int n, float *pb, float *pc)
{
float pa[N] __attribute__ ((__aligned__(16)));
int i;
for (i = 0; i < n; i++)
......@@ -46,8 +52,9 @@ int main (void)
check_vect ();
main1 (N,a,&b[1],c);
main1 (N,a,&b[1],&c[1]);
main1 (N,&b[1],c);
main1 (N,&b[1],&c[1]);
return 0;
}
......
......@@ -5,9 +5,7 @@
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (afloat *pa, afloat *pb, afloat *pc)
void bar (float *pa, float *pb, float *pc)
{
int i;
......@@ -21,18 +19,29 @@ void bar (afloat *pa, afloat *pb, afloat *pc)
return;
}
/* Unaligned pointer accesses, with a known alignment.
The loop bound is known and divisible by the vectorization factor.
No aliasing problems.
vect-58.c is similar to this one with one difference:
the loop bound is unknown. */
int
main1 (afloat * __restrict__ pa, afloat * __restrict__ pb, afloat * __restrict__ pc)
main1 ()
{
int i;
float a[N] __attribute__ ((__aligned__(16)));
float b[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 c[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 *pa = a;
float *pb = b;
float *pc = c;
for (i = 0; i < N/2; i++)
{
pa[i+1] = pb[i+1] * pc[i+1];
}
bar (pa,pb,pc);
bar (a,b,c);
return 0;
}
......@@ -40,13 +49,10 @@ main1 (afloat * __restrict__ pa, afloat * __restrict__ pb, afloat * __restrict__
int main (void)
{
int i;
float a[N] __attribute__ ((__aligned__(16)));
float b[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 c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 ();
main1 (a,b,c);
return 0;
}
......
/* { dg-require-effective-target vect_float } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (afloat *pa, afloat *pb, afloat *pc)
{
int i;
/* check results: */
for (i = 0; i < N/2; i++)
{
if (pa[i+1] != (pb[i+1] * pc[i+1]))
abort ();
}
return;
}
int
main1 (afloat * pa, afloat * pb, afloat * pc)
{
int i;
for (i = 0; i < N/2; i++)
{
pa[i+1] = pb[i+1] * pc[i+1];
}
bar (pa,pb,pc);
return 0;
}
int main (void)
{
int i;
float a[N] __attribute__ ((__aligned__(16)));
float b[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 c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (a,b,c);
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
......@@ -5,9 +5,7 @@
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (afloat *pa, afloat *pb, afloat *pc)
void bar (float *pa, float *pb, float *pc)
{
int i;
......@@ -15,24 +13,44 @@ void bar (afloat *pa, afloat *pb, afloat *pc)
for (i = 0; i < N/2; i++)
{
if (pa[i] != (pb[i+1] * pc[i+1]))
abort ();
abort ();
}
return;
}
/* Unaligned pointer read accesses, aligned write access.
The loop bound is known and divisible by the vectorization factor.
No aliasing problems.
vect-48.c is similar to this one with one difference:
the alignment of the read accesses is unknown.
vect-60.c is similar to this one with one difference:
the loop bound is unknown.
vect-57.c is similar to this one with two differences:
aliasing is a problem, and the write access has unknown alignment. */
int
main1 (afloat * __restrict__ pa, afloat * __restrict__ pb, afloat * __restrict__ pc)
main1 ()
{
int i;
float a[N] __attribute__ ((__aligned__(16)));
float b[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 c[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 *pa = a;
float *pb = b;
float *pc = c;
for (i = 0; i < N/2; i++)
{
pa[i] = pb[i+1] * pc[i+1];
}
bar (pa,pb,pc);
/* check results: */
for (i = 0; i < N/2; i++)
{
if (pa[i] != (pb[i+1] * pc[i+1]))
abort ();
}
return 0;
}
......@@ -40,13 +58,10 @@ main1 (afloat * __restrict__ pa, afloat * __restrict__ pb, afloat * __restrict__
int main (void)
{
int i;
float a[N] __attribute__ ((__aligned__(16)));
float b[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 c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 ();
main1 (a,b,c);
return 0;
}
......
......@@ -5,9 +5,7 @@
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (afloat *pa, afloat *pb, afloat *pc)
void bar (float *pa, float *pb, float *pc)
{
int i;
......@@ -15,24 +13,36 @@ void bar (afloat *pa, afloat *pb, afloat *pc)
for (i = 0; i < N/2; i++)
{
if (pa[i] != (pb[i+1] * pc[i+1]))
abort ();
abort ();
}
return;
}
/* Unaligned pointer read accesses with known alignment,
and an unaligned write access with unknown alignment.
The loop bound is known and divisible by the vectorization factor.
Can't prove that the pointers don't alias.
vect-61.c is similar to this one with one difference:
the loop bound is unknown.
vect-56.c is similar to this one with two differences:
aliasing is a problem, and the write access is aligned. */
int
main1 (afloat * pa, afloat * pb, afloat * pc)
main1 (float *pa)
{
int i;
float b[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 c[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 *pb = b;
float *pc = c;
for (i = 0; i < N/2; i++)
{
pa[i] = pb[i+1] * pc[i+1];
}
bar (pa,pb,pc);
bar (pa, pb, pc);
return 0;
}
......@@ -41,12 +51,10 @@ int main (void)
{
int i;
float a[N] __attribute__ ((__aligned__(16)));
float b[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 c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (a);
main1 (a,b,c);
return 0;
}
......
......@@ -5,9 +5,7 @@
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (afloat *pa, afloat *pb, afloat *pc)
void bar (float *pa, float *pb, float *pc)
{
int i;
......@@ -21,18 +19,27 @@ void bar (afloat *pa, afloat *pb, afloat *pc)
return;
}
/* Unaligned pointer accesses, with a known alignment.
The loop bound is unknown.
No aliasing problems.
vect-54.c is similar to this one with one difference:
the loop bound is known. */
int
main1 (int n , afloat * __restrict__ pa, afloat * __restrict__ pb, afloat * __restrict__ pc)
main1 (int n)
{
int i;
float a[N] __attribute__ ((__aligned__(16))); float b[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 c[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 *pa = a;
float *pb = b;
float *pc = c;
for (i = 0; i < n/2; i++)
{
pa[i+1] = pb[i+1] * pc[i+1];
}
bar (pa,pb,pc);
bar (a,b,c);
return 0;
}
......@@ -41,13 +48,10 @@ int main (void)
{
int i;
int n=N;
float a[N] __attribute__ ((__aligned__(16)));
float b[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 c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (n);
main1 (n,a,b,c);
return 0;
}
......
/* { dg-require-effective-target vect_float } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (afloat *pa, afloat *pb, afloat *pc)
{
int i;
/* check results: */
for (i = 0; i < N/2; i++)
{
if (pa[i+1] != (pb[i+1] * pc[i+1]))
abort ();
}
return;
}
int
main1 (int n , afloat * pa, afloat * pb, afloat * pc)
{
int i;
for (i = 0; i < n/2; i++)
{
pa[i+1] = pb[i+1] * pc[i+1];
}
bar (pa,pb,pc);
return 0;
}
int main (void)
{
int i;
int n=N;
float a[N] __attribute__ ((__aligned__(16)));
float b[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 c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (n,a,b,c);
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
......@@ -5,9 +5,7 @@
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (afloat *pa, afloat *pb, afloat *pc)
void bar (float *pa, float *pb, float *pc)
{
int i;
......@@ -21,18 +19,38 @@ void bar (afloat *pa, afloat *pb, afloat *pc)
return;
}
/* Unaligned pointer read accesses, aligned write access.
The loop bound is unknown
No aliasing problems.
vect-52.c is similar to this one with one difference:
the alignment of the read accesses is unknown.
vect-56.c is similar to this one with one difference:
the loop bound is known.
vect-61.c is similar to this one with two differences:
aliasing is not a problem, and the write access has unknown alignment. */
int
main1 (int n , afloat * __restrict__ pa, afloat * __restrict__ pb, afloat * __restrict__ pc)
main1 (int n)
{
int i;
float a[N] __attribute__ ((__aligned__(16)));
float b[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 c[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 *pa = a;
float *pb = b;
float *pc = c;
for (i = 0; i < n/2; i++)
{
pa[i] = pb[i+1] * pc[i+1];
}
bar (pa,pb,pc);
/* check results: */
for (i = 0; i < N/2; i++)
{
if (pa[i] != (pb[i+1] * pc[i+1]))
abort ();
}
return 0;
}
......@@ -41,13 +59,10 @@ int main (void)
{
int i;
int n=N;
float a[N] __attribute__ ((__aligned__(16)));
float b[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 c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (n);
main1 (n,a,b,c);
return 0;
}
......
......@@ -6,9 +6,7 @@
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (afloat *pa, afloat *pb, afloat *pc)
void bar (float *pa, float *pb, float *pc)
{
int i;
......@@ -22,11 +20,23 @@ void bar (afloat *pa, afloat *pb, afloat *pc)
return;
}
/* Unaligned pointer read accesses with known alignment,
and an unaligned write access with unknown alignment.
The loop bound is iunknown.
Can't prove that the pointers don't alias.
vect-57.c is similar to this one with one difference:
the loop bound is known.
vect-60.c is similar to this one with two differences:
aliasing is not a problem, and the write access is unaligned. */
int
main1 (int n , afloat * pa, afloat * pb, afloat * pc)
main1 (int n , float *pa)
{
int i;
float b[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 c[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 *pb = b;
float *pc = c;
for (i = 0; i < n/2; i++)
{
......@@ -43,12 +53,10 @@ int main (void)
int i;
int n=N;
float a[N] __attribute__ ((__aligned__(16)));
float b[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 c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (n,a);
main1 (n,a,b,c);
return 0;
}
......
......@@ -5,8 +5,6 @@
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (float *pd, float *pa, float *pb, float *pc)
{
int i;
......@@ -43,8 +41,8 @@ main1 (int n, float * __restrict__ pd, float * __restrict__ pa, float * __restri
int main (void)
{
int i;
afloat a[N];
afloat d[N+1];
float a[N] __attribute__ ((__aligned__(16)));
float d[N+1] __attribute__ ((__aligned__(16)));
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};
......@@ -59,12 +57,12 @@ int main (void)
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" } } */
/* For targets that support unaligned loads we version for the two unaligned stores and
generate misaligned accesses for the loads. For targets that don't support unaligned
loads we version for all four accesses. */
/* For targets that support unaligned loads we version for the two unaligned
stores and generate misaligned accesses for the loads. For targets that
don't support unaligned loads we version for all four accesses. */
/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail vect_no_align } } } */
/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 2 "vect" { xfail vect_no_align } } } */
/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { target vect_no_align } } }
/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { target vect_no_align } } } */
/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 4 "vect" { target vect_no_align } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment