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, 31 Mar 2008 14:53:09 +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?
> As far as I understand, given a 64-bit register 'reg'
> sethi const22, reg
> will set bits 0-9 and 32-63 to zero
> and set bits 10-31 to const22
> So how can I use other instructions (or, xor) to load a 64-bit constant?
> 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 a full-width 64-bit constant is quite expensive, yes.
Five instructions are needed. I think they will issue in just three
clocks though. If you need to load plenty of constants it might pay off
to put them in the .data section and load them through a pointer


Home | Main Index | Thread Index | Old Index