Apple's -fast option for gcc

Bradley Lucier lucier@math.purdue.edu
Wed Sep 17 02:07:00 GMT 2003


On Tuesday, September 16, 2003, at 04:12  PM, David Edelsohn wrote:
> 	You could look at some of the recent GCC patches from Apple and
> IBM that have yet to be reviewed (hint, hint :-).

Well, you guys must be doing something right ...

With these options:

-mcpu=7450 -mtune=7450 -no-cpp-precomp -Wall -W -Wno-unused -O1 
-fno-math-errno -fschedule-insns2 -fno-trapping-math 
-fno-strict-aliasing -fomit-frame-pointer -fPIC -fno-common

one gets

 > (time (* 0 (expt 3 1000000)))
(time (* 0 (expt 3 1000000)))
     998 ms real time
     910 ms cpu time (910 user, 0 system)
     14 collections accounting for 31 ms real time (30 user, 0 system)
     18196312 bytes allocated
     no minor faults
     no major faults
0
 >

while with

-fast -mcpu=G4 -fno-fast-math -fno-trapping-math -fno-math-errno 
-fno-strict-aliasing  -no-cpp-precomp -Wall -W -Wno-unused 
-fomit-frame-pointer -fPIC -fno-common

 > (time (* 0 (expt 3 1000000)))
(time (* 0 (expt 3 1000000)))
     856 ms real time
     740 ms cpu time (740 user, 0 system)
     14 collections accounting for 37 ms real time (0 user, 0 system)
     18197720 bytes allocated
     no minor faults
     no major faults
0

Note: -O2 doesn't help this code (mainly an FFT), -fgcse doesn't help 
it; in fact, I couldn't find anything faster than the above option mix 
until -fast came along.  Now to find out which of those many options 
are the real fix ...

With IBM's new cc -O4 one gets

 > (time (* 0 (expt 3 1000000)))
(time (* 0 (expt 3 1000000)))
     881 ms real time
     830 ms cpu time (830 user, 0 system)
     14 collections accounting for 22 ms real time (10 user, 0 system)
     18197704 bytes allocated
     no minor faults
     no major faults
0

When the code is not compiled with gcc it doesn't use computed gotos, 
so that *may* explain part of the slowdown.   But gcc doesn't take 
anywhere near the 10 hours it took xlc to compile the code.

Brad



More information about the Gcc mailing list