From: chenglulu <chenglulu@loongson.cn>
To: Xi Ruoyao <xry111@xry111.site>, WANG Xuerui <i.swmail@xen0n.name>,
mengqinggang <mengqinggang@loongson.cn>,
binutils@sourceware.org
Cc: xuchenghua@loongson.cn, liuzhensong@loongson.cn,
maskray@google.com, cailulu@loongson.cn, luweining@loongson.cn
Subject: Re: [PATCH] LoongArch: Add new relocation R_LARCH_CALL36
Date: Fri, 10 Nov 2023 16:36:14 +0800 [thread overview]
Message-ID: <8e7f2bed-cfdb-4815-f7b2-358ce9e39f1c@loongson.cn> (raw)
In-Reply-To: <bc0903fc1ab430d87a708ca519aa505c299b0893.camel@xry111.site>
在 2023/11/8 下午7:04, Xi Ruoyao 写道:
> On Wed, 2023-11-08 at 01:34 +0800, WANG Xuerui wrote:
>> On 11/7/23 20:16, Xi Ruoyao wrote:
>>> I'd like to have some pseudo instructions:
>>>
>>> - call36 r0, t0, func -> pcaddu18i t0, func + jirl r0, t0, func
>>> - call36 t0, func -> pcaddu18i t0, func + jirl t0, t0, func
>>> - call36 func -> pcaddu18i ra, func + jirl ra, ra, func
>>>
>>> These will make the work of the compiler (or assembly programmer)
>>> easier. Anyway with R_LARCH_CALL36 the pcaddu18i instruction and the
>>> jirl instruction must be adjacent, so there is no benefit for the
>>> compiler or programmer to use them separately to make a function call.
>>>
>>> And the last one can be annotated with R_LARCH_RELAX so we may relax it
>>> into a bl instruction if possible.
>> The suggestion sounds reasonable! Although IMO a name like "call.36"
>> might look better, the name "call36" also works for me.
>>
>> And regarding the proposed "call36 func" reusing the $ra for the
>> temporary -- IIUC this will break the subroutine return prediction. I
>> think we've been hit by similar regalloc in GCC and have since fixed
>> that: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11013.
> The URL is wrong, PR 11013 is 20-years old.
>
>> So maybe it's necessary to specify a different temp register after
>> all...
> I think for a normal call (call36 $ra, $ra, func or just call36 $ra) it
> should be OK, but for a sibcall (call36 $zero, $ra, func) it will
Under what circumstances do we generate such a function call?:-[
> confuse the return predictor and we better use another temp register.
>
next prev parent reply other threads:[~2023-11-10 8:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-07 11:52 mengqinggang
2023-11-07 12:16 ` Xi Ruoyao
2023-11-07 17:34 ` WANG Xuerui
2023-11-08 11:04 ` Xi Ruoyao
2023-11-10 8:36 ` chenglulu [this message]
2023-11-17 1:40 ` mengqinggang
2023-11-17 4:44 ` WANG Xuerui
2023-11-17 9:00 ` chenglulu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8e7f2bed-cfdb-4815-f7b2-358ce9e39f1c@loongson.cn \
--to=chenglulu@loongson.cn \
--cc=binutils@sourceware.org \
--cc=cailulu@loongson.cn \
--cc=i.swmail@xen0n.name \
--cc=liuzhensong@loongson.cn \
--cc=luweining@loongson.cn \
--cc=maskray@google.com \
--cc=mengqinggang@loongson.cn \
--cc=xry111@xry111.site \
--cc=xuchenghua@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).