https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92558

--- Comment #4 from rguenther at suse dot de <rguenther at suse dot de> ---
On Mon, 18 Nov 2019, marxin at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92558
> 
> --- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
> (In reply to Richard Biener from comment #2)
> > Will look.
> 
> Thanks, there's a code snippet which is different before and after the
> revision. Hopefully, it can be used for a reproducer creation:
> 
> $ cat set.f90
>       USE mod_scalars
>       real(r16) wsum, cff
>       DO i=1,nfast0
>         wsum=wsum+weight(1,i,ng)
>         cff=cff+weight(2,i,ng)
>       END DO
>       DO i=1,nfast0
>         weight=wsum*cff
>       END DO
>         END

So this seems equivalent to

      integer, parameter :: r16 = selected_real_kind(12,300) !64-bit
      integer, parameter :: r8 = selected_real_kind(12,300) !64-bit
      integer, parameter :: Ngrids = 1
      real(r8), dimension(2,0:256,Ngrids) :: weight
      real(r16) wsum, cff
      DO i=1,nfast0
        wsum=wsum+weight(1,i,ng)
        cff=cff+weight(2,i,ng)
      END DO
      DO i=1,nfast0
        weight=wsum*cff
      END DO
        END

which is not vectorized.  With larger Ngrids it is (I checked my
old compiled mod_param.fppized.f90 for Ngrids), and the difference
is that we now do

  # vect_wsum_18.25_129 = PHI <vect_wsum_18.25_128(4)>
  _130 = BIT_FIELD_REF <vect_wsum_18.25_129, 128, 0>;
  _131 = BIT_FIELD_REF <vect_wsum_18.25_129, 128, 128>;
  _132 = _130 + _131;
  _133 = BIT_FIELD_REF <vect_wsum_18.25_129, 64, 0>;
  _134 = BIT_FIELD_REF <vect_wsum_18.25_129, 64, 64>;

so reduce { wsum, cff, wsum, cff } in vector form first
but we somehow end up not using that for the scalar extracts.

Will fix.

Reply via email to