[PATCH v2] LoongArch: Add overflow check and new relaxations when relaxing pcalau12i+ld.d

Lulu Cai cailulu@loongson.cn
Fri Nov 15 07:09:45 GMT 2024


On 11/15/24 2:13 PM, Xi Ruoyao wrote:
> On Fri, 2024-11-15 at 10:51 +0800, Lulu Cai wrote:
>> For pcalau12i+ld.d that can be relaxed, the relaxation is
>> pcalau12i+ld.d => pcalau12i+addi.d => pcaddi and there is no
>> overflow check.
>>
>> So the overflow check in the pcalau12i+ld.d relaxation and the
>> relaxation of pcalau12i+ld.d => pcaddi are added.
>>
>> Changes from v1:
>>    * Add relaxation for pcalau12i+ld.d=>pcaddi.
> Why do we need this?
>
> /* snip */
>
>> -      if (relax_func (abfd, sec, sym_sec, rel, symval,
>> -		      info, again, max_alignment)
>> -	  && relax_func == loongarch_relax_pcala_ld)
>> -	loongarch_relax_pcala_addi (abfd, sec, sym_sec, rel, symval,
>> -				    info, again, max_alignment);
> If pcalau12i + ld.d can be relaxed to pcaddi, here the pair will be
> relaxed to pcalau12i + addi.d by loongarch_relax_pcala_ld and then
> further relaxed to pcaddi anyway.
>

The idea here is to do the relaxation of pcalau12i + ld.d once instead 
of twice if possible.
But is this necessary in your opinion?



More information about the Binutils mailing list