This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: Replace rex64XYZ with rex.WRXB


On Wed, Mar 21, 2007 at 02:20:39PM -0700, H. J. Lu wrote:
> On Wed, Mar 21, 2007 at 12:38:38PM -0700, H. J. Lu wrote:
> > The hardware spec uses REX.W/REX.R/REX.X/REX.B. But x86 binutils uses
> > REX_MODE64/REX_EXTX/REX_EXTY/REX_EXTZ. I have to do a translation
> > when I read the code. I suggest we repleace them with
> > REX_W/REX_R/REX_X/REX_B. Dissassembler will print rexWRXB instead of
> > rex64XYZ.
> > 
> 
> I am checking in this patch. I am not sure what to do with rex64XYZ.
> If I use rexw, rexr, rexx and rexb, rexx will map to a different
> byte. Should I use rex_w, rex_r, rex_x and rex_b and leave the old
> rexX alone for backward compatibility?
> 
> What about the disassembler output? Should I use rex_w, rex_r, rex_x
> and rex_b? The old one is hard to understand, especially when
> you are looking the spec at the same time.
> 
> 

This is a followup patch. I added rex.WRXB to assembler. The old
rex64XYZ still works. The disassembler output is changed from
rex64XYZ to rex.WRXB.

BTW, will '.' in mnemonic be a problem?


H.J.
----
gas/

2003-03-22  H.J. Lu  <hongjiu.lu@intel.com>

	* config/tc-i386.c (md_begin): Allow '.' in mnemonic.

gas/testsuite/

2003-03-22  H.J. Lu  <hongjiu.lu@intel.com>

	* gas/i386/rex.s: Add tests for rex.WRXB.
	* gas/i386/rex.d: Updated.

	* gas/i386/rex.d: Replace rex64XYZ with rex.WRXB.
	* gas/i386/x86-64-io-intel.d : Likewise.
	* gas/i386/x86-64-io-suffix.d: Likewise.
	* gas/i386/x86-64-io.d: Likewise.
	* gas/i386/x86-64-opcode.d: Likewise.

opcodes/

2003-03-22  H.J. Lu  <hongjiu.lu@intel.com>

	* i386-dis.c (prefix_name): Replace rex64XYZ with rex.WRXB.

	* i386-opc.c (i386_optab): Add rex.wrxb.

--- binutils/gas/config/tc-i386.c.rex	2007-03-22 10:27:58.000000000 -0700
+++ binutils/gas/config/tc-i386.c	2007-03-22 11:48:43.000000000 -0700
@@ -1294,6 +1294,7 @@ md_begin ()
 #endif
     digit_chars['-'] = '-';
     mnemonic_chars['-'] = '-';
+    mnemonic_chars['.'] = '.';
     identifier_chars['_'] = '_';
     identifier_chars['.'] = '.';
 
--- binutils/gas/testsuite/gas/i386/rex.d.rex	2006-09-20 04:35:11.000000000 -0700
+++ binutils/gas/testsuite/gas/i386/rex.d	2007-03-22 12:18:05.000000000 -0700
@@ -7,11 +7,27 @@ Disassembly of section .text:
 
 0+ <_start>:
 [	 ]*[0-9a-f]+:[	 ]+40 0f ae 00[	 ]+rex fxsavel?[	 ]+\(%rax\)
-[	 ]*[0-9a-f]+:[	 ]+48 0f ae 00[	 ]+(rex64 )?fxsaveq?[	 ]+\(%rax\)
+[	 ]*[0-9a-f]+:[	 ]+48 0f ae 00[	 ]+(rex.W )?fxsaveq?[	 ]+\(%rax\)
 [	 ]*[0-9a-f]+:[	 ]+41 0f ae 00[	 ]+fxsavel?[	 ]+\(%r8\)
-[	 ]*[0-9a-f]+:[	 ]+49 0f ae 00[	 ]+(rex64Z? )?fxsaveq?[	 ]+\(%r8\)
+[	 ]*[0-9a-f]+:[	 ]+49 0f ae 00[	 ]+(rex.WB? )?fxsaveq?[	 ]+\(%r8\)
 [	 ]*[0-9a-f]+:[	 ]+42 0f ae 04 05 00 00 00 00[	 ]+fxsavel?[	 ]+(0x0)?\(,%r8(,1)?\)
-[	 ]*[0-9a-f]+:[	 ]+4a 0f ae 04 05 00 00 00 00[	 ]+(rex64Y? )?fxsaveq?[	 ]+(0x0)?\(,%r8(,1)?\)
+[	 ]*[0-9a-f]+:[	 ]+4a 0f ae 04 05 00 00 00 00[	 ]+(rex.WX? )?fxsaveq?[	 ]+(0x0)?\(,%r8(,1)?\)
 [	 ]*[0-9a-f]+:[	 ]+43 0f ae 04 00[	 ]+fxsavel?[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	rex.WB
+	rex.WX
+	rex.WXB
+	rex.WR
+	rex.WRB
+	rex.WRX
+	rex.WRXB
--- binutils/gas/testsuite/gas/i386/x86-64-io-intel.d.rex	2006-12-01 07:00:12.000000000 -0800
+++ binutils/gas/testsuite/gas/i386/x86-64-io-intel.d	2007-03-22 12:12:24.000000000 -0700
@@ -1,28 +1,28 @@
 #source: x86-64-io.s
 #objdump: -dwMintel
-#name: x86-64 rex64 in/out (Intel disassembly)
+#name: x86-64 rex.W in/out (Intel disassembly)
 
 .*: +file format .*
 
 Disassembly of section .text:
 
 0+000 <_in>:
-   0:	48 ed                	rex64 in     eax,dx
+   0:	48 ed                	rex.W in     eax,dx
    2:	66                   	data16
-   3:	48 ed                	rex64 in     eax,dx
+   3:	48 ed                	rex.W in     eax,dx
 
 0+005 <_out>:
-   5:	48 ef                	rex64 out    dx,eax
+   5:	48 ef                	rex.W out    dx,eax
    7:	66                   	data16
-   8:	48 ef                	rex64 out    dx,eax
+   8:	48 ef                	rex.W out    dx,eax
 
 0+00a <_ins>:
-   a:	48 6d                	rex64 ins    DWORD PTR es:\[rdi\],dx
+   a:	48 6d                	rex.W ins    DWORD PTR es:\[rdi\],dx
    c:	66                   	data16
-   d:	48 6d                	rex64 ins    DWORD PTR es:\[rdi\],dx
+   d:	48 6d                	rex.W ins    DWORD PTR es:\[rdi\],dx
 
 0+00f <_outs>:
-   f:	48 6f                	rex64 outs   dx,DWORD PTR ds:\[rsi\]
+   f:	48 6f                	rex.W outs   dx,DWORD PTR ds:\[rsi\]
   11:	66                   	data16
-  12:	48 6f                	rex64 outs   dx,DWORD PTR ds:\[rsi\]
+  12:	48 6f                	rex.W outs   dx,DWORD PTR ds:\[rsi\]
 #pass
--- binutils/gas/testsuite/gas/i386/x86-64-io-suffix.d.rex	2006-12-01 07:00:12.000000000 -0800
+++ binutils/gas/testsuite/gas/i386/x86-64-io-suffix.d	2007-03-22 12:12:35.000000000 -0700
@@ -1,28 +1,28 @@
 #source: x86-64-io.s
 #objdump: -dwMsuffix
-#name: x86-64 rex64 in/out w/ suffix
+#name: x86-64 rex.W in/out w/ suffix
 
 .*: +file format .*
 
 Disassembly of section .text:
 
 0+000 <_in>:
-   0:	48 ed                	rex64 inl    \(%dx\),%eax
+   0:	48 ed                	rex.W inl    \(%dx\),%eax
    2:	66                   	data16
-   3:	48 ed                	rex64 inl    \(%dx\),%eax
+   3:	48 ed                	rex.W inl    \(%dx\),%eax
 
 0+005 <_out>:
-   5:	48 ef                	rex64 outl   %eax,\(%dx\)
+   5:	48 ef                	rex.W outl   %eax,\(%dx\)
    7:	66                   	data16
-   8:	48 ef                	rex64 outl   %eax,\(%dx\)
+   8:	48 ef                	rex.W outl   %eax,\(%dx\)
 
 0+00a <_ins>:
-   a:	48 6d                	rex64 insl   \(%dx\),%es:\(%rdi\)
+   a:	48 6d                	rex.W insl   \(%dx\),%es:\(%rdi\)
    c:	66                   	data16
-   d:	48 6d                	rex64 insl   \(%dx\),%es:\(%rdi\)
+   d:	48 6d                	rex.W insl   \(%dx\),%es:\(%rdi\)
 
 0+00f <_outs>:
-   f:	48 6f                	rex64 outsl  %ds:\(%rsi\),\(%dx\)
+   f:	48 6f                	rex.W outsl  %ds:\(%rsi\),\(%dx\)
   11:	66                   	data16
-  12:	48 6f                	rex64 outsl  %ds:\(%rsi\),\(%dx\)
+  12:	48 6f                	rex.W outsl  %ds:\(%rsi\),\(%dx\)
 #pass
--- binutils/gas/testsuite/gas/i386/x86-64-io.d.rex	2006-12-01 07:00:12.000000000 -0800
+++ binutils/gas/testsuite/gas/i386/x86-64-io.d	2007-03-22 12:12:09.000000000 -0700
@@ -1,27 +1,27 @@
 #objdump: -dw
-#name: x86-64 rex64 in/out
+#name: x86-64 rex.W in/out
 
 .*: +file format .*
 
 Disassembly of section .text:
 
 0+000 <_in>:
-   0:	48 ed                	rex64 in     \(%dx\),%eax
+   0:	48 ed                	rex.W in     \(%dx\),%eax
    2:	66                   	data16
-   3:	48 ed                	rex64 in     \(%dx\),%eax
+   3:	48 ed                	rex.W in     \(%dx\),%eax
 
 0+005 <_out>:
-   5:	48 ef                	rex64 out    %eax,\(%dx\)
+   5:	48 ef                	rex.W out    %eax,\(%dx\)
    7:	66                   	data16
-   8:	48 ef                	rex64 out    %eax,\(%dx\)
+   8:	48 ef                	rex.W out    %eax,\(%dx\)
 
 0+00a <_ins>:
-   a:	48 6d                	rex64 insl   \(%dx\),%es:\(%rdi\)
+   a:	48 6d                	rex.W insl   \(%dx\),%es:\(%rdi\)
    c:	66                   	data16
-   d:	48 6d                	rex64 insl   \(%dx\),%es:\(%rdi\)
+   d:	48 6d                	rex.W insl   \(%dx\),%es:\(%rdi\)
 
 0+00f <_outs>:
-   f:	48 6f                	rex64 outsl  %ds:\(%rsi\),\(%dx\)
+   f:	48 6f                	rex.W outsl  %ds:\(%rsi\),\(%dx\)
   11:	66                   	data16
-  12:	48 6f                	rex64 outsl  %ds:\(%rsi\),\(%dx\)
-#pass
\ No newline at end of file
+  12:	48 6f                	rex.W outsl  %ds:\(%rsi\),\(%dx\)
+#pass
--- binutils/gas/testsuite/gas/i386/x86-64-opcode.d.rex	2007-03-21 13:47:06.000000000 -0700
+++ binutils/gas/testsuite/gas/i386/x86-64-opcode.d	2007-03-22 12:12:48.000000000 -0700
@@ -272,7 +272,7 @@ Disassembly of section .text:
 [	 ]*[0-9a-f]+:[	 ]+66 90[	 ]+xchg[	 ]+%ax,%ax[	 ]*(#.*)*
 [	 ]*[0-9a-f]+:[	 ]+87 c0[	 ]+xchg[	 ]+%eax,%eax[	 ]*(#.*)*
 [	 ]*[0-9a-f]+:[	 ]+90[	 ]+nop[	 ]*(#.*)*
-[	 ]*[0-9a-f]+:[	 ]+48 90[	 ]+rex64 nop[	 ]*(#.*)*
+[	 ]*[0-9a-f]+:[	 ]+48 90[	 ]+rex.W nop[	 ]*(#.*)*
 [	 ]*[0-9a-f]+:[	 ]+49 90[	 ]+xchg[	 ]+%rax,%r8[	 ]*(#.*)*
 [	 ]*[0-9a-f]+:[	 ]+41 90[	 ]+xchg[	 ]+%eax,%r8d[	 ]*(#.*)*
 [	 ]*[0-9a-f]+:[	 ]+41 90[	 ]+xchg[	 ]+%eax,%r8d[	 ]*(#.*)*
--- binutils/opcodes/i386-dis.c.rex	2007-03-21 14:24:12.000000000 -0700
+++ binutils/opcodes/i386-dis.c	2007-03-22 12:19:43.000000000 -0700
@@ -2734,41 +2734,46 @@ ckprefix (void)
 static const char *
 prefix_name (int pref, int sizeflag)
 {
+  static const char *rexes [16] =
+    {
+      "rex",		/* 0x40 */
+      "rex.B",		/* 0x41 */
+      "rex.X",		/* 0x42 */
+      "rex.XB",		/* 0x43 */
+      "rex.R",		/* 0x44 */
+      "rex.RB",		/* 0x45 */
+      "rex.RX",		/* 0x46 */
+      "rex.RXB",	/* 0x47 */
+      "rex.W",		/* 0x48 */
+      "rex.WB",		/* 0x49 */
+      "rex.WX",		/* 0x4a */
+      "rex.WXB",	/* 0x4b */
+      "rex.WR",		/* 0x4c */
+      "rex.WRB",	/* 0x4d */
+      "rex.WRX",	/* 0x4e */
+      "rex.WRXB",	/* 0x4f */
+    };
+
   switch (pref)
     {
     /* REX prefixes family.  */
     case 0x40:
-      return "rex";
     case 0x41:
-      return "rexZ";
     case 0x42:
-      return "rexY";
     case 0x43:
-      return "rexYZ";
     case 0x44:
-      return "rexX";
     case 0x45:
-      return "rexXZ";
     case 0x46:
-      return "rexXY";
     case 0x47:
-      return "rexXYZ";
     case 0x48:
-      return "rex64";
     case 0x49:
-      return "rex64Z";
     case 0x4a:
-      return "rex64Y";
     case 0x4b:
-      return "rex64YZ";
     case 0x4c:
-      return "rex64X";
     case 0x4d:
-      return "rex64XZ";
     case 0x4e:
-      return "rex64XY";
     case 0x4f:
-      return "rex64XYZ";
+      return rexes [pref - 0x40];
     case 0xf3:
       return "repz";
     case 0xf2:
--- binutils/opcodes/i386-opc.c.rex	2007-03-21 13:47:06.000000000 -0700
+++ binutils/opcodes/i386-opc.c	2007-03-22 12:32:51.000000000 -0700
@@ -846,6 +846,21 @@ const template i386_optab[] =
 {"rex64xz",0,	0x4d, X, Cpu64,	 NoSuf|IsPrefix,	{ 0, 0, 0} },
 {"rex64xy",0,	0x4e, X, Cpu64,	 NoSuf|IsPrefix,	{ 0, 0, 0} },
 {"rex64xyz",0,	0x4f, X, Cpu64,	 NoSuf|IsPrefix,	{ 0, 0, 0} },
+{"rex.b",  0,	0x41, X, Cpu64,	 NoSuf|IsPrefix,	{ 0, 0, 0} },
+{"rex.x",  0,	0x42, X, Cpu64,	 NoSuf|IsPrefix,	{ 0, 0, 0} },
+{"rex.xb", 0,	0x43, X, Cpu64,	 NoSuf|IsPrefix,	{ 0, 0, 0} },
+{"rex.r",  0,	0x44, X, Cpu64,	 NoSuf|IsPrefix,	{ 0, 0, 0} },
+{"rex.rb", 0,	0x45, X, Cpu64,	 NoSuf|IsPrefix,	{ 0, 0, 0} },
+{"rex.rx", 0,	0x46, X, Cpu64,	 NoSuf|IsPrefix,	{ 0, 0, 0} },
+{"rex.rxb",0,	0x47, X, Cpu64,	 NoSuf|IsPrefix,	{ 0, 0, 0} },
+{"rex.w",  0,	0x48, X, Cpu64,	 NoSuf|IsPrefix,	{ 0, 0, 0} },
+{"rex.wb", 0,	0x49, X, Cpu64,	 NoSuf|IsPrefix,	{ 0, 0, 0} },
+{"rex.wx", 0,	0x4a, X, Cpu64,	 NoSuf|IsPrefix,	{ 0, 0, 0} },
+{"rex.wxb",0,	0x4b, X, Cpu64,	 NoSuf|IsPrefix,	{ 0, 0, 0} },
+{"rex.wr", 0,	0x4c, X, Cpu64,	 NoSuf|IsPrefix,	{ 0, 0, 0} },
+{"rex.wrb",0,	0x4d, X, Cpu64,	 NoSuf|IsPrefix,	{ 0, 0, 0} },
+{"rex.wrx",0,	0x4e, X, Cpu64,	 NoSuf|IsPrefix,	{ 0, 0, 0} },
+{"rex.wrxb",0,	0x4f, X, Cpu64,	 NoSuf|IsPrefix,	{ 0, 0, 0} },
 
 /* 486 extensions.  */
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]