Patchwork [19/21] tcg-i386: Tidy xchg.

login
register
mail settings
Submitter Richard Henderson
Date April 14, 2010, 6:32 p.m.
Message ID <e7e1c5e2f68467702c1050136b85d0b7dfd93e61.1271277329.git.rth@twiddle.net>
Download mbox | patch
Permalink /patch/50195/
State New
Headers show

Comments

Richard Henderson - April 14, 2010, 6:32 p.m.
Define and use OPC_XCHG_ax_r32.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 tcg/i386/tcg-target.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Patch

diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c
index b806d18..d8367b0 100644
--- a/tcg/i386/tcg-target.c
+++ b/tcg/i386/tcg-target.c
@@ -197,6 +197,7 @@  static inline int tcg_target_const_match(tcg_target_long val,
 #define OPC_SHIFT_Ib	(0xc1)
 #define OPC_SHIFT_cl	(0xd3)
 #define OPC_TESTL	(0x85)
+#define OPC_XCHG_ax_r32	(0x90)
 
 #define OPC_GRP3_Ev	(0xf7)
 #define OPC_GRP5	(0xff)
@@ -796,7 +797,8 @@  static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args,
         break;
     case 3:
         if (data_reg == TCG_REG_EDX) {
-            tcg_out_opc(s, 0x90 + TCG_REG_EDX); /* xchg %edx, %eax */
+            /* xchg %edx, %eax */
+            tcg_out_opc(s, OPC_XCHG_ax_r32 + TCG_REG_EDX);
             tcg_out_mov(s, data_reg2, TCG_REG_EAX);
         } else {
             tcg_out_mov(s, data_reg, TCG_REG_EAX);