public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Vectorizing invariant data-ref
@ 2009-07-19  6:18 Revital1 Eres
  2009-07-19  9:17 ` Richard Guenther
  0 siblings, 1 reply; 3+ messages in thread
From: Revital1 Eres @ 2009-07-19  6:18 UTC (permalink / raw)
  To: gcc

[-- Attachment #1: Type: text/plain, Size: 1182 bytes --]


Hello,

The following snippet is from a f90 program which contains
a loop that does not get vectorized.

SUBROUTINE foo1(nx,ny,nz,arr2)
USE globalvar_mod, ONLY : dyinv, xstart, xstop

k=1
do j=1,ny
  do i=1,nx

    arr1(i,j,k) = arr2(i,j,k  ) *dyinv

  end do
end do
END SUBROUTINE foo1

The vectorizer failure message is:

        base_address: &dyinv
        offset from base address: 0
        constant offset from base address: 0
        step: 0
        aligned to: 128
        base_object: dyinv
        FAILED as dr address is invariant

test41.f90:24: note: get vectype with 2 units of type real(kind=8)
test41.f90:24: note: vectype: vector real(kind=8)
test41.f90:24: note: not vectorized: unhandled data-ref
test41.f90:24: note: bad data references.
test41.f90:7: note: vectorized 0 loops in function.

I am not familiar with f90 at all; seemingly dyinv is a regular
variable but according to the message in the dump file
it's a reference.

One option to vectorize this loop is to extend the vectorizer's versioning
for aliasing capability to version the loop also in this case.
Other suggestions will be appreciated.

Thanks,
Revital


(See attached file: test41.f90.txt)

[-- Attachment #2: test41.f90.txt --]
[-- Type: text/plain, Size: 595 bytes --]


MODULE foo_mod
USE parameter_mod, ONLY : rfp

IMPLICIT NONE

PUBLIC foo1

PRIVATE
real(kind=rfp), dimension(:,:,:), allocatable :: arr1

CONTAINS
SUBROUTINE foo1(nx,ny,nz,arr2)
USE globalvar_mod, ONLY : dyinv, xstart, xstop

integer, intent(in) :: nx, ny, nz
real(kind=rfp), intent(inout),                                                &
         dimension(xstart:xstop+1,xstart:xstop+1,xstart:xstop+1) :: arr2

integer :: i, j, k

k=1
do j=1,ny
  do i=1,nx

    arr1(i,j,k) = arr2(i,j,k  ) *dyinv

  end do
end do


END SUBROUTINE foo1

END MODULE foo_mod


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-07-19  9:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-19  6:18 Vectorizing invariant data-ref Revital1 Eres
2009-07-19  9:17 ` Richard Guenther
2009-07-19  9:42   ` Revital1 Eres

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).