Port-sparc64 archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: sethi and 64-bit constants
On Mon, Mar 31, 2008 at 02:53:09PM +0100, raymond.meyer%rambler.ru@localhost
wrote:
> Say I have a 64-bit pointer, I would like to load this address into a
> register. Sparc sethi instruction has space for 22-bit constants, so how can
> I use it to load 64-bit data?
For imediate values, you use the
setx value, tempreg, destreg
pseudo instruction, which (depending on the value) may generate upto 6
instructions.
For the address of a pointer, the answer depends on your memory model.
On NetBSD, by default we assume that both text and data segmants are < 2GB,
so a 32 bit constant is enough to load the address of a pointer.
> Also, if it takes 2 or 3 sparc instructions simply to load a 64-bit data,
> doesn't this mean that 64-bit arithmetic is pretty inefficient?
Loading 64 bit imediate values is expenisve (due to the risc principle of
constant insruction size), but pretty rare in real code. Loading a constant
from r/o memory may be easier. This is, however, not related to performance
of 64 bit arithmetic in general.
Martin
Home |
Main Index |
Thread Index |
Old Index