[PATCH v1 4/4] LoongArch: Add testsuits for TLSDESC in gas and ld.
mengqinggang
mengqinggang@loongson.cn
Sat Dec 2 08:24:37 GMT 2023
在 2023/12/2 下午3:44, Xi Ruoyao 写道:
> On Sat, 2023-12-02 at 15:38 +0800, Xi Ruoyao wrote:
>> On Fri, 2023-12-01 at 17:04 +0800, Lulu Cai wrote:
>>> + pcalau12i $a0,%desc_pc_hi20(var)
>>> + ld.d $a1,$a0,%desc_ld_pc_lo12(var)
>>> + addi.d $a0,$a0,%desc_add_pc_lo12(var)
>>> + jirl $ra,$a1,%desc_call(var)
>> Should we consider using a different link register for desc_call? Say
>>
>> jirl $t0,$a1,%desc_call(var)
>>
>> And when the TLS descriptor function returns, use "jr $t0" instead of
>> "ret". The advantage would be avoiding saving $ra just because TLS
>> descriptor is used.
> Hmm, maybe better:
>
> jirl $a1, $a1, %desc_call(var)
>
> Just reuse a1 as it's clobbered anyway. Then __tlsdesc_static becomes
> something like
>
> __tlsdesc_static:
> ld.d $a0, $a0, 0
> jr $a1
According to my colleague's suggestion, the jirl instruction must use
the $ra register (jirl $zero, $ra, 0)
in order to perform hardware instruction prefetching.
We need to do some performance testing to decide which register to use.
>
More information about the Binutils
mailing list