MIPS: Fix encoding of sigrie instruction

Message ID dd53beca-3aab-3690-8e61-7ec50e018198@stuffedcow.net
State New
Headers show
Series
  • MIPS: Fix encoding of sigrie instruction
Related show

Commit Message

Henry Wong Feb. 2, 2018, 9:34 p.m.
Hi,

The instruction encoding for the MIPS r6 sigrie instruction seems to be
incorrect. It's currently 0x4170xxxx (which overlaps with ei, di, evp,
and dvp), but should be 0x0417xxxx (See ISA reference,
https://www.mips.com/?do-download=the-mips32-instruction-set-v6-06, page
385 of the PDF)

The attached patch changes the MIPS opcode table and the tests that are
affected. I'm not entirely confident there aren't more changes elsewhere
that need to be made, but gas generates the changed opcode and objdump
also disassembles the changed opcode correctly.


Changes:

    opcodes/mips-opc.c: Update MIPS opcode table
    gas/testsuite/gas/mips/
        * r6.d
        * r6-n32.d
        * r6-n64.d    Update tests that use sigrie

Patch

From 61d3ac920d89271d1df3c2ac6dd77273827f012f Mon Sep 17 00:00:00 2001
From: Henry Wong <henry@stuffedcow.net>
Date: Fri, 2 Feb 2018 14:09:41 -0500
Subject: [PATCH] MIPS: Fix encoding for MIPSr6 sigrie instruction.

---
 gas/testsuite/gas/mips/r6-n32.d | 4 ++--
 gas/testsuite/gas/mips/r6-n64.d | 4 ++--
 gas/testsuite/gas/mips/r6.d     | 4 ++--
 opcodes/mips-opc.c              | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/gas/testsuite/gas/mips/r6-n32.d b/gas/testsuite/gas/mips/r6-n32.d
index fb55086e..c9efa1d7 100644
--- a/gas/testsuite/gas/mips/r6-n32.d
+++ b/gas/testsuite/gas/mips/r6-n32.d
@@ -497,6 +497,6 @@  Disassembly of section .text:
 0+0598 <[^>]*> 41600024 	dvp
 0+059c <[^>]*> 41620004 	evp	v0
 0+05a0 <[^>]*> 41620024 	dvp	v0
-0+05a4 <[^>]*> 41700000 	sigrie	0x0
-0+05a8 <[^>]*> 4170ffff 	sigrie	0xffff
+0+05a4 <[^>]*> 04170000 	sigrie	0x0
+0+05a8 <[^>]*> 0417ffff 	sigrie	0xffff
 	\.\.\.
diff --git a/gas/testsuite/gas/mips/r6-n64.d b/gas/testsuite/gas/mips/r6-n64.d
index fd4da21f..fa0e86b1 100644
--- a/gas/testsuite/gas/mips/r6-n64.d
+++ b/gas/testsuite/gas/mips/r6-n64.d
@@ -753,6 +753,6 @@  Disassembly of section .text:
 0+0598 <[^>]*> 41600024 	dvp
 0+059c <[^>]*> 41620004 	evp	v0
 0+05a0 <[^>]*> 41620024 	dvp	v0
-0+05a4 <[^>]*> 41700000 	sigrie	0x0
-0+05a8 <[^>]*> 4170ffff 	sigrie	0xffff
+0+05a4 <[^>]*> 04170000 	sigrie	0x0
+0+05a8 <[^>]*> 0417ffff 	sigrie	0xffff
 	\.\.\.
diff --git a/gas/testsuite/gas/mips/r6.d b/gas/testsuite/gas/mips/r6.d
index 8588e92e..9faa478a 100644
--- a/gas/testsuite/gas/mips/r6.d
+++ b/gas/testsuite/gas/mips/r6.d
@@ -496,6 +496,6 @@  Disassembly of section .text:
 0+0598 <[^>]*> 41600024 	dvp
 0+059c <[^>]*> 41620004 	evp	v0
 0+05a0 <[^>]*> 41620024 	dvp	v0
-0+05a4 <[^>]*> 41700000 	sigrie	0x0
-0+05a8 <[^>]*> 4170ffff 	sigrie	0xffff
+0+05a4 <[^>]*> 04170000 	sigrie	0x0
+0+05a8 <[^>]*> 0417ffff 	sigrie	0xffff
 	\.\.\.
diff --git a/opcodes/mips-opc.c b/opcodes/mips-opc.c
index 180d613c..b0c61953 100644
--- a/opcodes/mips-opc.c
+++ b/opcodes/mips-opc.c
@@ -1867,7 +1867,7 @@  const struct mips_opcode mips_builtin_opcodes[] =
 {"shfl.repa.qh",	"X,Y,Z",	0x7b20001f, 0xffe0003f, WR_1|RD_2|RD_3|FP_D,	0,		0,		MX,	0 },
 {"shfl.repb.qh",	"X,Y,Z",	0x7ba0001f, 0xffe0003f, WR_1|RD_2|RD_3|FP_D,	0,		0,		MX,	0 },
 {"shfl.upsl.ob",	"X,Y,Z",	0x78c0001f, 0xffe0003f, WR_1|RD_2|RD_3|FP_D,	0,		SB1,		MX,	0 },
-{"sigrie",		"u",		0x41700000, 0xffff0000,	TRAP,			0,		I37,		0,	0 },
+{"sigrie",		"u",		0x04170000, 0xffff0000,	TRAP,			0,		I37,		0,	0 },
 {"sle",			"d,v,t",	0,    (int) M_SLE,	INSN_MACRO,		0,		I1,		0,	0 },
 {"sle",			"d,v,I",	0,    (int) M_SLE_I,	INSN_MACRO,		0,		I1,		0,	0 },
 {"sle",			"S,T",		0x46a0003e, 0xffe007ff,	RD_1|RD_2|WR_CC|FP_D,	0,		IL2E,		0,	0 },
-- 
2.13.6