mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-23 00:51:00 +08:00
tree-vect-analyze.c (vect_analyze_data_ref_dependence): Distinguish between positive and negative dependence distance using DDR_REVERSED_P.
* tree-vect-analyze.c (vect_analyze_data_ref_dependence): Distinguish between positive and negative dependence distance using DDR_REVERSED_P. From-SVN: r128420
This commit is contained in:
parent
7323b6643e
commit
f5d8ed2c51
@ -1,3 +1,9 @@
|
||||
2007-09-12 Ira Rosen <irar@il.ibm.com>
|
||||
|
||||
PR tree-optimization/32377
|
||||
* tree-vect-analyze.c (vect_analyze_data_ref_dependence): Distinguish
|
||||
between positive and negative dependence distance using DDR_REVERSED_P.
|
||||
|
||||
2007-09-12 Dorit Nuzman <dorit@il.ibm.com>
|
||||
|
||||
PR tree-optimization/33373
|
||||
|
@ -1,3 +1,13 @@
|
||||
2007-09-12 Ira Rosen <irar@il.ibm.com>
|
||||
|
||||
PR tree-optimization/32377
|
||||
* gcc.dg/vect/no-vfa-vect-102a.c: Change the test to check positive
|
||||
dependence distance.
|
||||
* gcc.dg/vect/vect-outer-5.c, gcc.dg/vect/no-vfa-vect-102.c,
|
||||
gcc.dg/vect/vect-104.c, no-vfa-vect-dv-2.c: Likewise.
|
||||
* gcc.dg/vect/no-vfa-vect-depend-1.c,
|
||||
gfortran.dg/vect/no-vfa-pr32377.f90: New.
|
||||
|
||||
2007-09-12 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR middle-end/33382
|
||||
|
@ -32,13 +32,13 @@ int main1 (int x, int y) {
|
||||
/* Not vectorizable: distance 1. */
|
||||
for (i = 0; i < N - 1; i++)
|
||||
{
|
||||
*((int *)p + x + i) = *((int *)p + x + i + 1);
|
||||
*((int *)p + x + i + 1) = *((int *)p + x + i);
|
||||
}
|
||||
|
||||
/* check results: */
|
||||
for (i = 0; i < N; i++)
|
||||
{
|
||||
if (p->a[i] != b[i])
|
||||
if (p->a[i] != 1)
|
||||
abort();
|
||||
}
|
||||
return 0;
|
||||
|
@ -32,13 +32,13 @@ int main1 (int x, int y) {
|
||||
/* Not vectorizable: distance 1. */
|
||||
for (i = 0; i < N - 1; i++)
|
||||
{
|
||||
p->a[x + i] = p->a[x + i + 1];
|
||||
p->a[x + i + 1] = p->a[x + i];
|
||||
}
|
||||
|
||||
/* check results: */
|
||||
for (i = 0; i < N; i++)
|
||||
{
|
||||
if (p->a[i] != b[i])
|
||||
if (p->a[i] != 1)
|
||||
abort();
|
||||
}
|
||||
return 0;
|
||||
|
55
gcc/testsuite/gcc.dg/vect/no-vfa-vect-depend-1.c
Normal file
55
gcc/testsuite/gcc.dg/vect/no-vfa-vect-depend-1.c
Normal file
@ -0,0 +1,55 @@
|
||||
/* { dg-require-effective-target vect_int } */
|
||||
|
||||
#include <stdarg.h>
|
||||
#include "tree-vect.h"
|
||||
|
||||
#define N 17
|
||||
|
||||
__attribute__ ((noinline))
|
||||
int main1 ()
|
||||
{
|
||||
int i;
|
||||
int ia[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48};
|
||||
int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48};
|
||||
int res[N] = {12,24,36,48,60,72,84,96,108,120,132,144,156,168,180,192,48};
|
||||
|
||||
/* Not vectorizable due to data dependence: dependence distance 1. */
|
||||
for (i = 0; i < N - 1; i++)
|
||||
{
|
||||
ia[i+1] = ia[i] * 4;
|
||||
}
|
||||
|
||||
/* check results: */
|
||||
for (i = 0; i < N - 1; i++)
|
||||
{
|
||||
if (ia[i] != 0)
|
||||
abort ();
|
||||
}
|
||||
|
||||
/* Vectorizable. Dependence distance -1. */
|
||||
for (i = 0; i < N - 1; i++)
|
||||
{
|
||||
ib[i] = ib[i+1] * 4;
|
||||
}
|
||||
|
||||
/* check results: */
|
||||
for (i = 0; i < N - 1; i++)
|
||||
{
|
||||
if (ib[i] != res[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 "dependence distance >= VF or negative" 1 "vect" } } */
|
||||
/* { dg-final { cleanup-tree-dump "vect" } } */
|
||||
|
@ -15,6 +15,7 @@ int main ()
|
||||
int B[N];
|
||||
int C[N];
|
||||
int D[N];
|
||||
int E[N] = {0,1,2,0};
|
||||
|
||||
int i, j;
|
||||
|
||||
@ -57,13 +58,13 @@ int main ()
|
||||
/* Not vectorizable */
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
C[i] = C[i+3];
|
||||
C[i+3] = C[i];
|
||||
}
|
||||
|
||||
/* check results: */
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (C[i] != D[i+3])
|
||||
if (C[i] != E[i])
|
||||
abort ();
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ struct extraction
|
||||
|
||||
static int a[N][N] = {{1,2,3},{4,5,6},{7,8,9}};
|
||||
static int b[N][N] = {{17,24,7},{0,2,3},{4,31,82}};
|
||||
static int c[N][N] = {{1,2,3},{4,6,8},{8,9,9}};
|
||||
static int c[N][N] = {{1,2,3},{4,5,5},{5,5,5}};
|
||||
volatile int foo;
|
||||
|
||||
__attribute__ ((noinline))
|
||||
@ -39,7 +39,7 @@ int main1 (int x) {
|
||||
{
|
||||
for (j = 0; j < N; j++)
|
||||
{
|
||||
*((int *)p + x + i + j) = *((int *)p + x + i + j + 1);
|
||||
*((int *)p + x + i + j + 1) = *((int *)p + x + i + j);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
/* { dg-require-effective-target vect_int } */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <signal.h>
|
||||
#include "tree-vect.h"
|
||||
@ -16,6 +17,7 @@ int main1 ()
|
||||
float B[N] __attribute__ ((__aligned__(16)));
|
||||
float C[N] __attribute__ ((__aligned__(16)));
|
||||
float D[N] __attribute__ ((__aligned__(16)));
|
||||
float E[4] = {0,1,2,480};
|
||||
float s;
|
||||
|
||||
int i, j;
|
||||
@ -53,16 +55,13 @@ int main1 ()
|
||||
s = 0;
|
||||
for (j=0; j<N; j+=4)
|
||||
s += C[j];
|
||||
B[i] = B[i+3] + s;
|
||||
B[i+3] = B[i] + s;
|
||||
}
|
||||
|
||||
/* check results: */
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
s = 0;
|
||||
for (j=0; j<N; j+=4)
|
||||
s += C[j];
|
||||
if (B[i] != D[i+3] + s)
|
||||
if (B[i] != E[i])
|
||||
abort ();
|
||||
}
|
||||
|
||||
|
20
gcc/testsuite/gfortran.dg/vect/no-vfa-pr32377.f90
Normal file
20
gcc/testsuite/gfortran.dg/vect/no-vfa-pr32377.f90
Normal file
@ -0,0 +1,20 @@
|
||||
! { dg-do compile }
|
||||
|
||||
subroutine s243(ntimes,ld,n,ctime,dtime,a,b,c,d,e,aa,bb,cc)
|
||||
|
||||
integer ntimes,ld,n,i,nl
|
||||
real a(n),b(n),c(n),d(n),e(n),aa(ld,n),bb(ld,n),cc(ld,n)
|
||||
real t1,t2,chksum,ctime,dtime,cs1d
|
||||
b(:n-1)= b(:n-1)+(c(:n-1)+e(:n-1))*d(:n-1)
|
||||
a(:n-1)= b(:n-1)+a(2:n)*d(:n-1)
|
||||
return
|
||||
end
|
||||
|
||||
! Currently only the first loop gets vectorized.
|
||||
! For the second loop vectorization fails because of
|
||||
! "affine-affine test failed: missing iteration counts."
|
||||
! See PR 32377 for more details.
|
||||
|
||||
! { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { xfail *-*-* } } }
|
||||
! { dg-final { cleanup-tree-dump "vect" } }
|
||||
|
@ -1212,12 +1212,15 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (abs (dist) >= vectorization_factor)
|
||||
if (abs (dist) >= vectorization_factor
|
||||
|| (dist > 0 && DDR_REVERSED_P (ddr)))
|
||||
{
|
||||
/* Dependence distance does not create dependence, as far as vectorization
|
||||
is concerned, in this case. */
|
||||
/* Dependence distance does not create dependence, as far as
|
||||
vectorization is concerned, in this case. If DDR_REVERSED_P the
|
||||
order of the data-refs in DDR was reversed (to make distance
|
||||
vector positive), and the actual distance is negative. */
|
||||
if (vect_print_dump_info (REPORT_DR_DETAILS))
|
||||
fprintf (vect_dump, "dependence distance >= VF.");
|
||||
fprintf (vect_dump, "dependence distance >= VF or negative.");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user