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

--- Comment #2 from Arnaud Desitter <arnaud02 at users dot sourceforge.net> ---
In my original report, I meant to write:
"built by gcc 8.2 on x86_64 with "-std=c++14 -O3 -mavx -fopenmp-simd" results
in **NO** simd instruction emitted."

subroutine ff(res, a, b, ncell, neq)
integer :: ncell, neq
double precision, dimension(neq,ncell) :: res, a, b
integer :: icell, ieq
!$omp simd collapse(2)
do icell=1,ncell
  do ieq=1, neq
     res(ieq,icell) = a(ieq,icell)-b(ieq,icell)
  enddo
enddo
end subroutine

has the same issue (gfortran 8.2 "-O3 -mavx -fopenmp-simd"). "!$omp simd
collapse(2)" produces scalar code.

I agree that it is possible to flatten the loops manually. I am wondering why
the clause "collapse(2)" ends up disabling the vectorisation.

Reply via email to