[PATCH 2/2] opcodes: LoongArch: add "ret" instruction to reduce typing
WANG Xuerui
i.swmail@xen0n.name
Wed Jul 27 11:07:57 GMT 2022
From: WANG Xuerui <git@xen0n.name>
This syntactic sugar is present in both classical and emerging
architectures, like Alpha, SPARC and RISC-V, and assembler macros
doing the same thing can already be found in the wild e.g. [1], proving
the feature's popularity. It's better to provide support directly in the
assembler so downstream users wouldn't have to re-invent this over and
over again.
[1]: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/loongarch/sysdep.h;h=c586df819cd90;hb=HEAD#l28
---
opcodes/loongarch-opc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/opcodes/loongarch-opc.c b/opcodes/loongarch-opc.c
index 6f5e42d57e5..e4e3a512f03 100644
--- a/opcodes/loongarch-opc.c
+++ b/opcodes/loongarch-opc.c
@@ -841,6 +841,7 @@ static struct loongarch_opcode loongarch_jmp_opcodes[] =
{ 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 },
+ { 0x0, 0x0, "ret", "", "jirl $r0,$r1,0", 0, 0, 0 },
{ 0 } /* Terminate the list. */
};
--
2.35.1
More information about the Binutils
mailing list