Re: 96-bit integer modulo, Athlon64 gcc 64-bit integers, libc codefor 64-bit division, etc.

Christian Bau <christian.bau@cbau.freeserve.co.uk>
15 May 2005 15:44:12 -0400

          From comp.compilers

Related articles
96-bit integer modulo, Athlon64 gcc 64-bit integers, libc codefor 64-b Jonathan_Epstein@nih.gov (Jonathan Epstein) (2005-05-13)
Re: 96-bit integer modulo, Athlon64 gcc 64-bit integers, libc codefor christian.bau@cbau.freeserve.co.uk (Christian Bau) (2005-05-14)
Re: 96-bit integer modulo, Athlon64 gcc 64-bit integers, libc codefor anton@mips.complang.tuwien.ac.at (2005-05-14)
Re: 96-bit integer modulo, Athlon64 gcc 64-bit integers, libc codefor gah@ugcs.caltech.edu (glen herrmannsfeldt) (2005-05-14)
Re: 96-bit integer modulo, Athlon64 gcc 64-bit integers, libc codefor christian.bau@cbau.freeserve.co.uk (Christian Bau) (2005-05-14)
Re: 96-bit integer modulo, Athlon64 gcc 64-bit integers, libc codefor gah@ugcs.caltech.edu (glen herrmannsfeldt) (2005-05-15)
Re: 96-bit integer modulo, Athlon64 gcc 64-bit integers, libc codefor anton@mips.complang.tuwien.ac.at (2005-05-15)
Re: 96-bit integer modulo, Athlon64 gcc 64-bit integers, libc codefor christian.bau@cbau.freeserve.co.uk (Christian Bau) (2005-05-15)
Re: 96-bit integer modulo, Athlon64 gcc 64-bit integers, libc codefor gah@ugcs.caltech.edu (glen herrmannsfeldt) (2005-05-15)
Re: 96-bit integer modulo, Athlon64 gcc 64-bit integers, libc codefor anton@mips.complang.tuwien.ac.at (2005-05-16)
Re: 96-bit integer modulo, Athlon64 gcc 64-bit integers, libc codefor Jonathan_Epstein@nih.gov (Jonathan Epstein) (2005-05-16)
Re: 96-bit integer modulo, Athlon64 gcc 64-bit integers, libc codefor Jonathan_Epstein@nih.gov (Jonathan Epstein) (2005-05-20)
| List of all articles for this month |
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 :-(


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.