public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] PR30120: fix x87 fucomp misassembled
@ 2023-02-13 17:42 Michael Matz
  0 siblings, 0 replies; only message in thread
From: Michael Matz @ 2023-02-13 17:42 UTC (permalink / raw)
  To: binutils

this fixes the entry for 'fucomp' to use the correct Reg value
(otherwise it's assembled as 'fucom').
---
Approved by Jan in bugzilla.  I've also added some comparison forms to a 
old testcase.

 gas/testsuite/gas/i386/float.l | 15 ++++++++++++---
 gas/testsuite/gas/i386/float.s |  8 ++++++++
 opcodes/i386-opc.tbl           |  2 +-
 opcodes/i386-tbl.h             |  2 +-
 4 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/gas/testsuite/gas/i386/float.l b/gas/testsuite/gas/i386/float.l
index ec56f555d36..d7b3ca022da 100644
--- a/gas/testsuite/gas/i386/float.l
+++ b/gas/testsuite/gas/i386/float.l
@@ -80,6 +80,15 @@
   67 0080 DEFB [ 	]*fdivrp	%st\(3\)
   68 0082 DEFB [ 	]*fdivrp	%st,%st\(3\)
   69 [ 	]*
-  70 0084 00000000 [ 	]*.p2align	4,0
-  70      00000000 
-  70      00000000 
+  70 0084 DDE9 [ 	]*fucomp %st\(1\)
+  71 0086 DDE2 [ 	]*fucom %st\(2\)
+  72 0088 DAE9 [ 	]*fucompp
+  73 008a DBF2 [ 	]*fcomi %st\(2\)
+  74 008c DFF3 [ 	]*fcomip %st\(3\)
+  75 008e DBEC [ 	]*fucomi %st\(4\)
+  76 0090 DFED [ 	]*fucomip %st\(5\)
+  77 [ 	]*
+  78 0092 00000000 [ 	]*.p2align	4,0
+  78      00000000 
+  78      00000000 
+  78      0000
diff --git a/gas/testsuite/gas/i386/float.s b/gas/testsuite/gas/i386/float.s
index 03d30b7ed74..1388e5b6893 100644
--- a/gas/testsuite/gas/i386/float.s
+++ b/gas/testsuite/gas/i386/float.s
@@ -67,4 +67,12 @@
 	fdivrp	%st(3)
 	fdivrp	%st,%st(3)
 
+	fucomp %st(1)
+	fucom %st(2)
+	fucompp
+	fcomi %st(2)
+	fcomip %st(3)
+	fucomi %st(4)
+	fucomip %st(5)
+
 	.p2align	4,0
diff --git a/opcodes/i386-opc.tbl b/opcodes/i386-opc.tbl
index 4b7b7891e51..2e39b712697 100644
--- a/opcodes/i386-opc.tbl
+++ b/opcodes/i386-opc.tbl
@@ -651,7 +651,7 @@ fcompp, 0xded9, FP, NoSuf, {}
 fucom, 0xdd/4, i387, Modrm|NoSuf, { FloatReg }
 // alias for fucom %st(1)
 fucom, 0xdde1, i387, NoSuf, {}
-fucomp, 0xdd/4, i387, Modrm|NoSuf, { FloatReg }
+fucomp, 0xdd/5, i387, Modrm|NoSuf, { FloatReg }
 // alias for fucomp %st(1)
 fucomp, 0xdde9, i387, NoSuf, {}
 fucompp, 0xdae9, i387, NoSuf, {}
diff --git a/opcodes/i386-tbl.h b/opcodes/i386-tbl.h
index 585a5bb875c..021f607872e 100644
--- a/opcodes/i386-tbl.h
+++ b/opcodes/i386-tbl.h
@@ -5290,7 +5290,7 @@ static const insn_template i386_optab[] =
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
     { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 	  0, 0, 0, 0, 0, 0 } } } },
-  { MN_fucomp, 0xdd, 1, SPACE_BASE, 4,
+  { MN_fucomp, 0xdd, 1, SPACE_BASE, 5,
     { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
     { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
-- 
2.39.1

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-13 17:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-13 17:42 [PATCH] PR30120: fix x87 fucomp misassembled Michael Matz

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).