summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/vect/vect-gems.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/vect/vect-gems.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/vect/vect-gems.f9058
1 files changed, 58 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/vect/vect-gems.f90 b/gcc/testsuite/gfortran.dg/vect/vect-gems.f90
new file mode 100644
index 000000000..66e878d3d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/vect/vect-gems.f90
@@ -0,0 +1,58 @@
+! { dg-do compile }
+! { dg-require-effective-target vect_double }
+
+MODULE UPML_mod
+
+IMPLICIT NONE
+
+PUBLIC UPMLupdateE
+
+PRIVATE
+
+real(kind=8), dimension(:,:,:), allocatable :: Dx_ilow
+
+real(kind=8), dimension(:), allocatable :: aye, aze
+real(kind=8), dimension(:), allocatable :: bye, bze
+real(kind=8), dimension(:), allocatable :: fxh, cxh
+
+real(kind=8) :: epsinv
+real(kind=8) :: dxinv, dyinv, dzinv
+
+integer :: xstart, ystart, zstart, xstop, ystop, zstop
+
+CONTAINS
+
+SUBROUTINE UPMLupdateE(nx,ny,nz,Hx,Hy,Hz,Ex,Ey,Ez)
+
+integer, intent(in) :: nx, ny, nz
+real(kind=8), intent(inout), &
+ dimension(xstart:xstop+1,ystart:ystop+1,zstart:zstop+1) :: Ex, Ey, Ez
+real(kind=8), intent(inout), &
+ allocatable :: Hx(:,:,:), Hy(:,:,:), Hz(:,:,:)
+
+integer :: i, j, k
+real(kind=8) :: Dxold, Dyold, Dzold
+
+do k=zstart+1,zstop
+ do j=ystart+1,ystop
+ do i=xstart+1,0
+
+ Dxold = Dx_ilow(i,j,k)
+
+ Dx_ilow(i,j,k) = aye(j) * Dx_ilow(i,j,k) + &
+ bye(j) * ((Hz(i,j,k )-Hz(i,j-1,k))*dyinv + &
+ (Hy(i,j,k-1)-Hy(i,j,k ))*dzinv)
+
+ Ex(i,j,k) = aze(k) * Ex(i,j,k) + &
+ bze(k) * (cxh(i)*Dx_ilow(i,j,k) - fxh(i)*Dxold) * epsinv
+ end do
+ end do
+end do
+
+END SUBROUTINE UPMLupdateE
+
+END MODULE UPML_mod
+
+! { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } }
+! { dg-final { cleanup-tree-dump "vect" } }
+! { dg-final { cleanup-modules "upml_mod" } }