public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/25621]  New: Missed optimisation
@ 2006-01-01 12:40 jv244 at cam dot ac dot uk
  2006-01-06 14:07 ` [Bug tree-optimization/25621] Missed optimization when unrolling the loop (splitting up the sum) (only with -ffast-math) pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 13+ messages in thread
From: jv244 at cam dot ac dot uk @ 2006-01-01 12:40 UTC (permalink / raw)
  To: gcc-bugs

The following doesn't run as fast as the 'hand-optimised' routine provided as
well (using current 4.2 on an opteron) using -ffast-math -O2 (makes a factor of
2 difference here). I've tried a number of further switches, but didn't manage
to find a case where the simply loop was as fast as the other. 

! simple loop
! assume N is even
SUBROUTINE S31(a,b,c,N)
 IMPLICIT NONE
 integer :: N
 real*8  :: a(N),b(N),c
 integer :: i
 c=0.0D0
 DO i=1,N
   c=c+a(i)*b(i)
 ENDDO
END SUBROUTINE

! 'improved' loop
SUBROUTINE S32(a,b,c,N)
 IMPLICIT NONE
 integer :: N
 real*8  :: a(N),b(N),c,tmp
 integer :: i
 c=0.0D0
 tmp=0.0D0
 DO i=1,N,2
    c=c+a(i)*b(i)
    tmp=tmp+a(i+1)*b(i+1)
 ENDDO
 c=c+tmp
END SUBROUTINE


-- 
           Summary: Missed optimisation
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jv244 at cam dot ac dot uk


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25621



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

end of thread, other threads:[~2023-09-23 21:08 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-25621-4@http.gcc.gnu.org/bugzilla/>
2013-03-29 10:07 ` [Bug tree-optimization/25621] Missed optimization when unrolling the loop (splitting up the sum) (only with -ffast-math) Joost.VandeVondele at mat dot ethz.ch
2014-03-16 15:54 ` Joost.VandeVondele at mat dot ethz.ch
2014-03-24 11:02 ` iliyapalachev at gmail dot com
2023-09-23 21:08 ` rguenth at gcc dot gnu.org
2006-01-01 12:40 [Bug tree-optimization/25621] New: Missed optimisation jv244 at cam dot ac dot uk
2006-01-06 14:07 ` [Bug tree-optimization/25621] Missed optimization when unrolling the loop (splitting up the sum) (only with -ffast-math) pinskia at gcc dot gnu dot org
2007-07-03 19:30 ` jv244 at cam dot ac dot uk
2007-07-04  8:58 ` eres at il dot ibm dot com
2007-07-04  9:23 ` jv244 at cam dot ac dot uk
2007-07-04 11:14 ` dorit at gcc dot gnu dot org
2007-07-04 11:24 ` eres at il dot ibm dot com
2007-08-14 20:17 ` dorit at gcc dot gnu dot org
2008-12-05 16:27 ` jv244 at cam dot ac dot uk
2010-04-27 18:25 ` jv244 at cam dot ac dot uk

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).