This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/30038] Call to sin(x), cos(x) should be transformed to sincos(x)
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Dec 2006 20:00:51 -0000
- Subject: [Bug tree-optimization/30038] Call to sin(x), cos(x) should be transformed to sincos(x)
- References: <bug-30038-13404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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