This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Vectorizing HIRLAM 2: One out of the "unhandled data-ref" garbage bin :-)
- From: Dorit Naishlos <DORIT at il dot ibm dot com>
- To: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Cc: fortran at gcc dot gnu dot org, gcc at gcc dot gnu dot org
- Date: Fri, 21 Oct 2005 17:41:47 +0200
- Subject: Re: Vectorizing HIRLAM 2: One out of the "unhandled data-ref" garbage bin :-)
gcc-owner@gcc.gnu.org wrote on 21/10/2005 03:19:57 PM:
> L.S.,
>
> This code:
>
> SUBROUTINE S(A, B, N)
> DIMENSION A(N), B(N)
> READ*,Z,B
> DO I = 1, N
> A(I) = Z * B(I)
> ENDDO
> PRINT*,A
> END
>
> when compiled thusly:
>
> $ gfortran -g -S -O3 -ftree-vectorize -ftree-vectorizer-verbose=2 -
> msse2 vect2.f
>
> draws the following "not vectorized" message:
>
> vect2.f:4: note: not vectorized: unhandled data-ref
> vect2.f:4: note: vectorized 0 loops in function.
>
> Hmmm, how about broadcasting Z to a vector register and using that in a
> vectorized version of this loop :-) ?
>
this is not a problem, the vectorizer knows how to handle
constants/invariants. The problem is that the access to Z in the loop
translates to a load, which accesses the same location in memory in each
iteration of the loop. The way to handle that is to effectively take the
invariant load out of the loop, if aliasing doesn't stop us (as Pinski
pointed out).
dorit
> Kind regards,
>
> --
> Toon Moene - e-mail: toon@moene.indiv.nluug.nl - phone: +31 346 214290
> Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
> A maintainer of GNU Fortran 95: http://gcc.gnu.org/fortran/