public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PATCH: Remove SIMD_Fixup in x86 disassembler
@ 2007-08-30  8:10 H.J. Lu
  0 siblings, 0 replies; only message in thread
From: H.J. Lu @ 2007-08-30  8:10 UTC (permalink / raw)
  To: binutils

Currently x86 disassembler does

bash-3.2$ cat x.s
        movhlps %xmm1,%xmm0
        .byte 0x0f,0x13,0xc8 
bash-3.2$ gcc -c x.s
bash-3.2$ /usr/bin/objdump -d x.o

x.o:     file format elf64-x86-64

Disassembly of section .text:

0000000000000000 <.text>:
   0:   0f 12 c1                movhlps %xmm1,%xmm0
   3:   0f 13 c8                movhlps %xmm1,%xmm0

"0f 13 c8" isn't "movhlps %xmm1,%xmm0". I am checking in this
patch to fix it. Now I got

bash-3.2$ ./objdump -d x.o

x.o:     file format elf64-x86-64

Disassembly of section .text:

0000000000000000 <.text>:
   0:   0f 12 c1                movhlps %xmm1,%xmm0
   3:   0f 13                   (bad)  
   5:   c8                      .byte 0xc8
bash-3.2$ 


H.J.
----
2007-08-29  H.J. Lu  <hongjiu.lu@intel.com>

	* i386-dis.c (SIMD_Fixup): Removed.
	(OPC_EXT_34...OPC_EXT_37): New.
	(dis386_twobyte): Use OPC_EXT_34 and OPC_EXT_35.
	(prefix_user_table): Use OPC_EXT_36 and OPC_EXT_37.
	(opc_ext_table): Add OPC_EXT_34...OPC_EXT_37.

--- opcodes/i386-dis.c.foo	2007-08-29 14:25:31.000000000 -0700
+++ opcodes/i386-dis.c	2007-08-29 17:43:12.000000000 -0700
@@ -94,7 +94,6 @@ static void NOP_Fixup1 (int, int);
 static void NOP_Fixup2 (int, int);
 static void OP_3DNowSuffix (int, int);
 static void OP_SIMD_Suffix (int, int);
-static void SIMD_Fixup (int, int);
 static void SVME_Fixup (int, int);
 static void INVLPG_Fixup (int, int);
 static void BadOp (void);
@@ -593,6 +592,10 @@ fetch_data (struct disassemble_info *inf
 #define OPC_EXT_31 NULL, { { NULL, USE_OPC_EXT_TABLE }, { NULL, 31 } }
 #define OPC_EXT_32 NULL, { { NULL, USE_OPC_EXT_TABLE }, { NULL, 32 } }
 #define OPC_EXT_33 NULL, { { NULL, USE_OPC_EXT_TABLE }, { NULL, 33 } }
+#define OPC_EXT_34 NULL, { { NULL, USE_OPC_EXT_TABLE }, { NULL, 34 } }
+#define OPC_EXT_35 NULL, { { NULL, USE_OPC_EXT_TABLE }, { NULL, 35 } }
+#define OPC_EXT_36 NULL, { { NULL, USE_OPC_EXT_TABLE }, { NULL, 36 } }
+#define OPC_EXT_37 NULL, { { NULL, USE_OPC_EXT_TABLE }, { NULL, 37 } }
 
 #define OPC_EXT_RM_0  NULL, { { NULL, USE_OPC_EXT_RM_TABLE }, { NULL, 0 } }
 #define OPC_EXT_RM_1  NULL, { { NULL, USE_OPC_EXT_RM_TABLE }, { NULL, 1 } }
@@ -966,11 +969,11 @@ static const struct dis386 dis386_twobyt
   { PREGRP8 },
   { PREGRP9 },
   { PREGRP30 },
-  { "movlpX",		{ EXq, XM, { SIMD_Fixup, 'h' } } },
+  { OPC_EXT_34 },
   { "unpcklpX",		{ XM, EXq } },
   { "unpckhpX",		{ XM, EXq } },
   { PREGRP31 },
-  { "movhpX",		{ EXq, XM, { SIMD_Fixup, 'l' } } },
+  { OPC_EXT_35 },
   /* 18 */
   { GRP16 },
   { "(bad)",		{ XX } },
@@ -1890,14 +1893,14 @@ static const struct dis386 prefix_user_t
   },
   /* PREGRP30 */
   {
-    { "movlpX",	{ XM, EXq, { SIMD_Fixup, 'h' } } }, /* really only 2 operands */
+    { OPC_EXT_36 },
     { "movsldup", { XM, EXx } },
     { "movlpd",	{ XM, EXq } },
     { "movddup", { XM, EXq } },
   },
   /* PREGRP31 */
   {
-    { "movhpX",	{ XM, EXq, { SIMD_Fixup, 'l' } } },
+    { OPC_EXT_37 },
     { "movshdup", { XM, EXx } },
     { "movhpd",	{ XM, EXq } },
     { "(bad)",	{ XM, EXq } },
@@ -3229,6 +3232,26 @@ static const struct dis386 opc_ext_table
     { "bound{S|}",	{ Gv, Ma } },
     { "(bad)",		{ XX } },
   },
+  {
+    /* OPC_EXT_34 */
+    { "movlpX",		{ EXq, XM } },
+    { "(bad)",		{ XX } },
+  },
+  {
+    /* OPC_EXT_35 */
+    { "movhpX",		{ EXq, XM } },
+    { "(bad)",		{ XX } },
+  },
+  {
+    /* OPC_EXT_36 */
+    { "movlpX",		{ XM, EXq } },
+    { "movhlpX",	{ XM, EXq } },
+  },
+  {
+    /* OPC_EXT_37 */
+    { "movhpX",		{ XM, EXq } },
+    { "movlhpX",	{ XM, EXq } },
+  },
 };
 
 static const struct dis386 opc_ext_rm_table[][8] = {
@@ -6208,22 +6231,6 @@ OP_SIMD_Suffix (int bytemode ATTRIBUTE_U
 }
 
 static void
-SIMD_Fixup (int extrachar, int sizeflag ATTRIBUTE_UNUSED)
-{
-  /* Change movlps/movhps to movhlps/movlhps for 2 register operand
-     forms of these instructions.  */
-  if (modrm.mod == 3)
-    {
-      char *p = obuf + strlen (obuf);
-      *(p + 1) = '\0';
-      *p       = *(p - 1);
-      *(p - 1) = *(p - 2);
-      *(p - 2) = *(p - 3);
-      *(p - 3) = extrachar;
-    }
-}
-
-static void
 OP_Mwait (int bytemode ATTRIBUTE_UNUSED,
 	  int sizeflag ATTRIBUTE_UNUSED)
 {

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

only message in thread, other threads:[~2007-08-30  5:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-30  8:10 PATCH: Remove SIMD_Fixup in x86 disassembler H.J. Lu

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