This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/30038] Call to sin(x), cos(x) should be transformed to sincos(x)



------- Comment #10 from burnus at gcc dot gnu dot org  2006-12-07 20:00 -------
Using the three patches:
http://gcc.gnu.org/ml/gcc-patches/2006-12/msg00500.html
http://gcc.gnu.org/ml/gcc-patches/2006-12/msg00499.html
http://gcc.gnu.org/ml/gcc-patches/2006-12/msg00476.html

gfortran is able to use sincos - and does so for my example (comment #0; the
example, however, cannot be vectorized).


For fatigue.f90 I have the following timings:
 gfortran: 21s
 ifort:    11s
 sunf95:    8.3s

The timings for gfortran don't change with the patch as sincos is NOT used.

If I make it obvious for the compiler that I have the same argument by using:
  mySin = sin( ... )
  myCos = cos( ... )
  expr = ... * mySin
then sincos is used and the execution time drops to 8.7s. (And remains
unchanged for ifort and sunf95.)

The unmodified source looks like:
  coefficient = (radius(n) / radius_of_curvature) &
                * sin(twopi * real(spin_frequency,LONGreal) * time)
  strain_tensor(1,1,n) = - coefficient * Poissons_ratio
  strain_tensor(2,2,n) = - coefficient * Poissons_ratio
  strain_tensor(3,3,n) = coefficient
!
  coefficient = twopi * real(spin_frequency,LONGreal) &
               * (radius(n) / radius_of_curvature) &
               * cos(twopi * real(spin_frequency,LONGreal) * time)


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]