public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/30038]  New: Call to sin(x), cos(x) should be transformed to sincos(x)
@ 2006-12-01 10:06 burnus at gcc dot gnu dot org
  2006-12-01 10:15 ` [Bug tree-optimization/30038] " ubizjak at gmail dot com
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: burnus at gcc dot gnu dot org @ 2006-12-01 10:06 UTC (permalink / raw)
  To: gcc-bugs

See also: http://gcc.gnu.org/ml/fortran/2006-12/msg00000.html

Tim Prince's analysis why ifort needs 8.77s and gfortran 12.16s for one
program:

"My copy of gfortran makes separate scalar calls to sin and cos, where ifort
makes a vector sincos call. 2 seconds to be gained there"

In the Fortran program below, a there is a call to the same argument with sin
and with cos. The resulting
  gfortran -msse3 -march=opteron -ffast-math -O3 -c -fdump-tree-optimized
shows
  pretmp.56 = __builtin_sinf (pretmp.80);
  pretmp.86 = __builtin_cosf (pretmp.80);
Using sincos should be faster.


Fortran program:

subroutine
test(number_of_sample_points,radius,coefficient,radius_of_curvature,spin_frequency,time,tmp)
  implicit none
  integer :: number_of_sample_points
  real, parameter   :: twopi = 6.28319
  integer :: n
  real :: radius(number_of_sample_points), coefficient, radius_of_curvature, &
          spin_frequency,time,tmp(2,number_of_sample_points)
  do n = 1, number_of_sample_points
    coefficient = (radius(n) / radius_of_curvature) * sin(twopi *            &
                                        spin_frequency * time)
    tmp(1,n) = coefficient
    coefficient = twopi * spin_frequency * (radius(n) /       &
                                     radius_of_curvature) * cos(twopi *      &
                                         spin_frequency * time)
    tmp(2,n) = coefficient
  end do
end subroutine


-- 
           Summary: Call to sin(x), cos(x) should be transformed to
                    sincos(x)
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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


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

end of thread, other threads:[~2007-01-22 11:12 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-01 10:06 [Bug tree-optimization/30038] New: Call to sin(x), cos(x) should be transformed to sincos(x) burnus at gcc dot gnu dot org
2006-12-01 10:15 ` [Bug tree-optimization/30038] " ubizjak at gmail dot com
2006-12-01 10:57 ` bonzini at gnu dot org
2006-12-01 11:04 ` bonzini at gnu dot org
2006-12-01 16:01 ` rguenth at gcc dot gnu dot org
2006-12-01 16:03 ` rguenth at gcc dot gnu dot org
2006-12-01 18:05 ` burnus at gcc dot gnu dot org
2006-12-06  9:53 ` rguenth at gcc dot gnu dot org
2006-12-07 16:07 ` rguenth at gcc dot gnu dot org
2006-12-07 16:07 ` rguenth at gcc dot gnu dot org
2006-12-07 20:01 ` burnus at gcc dot gnu dot org
2006-12-07 20:19 ` dorit at il dot ibm dot com
2006-12-07 20:32 ` burnus at gcc dot gnu dot org
2006-12-07 20:36 ` burnus at gcc dot gnu dot org
2006-12-07 20:48 ` rguenth at gcc dot gnu dot org
2006-12-07 20:50 ` rguenth at gcc dot gnu dot org
2006-12-12 20:59 ` dorit at il dot ibm dot com
2006-12-17 23:19 ` burnus at gcc dot gnu dot org
2007-01-22 11:11 ` rguenth at gcc dot gnu dot org
2007-01-22 11:12 ` 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).