From: | Christian Bau <christian.bau@cbau.freeserve.co.uk> |
Newsgroups: | comp.compilers |
Date: | 15 May 2005 15:44:12 -0400 |
Organization: | Compilers Central |
References: | 05-05-063 05-05-082 05-05-098 05-05-108 |
Keywords: | arithmetic, performance |
Posted-Date: | 15 May 2005 15:44:12 EDT |
glen herrmannsfeldt <gah@ugcs.caltech.edu> wrote:
> Christian Bau wrote:
>
> (snip)
>
> > I haven't tried it myself, but gcc should be able to produce leaf
> > functions using 64 bit instructions on MacOS X 10.3 as well. The
> > processor doesn't actually run in 64 bit mode,
>
> Does the OS save the full 64 bit registers when not in 64 bit mode?
>
> Otherwise you could get the wrong result on a task switch.
There are two possibilities: Either the OS saves the full 64 bit
registers, or the designers are really really and I mean really
absolutely incredibly braindamaged stupid. I would assume the first.
Let's say I wouldn't dare adding this to the user interface of a
compiler if it didn't work!
Anyway, I checked what is really available: You have to switch
settings "Code generation = G5" instead of G4, you would probably want
"Scheduling = G5" instead of G4, and you need to turn on "64-bit
integer arithmetic".
The compiler still only saves 32 bit of registers during function
calls, so this will only really help you within leaf
functions. Parameter passing of long long is done through two 32 bit
parameters, so the function interface is compatible with 32 bit code.
long long add (long long x, long long y) { return x+y; }
would combine x from two 32-bit registers to one register, combine y
from two 32-bit registers to one register, do a single add, split the
result back into two 32-bit registers for the caller.
So this would be most useful if you have one function that does quite
a bit of 64 bit arithmetic. And of course it will only run on a G5, so
all I can do is look at the disassembled code that the compiler
produces :-(
Return to the
comp.compilers page.
Search the
comp.compilers archives again.