PR30120: fix x87 fucomp misassembled

Message ID alpine.LSU.2.20.2302131741480.29328@wotan.suse.de
State Repeat Merge
Headers
Series PR30120: fix x87 fucomp misassembled |

Checks

Context Check Description
snail/binutils-gdb-check warning Git am fail log

Commit Message

Michael Matz Feb. 13, 2023, 5:42 p.m. UTC
  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(-)
  

Patch

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,