PR testsuite/41878
[official-gcc.git] / gcc / testsuite / gfortran.dg / vect / vect-gems.f90
blob019b41558446d736821fe2ed7ea84da807e474f7
1 ! { dg-do compile }
2 ! { dg-require-effective-target vect_double }
4 MODULE UPML_mod
6 IMPLICIT NONE
8 PUBLIC UPMLupdateE
10 PRIVATE
12 real(kind=8), dimension(:,:,:), allocatable :: Dx_ilow
14 real(kind=8), dimension(:), allocatable :: aye, aze
15 real(kind=8), dimension(:), allocatable :: bye, bze
16 real(kind=8), dimension(:), allocatable :: fxh, cxh
18 real(kind=8) :: epsinv
19 real(kind=8) :: dxinv, dyinv, dzinv
21 integer :: xstart, ystart, zstart, xstop, ystop, zstop
23 CONTAINS
25 SUBROUTINE UPMLupdateE(nx,ny,nz,Hx,Hy,Hz,Ex,Ey,Ez)
27 integer, intent(in) :: nx, ny, nz
28 real(kind=8), intent(inout), &
29 dimension(xstart:xstop+1,ystart:ystop+1,zstart:zstop+1) :: Ex, Ey, Ez
30 real(kind=8), intent(inout), &
31 allocatable :: Hx(:,:,:), Hy(:,:,:), Hz(:,:,:)
33 integer :: i, j, k
34 real(kind=8) :: Dxold, Dyold, Dzold
36 do k=zstart+1,zstop
37 do j=ystart+1,ystop
38 do i=xstart+1,0
40 Dxold = Dx_ilow(i,j,k)
42 Dx_ilow(i,j,k) = aye(j) * Dx_ilow(i,j,k) + &
43 bye(j) * ((Hz(i,j,k )-Hz(i,j-1,k))*dyinv + &
44 (Hy(i,j,k-1)-Hy(i,j,k ))*dzinv)
46 Ex(i,j,k) = aze(k) * Ex(i,j,k) + &
47 bze(k) * (cxh(i)*Dx_ilow(i,j,k) - fxh(i)*Dxold) * epsinv
48 end do
49 end do
50 end do
52 END SUBROUTINE UPMLupdateE
54 END MODULE UPML_mod
56 ! { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } }
57 ! { dg-final { cleanup-tree-dump "vect" } }