aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vect
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-05-25 15:18:21 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-05-25 15:18:21 +0000
commit01df5c8ae2b0d8b2bf7cfa4623b31866141e4ad1 (patch)
tree870d4d98bd4ce2f44cd8355355fe3b936ee09108 /gcc/testsuite/gcc.dg/vect
parentc74b74a8b2f8a5996943128e574f429670537361 (diff)
downloadgcc-01df5c8ae2b0d8b2bf7cfa4623b31866141e4ad1.zip
gcc-01df5c8ae2b0d8b2bf7cfa4623b31866141e4ad1.tar.gz
gcc-01df5c8ae2b0d8b2bf7cfa4623b31866141e4ad1.tar.bz2
re PR tree-optimization/36327 (SCCVN should look through struct copies)
2009-05-25 Richard Guenther <rguenther@suse.de> PR tree-optimization/36327 * tree-ssa-alias.c (walk_non_aliased_vuses): Add second walker callback for reference translation or lookup at the point of may-defs. * tree-ssa-alias.h (walk_non_aliased_vuses): Adjust prototype. * tree-ssa-sccvn.c (get_ref_from_reference_ops): Bail out for union COMPONENT_REFs. (vn_reference_lookup_3): New callback. Lookup from memset and CONSTRUCTOR assignment, translate through struct copies. (vn_reference_lookup_pieces): Make sure to not free the passed operands array. Adjust walk_non_aliased_vuses call. (vn_reference_lookup): Adjust walk_non_aliased_vuses call, make sure we do not leak memory. * gcc.dg/tree-ssa/ssa-fre-24.c: New testcase. * gcc.dg/tree-ssa/ssa-fre-25.c: Likewise. * gcc.dg/tree-ssa/sra-2.c: Disable FRE. * gcc.dg/vect/no-vfa-vect-43.c: Adjust. * gcc.dg/vect/vect-40.c: Likewise. * gcc.dg/vect/vect-42.c: Likewise. * gcc.dg/vect/vect-46.c: Likewise. * gcc.dg/vect/vect-76.c: Likewise. From-SVN: r147851
Diffstat (limited to 'gcc/testsuite/gcc.dg/vect')
-rw-r--r--gcc/testsuite/gcc.dg/vect/no-vfa-vect-43.c40
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-40.c7
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-42.c25
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-46.c7
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-76.c2
5 files changed, 55 insertions, 26 deletions
diff --git a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-43.c b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-43.c
index 13fbc82..65e36fe 100644
--- a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-43.c
+++ b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-43.c
@@ -22,41 +22,53 @@ void bar (float *pa, float *pb, float *pc)
__attribute__ ((noinline)) int
-main1 (float *pa)
+main1 (float *pa, float *pb, float *pc)
{
int i;
- float pb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {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__(__BIGGEST_ALIGNMENT__))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
+ float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+ float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+
+ for (i = 0; i < N; i++)
+ {
+ b[i] = pb[i];
+ c[i] = pc[i];
+ }
/* Vectorizable: pa may not alias pb and/or pc, even though their
addresses escape. &pa would need to escape to point to escaped memory. */
for (i = 0; i < N; i++)
{
- pa[i] = pb[i] * pc[i];
+ pa[i] = b[i] * c[i];
}
- bar (pa,pb,pc);
+ bar (pa,b,c);
return 0;
}
__attribute__ ((noinline)) int
-main2 (float * pa)
+main2 (float *pa, float *pb, float *pc)
{
int i;
- 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};
+ float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+ float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+
+ for (i = 0; i < N; i++)
+ {
+ b[i] = pb[i];
+ c[i] = pc[i];
+ }
/* Vectorizable: pb and pc addresses do not escape. */
for (i = 0; i < N; i++)
{
- pa[i] = pb[i] * pc[i];
+ pa[i] = b[i] * c[i];
}
/* check results: */
for (i = 0; i < N; i++)
{
- if (pa[i] != (pb[i] * pc[i]))
+ if (pa[i] != (b[i] * c[i]))
abort ();
}
@@ -67,14 +79,16 @@ int main (void)
{
int i;
float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+ 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};
check_vect ();
- main1 (a);
- main2 (a);
+ main1 (a,b,c);
+ main2 (a,b,c);
return 0;
}
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 2 "vect" } } */
/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 2 "vect" { target vect_no_align } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-40.c b/gcc/testsuite/gcc.dg/vect/vect-40.c
index a73d155..d2c17d1 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-40.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-40.c
@@ -26,13 +26,16 @@ void bar (float *pa, float *pb, float *pc)
vect-46.c is similar to this one with one difference:
the loop bound is unknown. */
+float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)))
+ = {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__(__BIGGEST_ALIGNMENT__)))
+ = {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] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
- float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {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__(__BIGGEST_ALIGNMENT__))) = {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;
diff --git a/gcc/testsuite/gcc.dg/vect/vect-42.c b/gcc/testsuite/gcc.dg/vect/vect-42.c
index f1764e1..2968863 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-42.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-42.c
@@ -27,15 +27,22 @@ void bar (float *pa, float *pb, float *pc)
No aliasing problems. */
__attribute__ ((noinline)) int
-main1 (float * __restrict__ pa)
+main1 (float * __restrict__ pa, float *pb, float *pc)
{
+ float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+ float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
int i;
- float pb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {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__(__BIGGEST_ALIGNMENT__))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
+ /* We also vectorize this loop. */
for (i = 0; i < N; i++)
{
- pa[i] = pb[i] * pc[i];
+ b[i] = pb[i];
+ c[i] = pc[i];
+ }
+
+ for (i = 0; i < N; i++)
+ {
+ pa[i] = b[i] * c[i];
}
return 0;
@@ -45,18 +52,18 @@ int main (void)
{
int i;
float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
- float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {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__(__BIGGEST_ALIGNMENT__))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
+ 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};
check_vect ();
- main1 (a);
+ main1 (a,b,c);
bar (a,b,c);
return 0;
}
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { vect_no_align || { ! vector_alignment_reachable } } } } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail { vect_no_align || { ! vector_alignment_reachable } } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 4 "vect" { xfail { vect_no_align || { ! vector_alignment_reachable } } } } } */
/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail {vect_no_align || { ! vector_alignment_reachable } } } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-46.c b/gcc/testsuite/gcc.dg/vect/vect-46.c
index 2588a7b..d506d43 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-46.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-46.c
@@ -26,11 +26,16 @@ void bar (float *pa, float *pb, float *pc)
vect-40.c is similar to this one with one difference:
the loop bound is known. */
+float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)))
+ = {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__(__BIGGEST_ALIGNMENT__)))
+ = {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 n)
{
int i;
- float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {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__(__BIGGEST_ALIGNMENT__))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
+ float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
float *pa = a;
float *pb = b;
float *pc = c;
diff --git a/gcc/testsuite/gcc.dg/vect/vect-76.c b/gcc/testsuite/gcc.dg/vect/vect-76.c
index 7097e7a..d771302 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-76.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-76.c
@@ -11,13 +11,13 @@
more involved than just an ssa_name. */
int ib[N+OFF] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10};
+int ic[N+OFF] = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10};
__attribute__ ((noinline))
int main1 (int *pib)
{
int i;
int ia[N+OFF];
- int ic[N+OFF] = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10};
for (i = OFF; i < N; i++)
{