diff options
author | Richard Biener <rguenther@suse.de> | 2017-12-08 08:22:08 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2017-12-08 08:22:08 +0000 |
commit | becb7a366039fe2738d56017cfe9eac74a5512fd (patch) | |
tree | 0b26cfdbfd47d5040656e7e3137b999730eae987 /gcc | |
parent | 3e4a6f9d6c9d7a84d15c0d0504d2be7591c7d6c9 (diff) | |
download | gcc-becb7a366039fe2738d56017cfe9eac74a5512fd.zip gcc-becb7a366039fe2738d56017cfe9eac74a5512fd.tar.gz gcc-becb7a366039fe2738d56017cfe9eac74a5512fd.tar.bz2 |
re PR tree-optimization/81303 (410.bwaves regression caused by r249919)
2017-12-08 Richard Biener <rguenther@suse.de>
PR tree-optimization/81303
* gfortran.dg/pr81303.f: New testcase.
* gfortran.dg/vect/pr81303.f: Likewise.
From-SVN: r255499
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pr81303.f | 44 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/vect/pr81303.f | 50 |
3 files changed, 100 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 258c6d03..3b1a7e2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2017-12-08 Richard Biener <rguenther@suse.de> + + PR tree-optimization/81303 + * gfortran.dg/pr81303.f: New testcase. + * gfortran.dg/vect/pr81303.f: Likewise. + 2017-12-08 Julia Koval <julia.koval@intel.com> * gcc.target/i386/avx512f-vnni-1.c: Add checks for vdpdwssds. diff --git a/gcc/testsuite/gfortran.dg/pr81303.f b/gcc/testsuite/gfortran.dg/pr81303.f new file mode 100644 index 0000000..f83a859 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr81303.f @@ -0,0 +1,44 @@ +! { dg-do compile } +! { dg-options "-O3 -ffast-math -floop-interchange -fdump-tree-linterchange-details" } + + subroutine mat_times_vec(y,x,a,axp,ayp,azp,axm,aym,azm, + $ nb,nx,ny,nz) + implicit none + integer nb,nx,ny,nz,i,j,k,m,l,kit,im1,ip1,jm1,jp1,km1,kp1 + + real*8 y(nb,nx,ny,nz),x(nb,nx,ny,nz) + + real*8 a(nb,nb,nx,ny,nz), + 1 axp(nb,nb,nx,ny,nz),ayp(nb,nb,nx,ny,nz),azp(nb,nb,nx,ny,nz), + 2 axm(nb,nb,nx,ny,nz),aym(nb,nb,nx,ny,nz),azm(nb,nb,nx,ny,nz) + + + do k=1,nz + km1=mod(k+nz-2,nz)+1 + kp1=mod(k,nz)+1 + do j=1,ny + jm1=mod(j+ny-2,ny)+1 + jp1=mod(j,ny)+1 + do i=1,nx + im1=mod(i+nx-2,nx)+1 + ip1=mod(i,nx)+1 + do l=1,nb + y(l,i,j,k)=0.0d0 + do m=1,nb + y(l,i,j,k)=y(l,i,j,k)+ + 1 a(l,m,i,j,k)*x(m,i,j,k)+ + 2 axp(l,m,i,j,k)*x(m,ip1,j,k)+ + 3 ayp(l,m,i,j,k)*x(m,i,jp1,k)+ + 4 azp(l,m,i,j,k)*x(m,i,j,kp1)+ + 5 axm(l,m,i,j,k)*x(m,im1,j,k)+ + 6 aym(l,m,i,j,k)*x(m,i,jm1,k)+ + 7 azm(l,m,i,j,k)*x(m,i,j,km1) + enddo + enddo + enddo + enddo + enddo + return + end + +! { dg-final { scan-tree-dump-times "is interchanged" 1 "linterchange" } } diff --git a/gcc/testsuite/gfortran.dg/vect/pr81303.f b/gcc/testsuite/gfortran.dg/vect/pr81303.f new file mode 100644 index 0000000..16deb7d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/vect/pr81303.f @@ -0,0 +1,50 @@ +! { dg-do compile } +! { dg-require-effective-target vect_cond_mixed } +! { dg-require-effective-target vect_double } +! { dg-additional-options "-O3 -ffast-math -floop-interchange -fdump-tree-linterchange-details" } +! vect_cond_mixed lies on x86, we cannot do vcond[_eq]v2div2df +! { dg-additional-options "-msse4.1" { target { x86_64-*-* i?86-*-* } } } + + subroutine mat_times_vec(y,x,a,axp,ayp,azp,axm,aym,azm, + $ nb,nx,ny,nz) + implicit none + integer nb,nx,ny,nz,i,j,k,m,l,kit,im1,ip1,jm1,jp1,km1,kp1 + + real*8 y(nb,nx,ny,nz),x(nb,nx,ny,nz) + + real*8 a(nb,nb,nx,ny,nz), + 1 axp(nb,nb,nx,ny,nz),ayp(nb,nb,nx,ny,nz),azp(nb,nb,nx,ny,nz), + 2 axm(nb,nb,nx,ny,nz),aym(nb,nb,nx,ny,nz),azm(nb,nb,nx,ny,nz) + + + do k=1,nz + km1=mod(k+nz-2,nz)+1 + kp1=mod(k,nz)+1 + do j=1,ny + jm1=mod(j+ny-2,ny)+1 + jp1=mod(j,ny)+1 + do i=1,nx + im1=mod(i+nx-2,nx)+1 + ip1=mod(i,nx)+1 + do l=1,nb + y(l,i,j,k)=0.0d0 + do m=1,nb + y(l,i,j,k)=y(l,i,j,k)+ + 1 a(l,m,i,j,k)*x(m,i,j,k)+ + 2 axp(l,m,i,j,k)*x(m,ip1,j,k)+ + 3 ayp(l,m,i,j,k)*x(m,i,jp1,k)+ + 4 azp(l,m,i,j,k)*x(m,i,j,kp1)+ + 5 axm(l,m,i,j,k)*x(m,im1,j,k)+ + 6 aym(l,m,i,j,k)*x(m,i,jm1,k)+ + 7 azm(l,m,i,j,k)*x(m,i,j,km1) + enddo + enddo + enddo + enddo + enddo + return + end + +! verify we can vectorize the inner loop after interchange +! { dg-final { scan-tree-dump-times "is interchanged" 1 "linterchange" } } +! { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" } } |