[PATCH 1/7] opcodes: LoongArch: explicitly define b{lt/gt/le/ge}z as syntactic sugars

WANG Xuerui i.swmail@xen0n.name
Mon Oct 25 03:11:57 GMT 2021


From: WANG Xuerui <git@xen0n.name>

2021-10-25  WANG Xuerui <git@xen0n.name>

opcodes/
        * loongarch-opc.c: Remove concrete definitions for bltz, bgtz, blez,
        bgez, and modify the expansion to perform canonicalization instead.
---
 opcodes/loongarch-opc.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/opcodes/loongarch-opc.c b/opcodes/loongarch-opc.c
index 4ccea71ee03..21429b77b97 100644
--- a/opcodes/loongarch-opc.c
+++ b/opcodes/loongarch-opc.c
@@ -738,14 +738,6 @@ 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,%%pcrel(%2)",		0, 0, 0 },
-  { 0x60000000, 0xfc00001f,	"bltz",		"r5:5,sb10:16<<2",		0,				0, 0, 0 },
-  { 0x0,	0x0,		"bgtz",		"r,la",				"bgtz %1,%%pcrel(%2)",		0, 0, 0 },
-  { 0x60000000, 0xfc0003e0,	"bgtz",		"r0:5,sb10:16<<2",		0,				0, 0, 0 },
-  { 0x0,	0x0,		"bgez",		"r,la",				"bgez %1,%%pcrel(%2)",		0, 0, 0 },
-  { 0x64000000, 0xfc00001f,	"bgez",		"r5:5,sb10:16<<2",		0,				0, 0, 0 },
-  { 0x0,	0x0,		"blez",		"r,la",				"blez %1,%%pcrel(%2)",		0, 0, 0 },
-  { 0x64000000, 0xfc0003e0,	"blez",		"r0:5,sb10:16<<2",		0,				0, 0, 0 },
   { 0x0,	0x0,		"beqz",		"r,la",				"beqz %1,%%pcrel(%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,%%pcrel(%2)",		0, 0, 0 },
@@ -776,6 +768,13 @@ static struct loongarch_opcode loongarch_jmp_opcodes[] =
   { 0x6c000000, 0xfc000000,	"bgeu",		"r5:5,r0:5,sb10:16<<2",		0,				0, 0, 0 },
   { 0x0,	0x0,		"bleu",		"r,r,la",			"bleu %1,%2,%%pcrel(%3)",	0, 0, 0 },
   { 0x6c000000, 0xfc000000,	"bleu",		"r0:5,r5:5,sb10:16<<2",		0,				0, 0, 0 },
+
+  /* Sugars.  */
+  { 0x0,	0x0,		"bgez",		"r,la",				"bge %1,$r0,%%pcrel(%2)",	0, 0, 0 },
+  { 0x0,	0x0,		"bgtz",		"r,la",				"bgt %1,$r0,%%pcrel(%2)",	0, 0, 0 },
+  { 0x0,	0x0,		"blez",		"r,la",				"ble %1,$r0,%%pcrel(%2)",	0, 0, 0 },
+  { 0x0,	0x0,		"bltz",		"r,la",				"blt %1,$r0,%%pcrel(%2)",	0, 0, 0 },
+
   { 0 } /* Terminate the list.  */
 };
 
-- 
2.33.1



More information about the Binutils mailing list