From: WANG Xuerui <i.swmail@xen0n.name>
To: liuzhensong <liuzhensong@loongson.cn>,
WANG Xuerui <i.swmail@xen0n.name>,
binutils@sourceware.org
Cc: Chenghua Xu <xuchenghua@loongson.cn>,
Xi Ruoyao <xry111@xry111.site>, WANG Xuerui <git@xen0n.name>
Subject: Re: [PATCH 1/2] opcodes: LoongArch: make all non-native jumps desugar to canonical b{lt/ge}[u] forms
Date: Fri, 29 Jul 2022 17:42:40 +0800 [thread overview]
Message-ID: <09e3fe4a-81ec-f829-0d5e-5b59753dd1c8@xen0n.name> (raw)
In-Reply-To: <7923c152-9a27-2eef-d91e-7a9c2a343213@loongson.cn>
On 2022/7/29 09:18, liuzhensong wrote:
>
>
> On 2022/7/27 下午7:07, WANG Xuerui wrote:
>> From: WANG Xuerui<git@xen0n.name>
>>
>> Also re-order the jump/branch opcodes while at it, so that insns are
>> sorted in ascending order according to opcodes, and the label form
>> preceding the real definition.
>> ---
>> opcodes/loongarch-opc.c | 31 ++++++++++++-------------------
>> 1 file changed, 12 insertions(+), 19 deletions(-)
>>
>> diff --git a/opcodes/loongarch-opc.c b/opcodes/loongarch-opc.c
>> index 08ba101a902..6f5e42d57e5 100644
>> --- a/opcodes/loongarch-opc.c
>> +++ b/opcodes/loongarch-opc.c
>> @@ -810,22 +810,13 @@ static struct loongarch_opcode loongarch_float_jmp_opcodes[] =
>> static struct loongarch_opcode loongarch_jmp_opcodes[] =
>> {
>> /* match, mask, name, format, macro, include, exclude, pinfo. */
>> - { 0x0, 0x0, "bltz", "r,la", "bltz %1,%%b16(%2)", 0, 0, 0 },
>> - { 0x60000000, 0xfc00001f, "bltz", "r5:5,sb10:16<<2", 0, 0, 0, 0 },
>> - { 0x0, 0x0, "bgtz", "r,la", "bgtz %1,%%b16(%2)", 0, 0, 0 },
>> - { 0x60000000, 0xfc0003e0, "bgtz", "r0:5,sb10:16<<2", 0, 0, 0, 0 },
>> - { 0x0, 0x0, "bgez", "r,la", "bgez %1,%%b16(%2)", 0, 0, 0 },
>> - { 0x64000000, 0xfc00001f, "bgez", "r5:5,sb10:16<<2", 0, 0, 0, 0 },
>> - { 0x0, 0x0, "blez", "r,la", "blez %1,%%b16(%2)", 0, 0, 0 },
>> - { 0x64000000, 0xfc0003e0, "blez", "r0:5,sb10:16<<2", 0, 0, 0, 0 },
>> { 0x0, 0x0, "beqz", "r,la", "beqz %1,%%b21(%2)", 0, 0, 0 },
>> { 0x40000000, 0xfc000000, "beqz", "r5:5,sb0:5|10:16<<2", 0, 0, 0, 0 },
>> { 0x0, 0x0, "bnez", "r,la", "bnez %1,%%b21(%2)", 0, 0, 0 },
>> { 0x44000000, 0xfc000000, "bnez", "r5:5,sb0:5|10:16<<2", 0, 0, 0, 0 },
>> - { 0x0, 0x0, "jr", "r", "jirl $r0,%1,0", 0, 0, 0 },
>> - { 0x50000000, 0xfc000000, "b", "sb0:10|10:16<<2", 0, 0, 0, 0 },
>> - { 0x0, 0x0, "b", "la", "b %%b26(%1)", 0, 0, 0 },
>> { 0x4c000000, 0xfc000000, "jirl", "r0:5,r5:5,s10:16<<2", 0, 0, 0, 0 },
>> + { 0x0, 0x0, "b", "la", "b %%b26(%1)", 0, 0, 0 },
>> + { 0x50000000, 0xfc000000, "b", "sb0:10|10:16<<2", 0, 0, 0, 0 },
>> { 0x0, 0x0, "bl", "la", "bl %%b26(%1)", 0, 0, 0 },
>> { 0x54000000, 0xfc000000, "bl", "sb0:10|10:16<<2", 0, 0, 0, 0 },
>> { 0x0, 0x0, "beq", "r,r,la", "beq %1,%2,%%b16(%3)", 0, 0, 0 },
>> @@ -834,20 +825,22 @@ static struct loongarch_opcode loongarch_jmp_opcodes[] =
>> { 0x5c000000, 0xfc000000, "bne", "r5:5,r0:5,sb10:16<<2", 0, 0, 0, 0 },
>> { 0x0, 0x0, "blt", "r,r,la", "blt %1,%2,%%b16(%3)", 0, 0, 0 },
>> { 0x60000000, 0xfc000000, "blt", "r5:5,r0:5,sb10:16<<2", 0, 0, 0, 0 },
>> - { 0x0, 0x0, "bgt", "r,r,la", "bgt %1,%2,%%b16(%3)", 0, 0, 0 },
>> - { 0x60000000, 0xfc000000, "bgt", "r0:5,r5:5,sb10:16<<2", 0, 0, 0, 0 },
>> { 0x0, 0x0, "bge", "r,r,la", "bge %1,%2,%%b16(%3)", 0, 0, 0 },
>> { 0x64000000, 0xfc000000, "bge", "r5:5,r0:5,sb10:16<<2", 0, 0, 0, 0 },
>> - { 0x0, 0x0, "ble", "r,r,la", "ble %1,%2,%%b16(%3)", 0, 0, 0 },
>> - { 0x64000000, 0xfc000000, "ble", "r0:5,r5:5,sb10:16<<2", 0, 0, 0, 0 },
>> { 0x0, 0x0, "bltu", "r,r,la", "bltu %1,%2,%%b16(%3)", 0, 0, 0 },
>> { 0x68000000, 0xfc000000, "bltu", "r5:5,r0:5,sb10:16<<2", 0, 0, 0, 0 },
>> - { 0x0, 0x0, "bgtu", "r,r,la", "bgtu %1,%2,%%b16(%3)", 0, 0, 0 },
>> - { 0x68000000, 0xfc000000, "bgtu", "r0:5,r5:5,sb10:16<<2", 0, 0, 0, 0 },
>> { 0x0, 0x0, "bgeu", "r,r,la", "bgeu %1,%2,%%b16(%3)", 0, 0, 0 },
>> { 0x6c000000, 0xfc000000, "bgeu", "r5:5,r0:5,sb10:16<<2", 0, 0, 0, 0 },
>> - { 0x0, 0x0, "bleu", "r,r,la", "bleu %1,%2,%%b16(%3)", 0, 0, 0 },
>> - { 0x6c000000, 0xfc000000, "bleu", "r0:5,r5:5,sb10:16<<2", 0, 0, 0, 0 },
>> + /* Jumps implemented with macros. */
>> + { 0x0, 0x0, "bgt", "r,r,la", "blt %2,%1,%%b16(%3)", 0, 0, 0 },
>> + { 0x0, 0x0, "ble", "r,r,la", "bge %2,%1,%%b16(%3)", 0, 0, 0 },
>> + { 0x0, 0x0, "bltz", "r,la", "blt %1,$r0,%%b16(%2)", 0, 0, 0 },
>> + { 0x0, 0x0, "bgtz", "r,la", "blt $r0,%1,%%b16(%2)", 0, 0, 0 },
>> + { 0x0, 0x0, "bgez", "r,la", "bge %1,$r0,%%b16(%2)", 0, 0, 0 },
>> + { 0x0, 0x0, "blez", "r,la", "bge $r0,%1,%%b16(%2)", 0, 0, 0 },
>> + { 0x0, 0x0, "bgtu", "r,r,la", "bltu %2,%1,%%b16(%3)", 0, 0, 0 },
>> + { 0x0, 0x0, "bleu", "r,r,la", "bgeu %2,%1,%%b16(%3)", 0, 0, 0 },
>> + { 0x0, 0x0, "jr", "r", "jirl $r0,%1,0", 0, 0, 0 },
>> { 0 } /* Terminate the list. */
>> };
>>
> Looks good to me. And I don't think the instruction "ret" is
> necessary in [PATCH 2/2].
Please don't be so subjective. You and Chenghua never gave objective
reasons against "ret", your rejections seem to be just based on some
kind of personal preference. All while ignoring the objective
readability improvement and ease of learning gained by adding such
support, and I believe there must be community members in favor of the
addition.
And it's not like everyone must immediately migrate to it, people may
well continue to write "jr ra" or even "jirl zero, ra, 0", only those of
us preferring brevity would have one more palatable choice...
next prev parent reply other threads:[~2022-07-29 9:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-27 11:07 [PATCH 0/2] opcodes: LoongArch: Cleanups to jumps WANG Xuerui
2022-07-27 11:07 ` [PATCH 1/2] opcodes: LoongArch: make all non-native jumps desugar to canonical b{lt/ge}[u] forms WANG Xuerui
2022-07-29 1:18 ` liuzhensong
2022-07-29 9:42 ` WANG Xuerui [this message]
2022-07-29 10:02 ` liuzhensong
2022-07-29 10:06 ` WANG Xuerui
2022-08-01 3:43 ` liuzhensong
2022-07-27 11:07 ` [PATCH 2/2] opcodes: LoongArch: add "ret" instruction to reduce typing WANG Xuerui
2022-07-27 13:26 ` Xi Ruoyao
2022-07-29 10:09 ` WANG Xuerui
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=09e3fe4a-81ec-f829-0d5e-5b59753dd1c8@xen0n.name \
--to=i.swmail@xen0n.name \
--cc=binutils@sourceware.org \
--cc=git@xen0n.name \
--cc=liuzhensong@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).