1! { dg-do compile }
2! { dg-options "-O3 -ffast-math -floop-interchange -fdump-tree-linterchange-details" }
3
4        subroutine mat_times_vec(y,x,a,axp,ayp,azp,axm,aym,azm,
5     $  nb,nx,ny,nz)
6        implicit none
7        integer nb,nx,ny,nz,i,j,k,m,l,kit,im1,ip1,jm1,jp1,km1,kp1
8
9        real*8 y(nb,nx,ny,nz),x(nb,nx,ny,nz)
10
11        real*8 a(nb,nb,nx,ny,nz),
12     1  axp(nb,nb,nx,ny,nz),ayp(nb,nb,nx,ny,nz),azp(nb,nb,nx,ny,nz),
13     2  axm(nb,nb,nx,ny,nz),aym(nb,nb,nx,ny,nz),azm(nb,nb,nx,ny,nz)
14
15
16      do k=1,nz
17         km1=mod(k+nz-2,nz)+1
18         kp1=mod(k,nz)+1
19         do j=1,ny
20            jm1=mod(j+ny-2,ny)+1
21            jp1=mod(j,ny)+1
22            do i=1,nx
23               im1=mod(i+nx-2,nx)+1
24               ip1=mod(i,nx)+1
25               do l=1,nb
26                  y(l,i,j,k)=0.0d0
27                  do m=1,nb
28                     y(l,i,j,k)=y(l,i,j,k)+
29     1               a(l,m,i,j,k)*x(m,i,j,k)+
30     2               axp(l,m,i,j,k)*x(m,ip1,j,k)+
31     3               ayp(l,m,i,j,k)*x(m,i,jp1,k)+
32     4               azp(l,m,i,j,k)*x(m,i,j,kp1)+
33     5               axm(l,m,i,j,k)*x(m,im1,j,k)+
34     6               aym(l,m,i,j,k)*x(m,i,jm1,k)+
35     7               azm(l,m,i,j,k)*x(m,i,j,km1)
36                  enddo
37               enddo
38            enddo
39         enddo
40        enddo
41        return
42        end
43
44! { dg-final { scan-tree-dump-times "is interchanged" 1 "linterchange" } }
45