public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/31738]  New: Fortran dot product vectorization is restricted
@ 2007-04-28 19:29 jb at gcc dot gnu dot org
  2007-04-28 21:05 ` [Bug middle-end/31738] " rguenth at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: jb at gcc dot gnu dot org @ 2007-04-28 19:29 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-04-28  9:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-28 19:29 [Bug middle-end/31738] New: Fortran dot product vectorization is restricted jb at gcc dot gnu dot org
2007-04-28 21:05 ` [Bug middle-end/31738] " rguenth at gcc dot gnu dot org
2007-05-08 20:00 ` dorit at il dot ibm dot com
2007-05-16 19:45 ` dorit at il dot ibm dot com
2007-05-29  4:44 ` pinskia at gcc dot gnu dot org
2008-02-16 22:40 ` jb at gcc dot gnu dot org
2008-04-28  9:40 ` rguenth at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).