Re: optimize __gp location

From: Christian Hildner <>
Date: 2005-01-25 00:44:22
Keith Owens schrieb:

>On Mon, 24 Jan 2005 08:51:17 +0100, 
>Christian Hildner <> wrote:
>>Chen, Kenneth W schrieb:
>>>Can we position the __gp somewhat more optimally, to cover more of these
>>>symbols? Something like the following patch would make all of them fall
>>>into the 22-bit immediate offset relative to gp.
>>Did you have benchmarks? Or at least a comparison of the resulting code 
>>size. The code size should shrink when more items can be addressed 
>>directly. Furthermore the code size should be a good indicator for the 
>>performance gain you could achive.
>The IA64 ABI supports link time rewriting of instructions if the linker
>can determine that the field being loaded can be access via __gp
>instead of via the linkage offset table.  One of the restrictions of
>link time rewriting is that the code offsets cannot change, which means
>that the code size cannot change either.  This code snippet will result
>in two different run time sequences, depending on whether jiffies can
>be referenced via __gp or not.
>    addl r20=0,r1;;	// LTOFF22X  jiffies
>    ld8 r16=[r20];;	// LDXMOV    jiffies
>    ld8.acq r23=[r16]	// value of jiffies
>When jiffies is within 22 bit range of __gp, the linker writes the
>sequence as
>    addl r20=offset_of(jiffies,__gp),r1;;
>    mov r16=r20;;
>    ld8.acq r23=[r16]	// value of jiffies
Is there a restriction to not rewrite to

    addl r16=offset_of(jiffies,__gp),r1;;
    ld8.acq r23=[r16]	// value of jiffies
    nop.i 0

because that would save at least one cycle and would make bundling easier (dependend of additional instructions, of course).


To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to
More majordomo info at
Received on Mon Jan 24 08:45:48 2005

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:35 EST