develooper Front page | perl.perl5.porters | Postings from October 2003

gcc -fast?

Michael G Schwern
October 13, 2003 23:58
gcc -fast?
Message ID:
I noticed in the Apple OS X August 2003 gcc update release notes that they 
added a -fast option (notes at bottom).  Of course, they didn't update the man
page nor the Apple docs in /Developer/Documentation/DeveloperTools...

This switch is supposed to throw gcc into a special mode that makes fast
code on the G4 and G5.  Anyone tried it?

As I found out, it won't compile a usable G3 binary.  I'd probably have to
set -fast -mcpu=G3 -mtune=G3.  I'll give it a shot after I'm done compiling
5.8.1 normally.

NOTE:  gcc -fast uses a different binary.

] gcc -v
Reading specs from /usr/libexec/gcc/darwin/ppc/3.3/specs
Thread model: posix
gcc version 3.3 20030304 (Apple Computer, Inc. build 1493)
] gcc -fast -v
Reading specs from /usr/libexec/gcc/darwin/ppc/3.3-fast/specs
Thread model: posix
gcc version 3.3-fast 20030304 (Apple Computer, Inc. build 1610)

so if you're going to build with it, you might have to tell Configure
"gcc -fast" when it asks you for your C compiler rather than give it later
as an option.

Here's the relevant bit from the release notes:

Using the GCC 3.3 compiler with the -fast flag

The gcc 3.3 compiler shipped with this update has an added flag, -fast. -fast changes the overall optimization strategy of the compiler in order to produce the fastest running code for G4 and G5 architectures, as well as setting the following compiler flags:
-finline-floor *
-mcpu=G5 *
-mtune=G5 **
--param max-gcse-passes=3

* These flags are not set if the -mcpu=G4 flag is used in conjunction with 
** This flag is not set if the -mtune=G4 flag is used in conjunction with -fast.

-fast also assume generation of non-relocatable code, which is not suitable for shared libraries.  You can override this behavior with the -fPIC flag.

Please note that many of these optimizations may not be appropriate for all code. Many of them make assumptions about pointers and math which may not be safe to make in every instance. For more information on these options, please see file:///Developer/Documentation/DeveloperTools/gcc-3.3/gcc/index.html.

Michael G Schwern
Stupid am I?  Stupid like a fox! Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About