subroutine to_product_of(self,a,b,a1,a2) complex(kind=8) :: self (:) complex(kind=8), intent(in) :: a(:,:) complex(kind=8), intent(in) :: b(:) integer a1,a2 self = ZERO do i = 1,a1 do j = 1,a2 self(i) = self(i) + a(i,j)*b(j) end do end do end subroutine
There are numerous reasons this is not vectorized at the moment: 1) aliasing doesn't tell apart the data of self, a and b 2) the reduction is obfuscated by extra SSA_NAME copies from store-motion (after you fix 1) 3) REALPART_EXPR < (*ptr)[i] > is not handled by data dependency analysis 4) ... ? -- Summary: Fortran Complex reduction / multiplication not vectorized Product: gcc Version: 4.4.0 Status: UNCONFIRMED Keywords: missed-optimization, alias Severity: enhancement Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rguenth at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37021