Re: -fast for G4 + G5
Re: -fast for G4 + G5
- Subject: Re: -fast for G4 + G5
- From: Mark Asbach <email@hidden>
- Date: Tue, 16 Dec 2003 09:17:34 +0100
Hi Brian,
I know that :) There are two -mcpu settings for G4s, "7400" and
"7500" (mine being the older, 7400, I still can't find where this is
documented per model). The question is, which -fast documentation
doesn't answer, can I use -mcpu=7400 with fast (I don't have other
machines to test, so I need to verify it'll work not just on my
machine),
With gcc commandline-options override others that have been given
before. Giving "-mcpu=7450 -mcpu=7400" will therefore enable the
instruction set for the 7400. Internally the -fast option is expanded
to a bunch of different options including "-mcpu=G5" and you must
override that specific part if you want to run the code on earlier
processors.
or is -mcpu=7450 compatiable with the 7400 setting, and vice-versa?
Which is more optimal if I want to cover BOTH classes of machines?
"more optimal" .. well. You specify the instruction set with the mcpu
option. Therefore you MUST give the oldest platform, your code will be
running on. But that is not the only option that speeds up your code.
G++ uses the given instruction set to generate the fastest code for the
platform you specify with mtune. If you only specify "-fast -mcpu=G4"
then your code will be able to run on G4s but it probably won't be
optimal for a G4. On the other hand, it will be the fastest possible
code for the G5 that is able to run on G4 also ...
The -fast doc says to use "7450" for G4, but I know there are a bunch
of slightly different variations, and, once again, I don't want to get
into trouble when I ship.
Then just use "-fast -mcpu=G4". But remember that code generated this
way will possibly fail on G3 cpus still present in a lot of Macs
running OS X. You should divide your sources into a general startup
part and a work loud part. Then compile your startup part without
processor specific optimizations and make sure, you ask the gestalt
selectors during startup. If you detect a G3 or lower, give an error
dialog and quit.
Since OS X is specified to run from G3 and above, you could specify
"-fast -mcpu=G3" and tell your customers that it won't work with
603/604 PPC systems. From my experience with G3/G4 optimization, the G3
instruction set will allow pretty fast code for newer processors also.
In its default setup gcc generates code that runs on far older cpus and
that code is *really* slow on newer machines also (I got factor two for
execution speed of vtk filters on my PowerBook G4).
Have fun,
Mark
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.