[Bug fortran/25620] Missed optimization with power

fxcoudert at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Jan 22 22:02:00 GMT 2007



------- Comment #17 from fxcoudert at gcc dot gnu dot org  2007-01-22 22:02 -------
cbrt is now available in the front-end (among others), thanks again to Richard!

Closing this PR, as the optimization appears to be working fully:

$ cat a.f90
REAL*8 :: a(6),b(6)
read(*,*) a(:)
b(1)=a(1)**(1.D0/3.D0)
b(2)=a(2)**(1/3.D0)
b(3)=a(3)**(2.D0/3.D0)
b(4)=a(4)**(1/2.D0)
b(5)=a(5)**(1.D0/2.D0)
b(6)=a(6)**(3.D0/2.D0)
write(*,*) b
END
$ gfortran -O2 -ffast-math a.f90 -S
$ grep -c pow a.s                  
0
$ grep -c cbrt a.s                 
3
$ grep -c sqrt a.s                 
3


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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



More information about the Gcc-bugs mailing list