[Bug middle-end/31738] New: Fortran dot product vectorization is restricted
jb at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Sat Apr 28 19:29:00 GMT 2007
It seems that dot products are vectorized only for very restricted cases. For
the following example
subroutine testvectdp (a, b, c, n)
integer, intent(in) :: n
real, intent(in) :: a(n), b(n)
real, intent(out) :: c
c = dot_product (a, b)
end subroutine testvectdp
subroutine testvectdp2 (a, b, c, n)
integer, intent(in) :: n
real, intent(in) :: a(n), b(n)
real, intent(out) :: c
integer :: i
c = 0.0
do i = 1, n
c = c + a(i) * b(i)
end do
end subroutine testvectdp2
module testvec
contains
subroutine testvecm (a, b, c)
real, intent(in) :: a(:), b(:)
real, intent(out) :: c
c = dot_product (a, b)
end subroutine testvecm
subroutine testvecm2 (a, b, c)
real, intent(in) :: a(:), b(:)
real, intent(out) :: c
integer :: i
c = 0.0
do i = 1, size (a)
c = c + a(i) * b(i)
end do
end subroutine testvecm2
end module testvec
program testvec_p
use testvec
implicit none
real :: a(9), b(9), c
external testvectdp, testvectdp2
call random_number(a)
call random_number(b)
call testvectdp(a,b,c,9)
print *, c
call testvectdp2(a,b,c,9)
print *, c
call testvecm(a,b,c)
print *, c
call testvecm2(a,b,c)
print *, c
end program testvec_p
Only the first one, testvectdp vectorizes.
--
Summary: Fortran dot product vectorization is restricted
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jb at gcc dot gnu dot org
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31738
More information about the Gcc-bugs
mailing list