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

gcc -fast?

From:
Michael G Schwern
Date:
October 13, 2003 23:58
Subject:
gcc -fast?
Message ID:
20031014065815.GA2626@windhund.schwern.org
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...
*grumble*

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:
-O3
-falign-loops-max-skip=15
-falign-jumps-max-skip=15
-falign-loops=16
-falign-jumps=16
-falign-functions=16
-malign-natural
-ffast-math
-fstrict-aliasing
-frelax-aliasing
-fgcse-mem-alias
-funroll-loops
-floop-transpose
-floop-to-memset
-finline-floor *
-mcpu=G5 *
-mpowerpc64
-mpowerpc-gpopt
-mtune=G5 **
-fsched-interblock
-fload-after-store
--param max-gcse-passes=3
-fno-gcse-sm
-fgcse-loop-depth
-funit-at-a-time
-fcallgraph-inlining
-fdisable-typechecking-for-spec

* These flags are not set if the -mcpu=G4 flag is used in conjunction with 
  -fast.
** 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        schwern@pobox.com  http://www.pobox.com/~schwern/
Stupid am I?  Stupid like a fox!



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About