From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Hildner Date: Mon, 24 Jan 2005 13:44:22 +0000 Subject: Re: optimize __gp location Message-Id: <41F4FBB6.2040406@hob.de> List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-ia64@vger.kernel.org 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). Christian