qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 11/62] tcg-s390: Move tcg_out_mov up and use it thro


From: Richard Henderson
Subject: [Qemu-devel] [PATCH 11/62] tcg-s390: Move tcg_out_mov up and use it throughout.
Date: Thu, 27 May 2010 13:45:53 -0700

Signed-off-by: Richard Henderson <address@hidden>
---
 tcg/s390/tcg-target.c |   42 ++++++++++++++++++++----------------------
 1 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/tcg/s390/tcg-target.c b/tcg/s390/tcg-target.c
index 25c80e6..455cf6a 100644
--- a/tcg/s390/tcg-target.c
+++ b/tcg/s390/tcg-target.c
@@ -315,6 +315,12 @@ static void tcg_out_store(TCGContext* s, int op, int r0, 
int r1, int off)
     tcg_out32(s, (op << 24) | (r0 << 20) | (r1 << 12) | off);
 }
 
+static inline void tcg_out_mov(TCGContext *s, int ret, int arg)
+{
+    /* ??? With a TCGType argument, we could emit the smaller LR insn.  */
+    tcg_out_b9(s, B9_LGR, ret, arg);
+}
+
 /* load a register with an immediate value */
 static inline void tcg_out_movi(TCGContext *s, TCGType type,
                 int ret, tcg_target_long arg)
@@ -386,8 +392,8 @@ static void tcg_prepare_qemu_ldst(TCGContext* s, int 
data_reg, int addr_reg,
     tcg_out_b9(s, B9_LLGFR, arg1, addr_reg);
     tcg_out_b9(s, B9_LLGFR, arg0, addr_reg);
 #else
-    tcg_out_b9(s, B9_LGR, arg1, addr_reg);
-    tcg_out_b9(s, B9_LGR, arg0, addr_reg);
+    tcg_out_mov(s, arg1, addr_reg);
+    tcg_out_mov(s, arg0, addr_reg);
 #endif
 
     tcg_out_sh64(s, SH64_SRLG, arg1, addr_reg, SH64_REG_NONE,
@@ -423,11 +429,11 @@ static void tcg_prepare_qemu_ldst(TCGContext* s, int 
data_reg, int addr_reg,
 #if TARGET_LONG_BITS == 32
     tcg_out_b9(s, B9_LLGFR, arg0, addr_reg);
 #else
-    tcg_out_b9(s, B9_LGR, arg0, addr_reg);
+    tcg_out_mov(s, arg0, addr_reg);
 #endif
 
     if (is_store) {
-        tcg_out_b9(s, B9_LGR, arg1, data_reg);
+        tcg_out_mov(s, arg1, data_reg);
         tcg_out_movi(s, TCG_TYPE_I32, arg2, mem_index);
         tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_R13,
                      (tcg_target_ulong)qemu_st_helpers[s_bits]);
@@ -453,7 +459,7 @@ static void tcg_prepare_qemu_ldst(TCGContext* s, int 
data_reg, int addr_reg,
             break;
         default:
             /* unsigned -> just copy */
-            tcg_out_b9(s, B9_LGR, data_reg, arg0);
+            tcg_out_mov(s, data_reg, arg0);
             break;
         }
     }
@@ -481,7 +487,7 @@ static void tcg_prepare_qemu_ldst(TCGContext* s, int 
data_reg, int addr_reg,
     tcg_out_b9(s, B9_LLGFR, arg0, addr_reg);
 #else
     /* just copy */
-    tcg_out_b9(s, B9_LGR, arg0, addr_reg);
+    tcg_out_mov(s, arg0, addr_reg);
 #endif
     tcg_out_b9(s, B9_AGR, arg0, arg1);
   }
@@ -505,7 +511,7 @@ static void tcg_prepare_qemu_ldst(TCGContext* s, int 
data_reg, int addr_reg,
     if (TARGET_LONG_BITS == 32) {
         tcg_out_b9(s, B9_LLGFR, arg0, addr_reg);
     } else {
-        tcg_out_b9(s, B9_LGR, arg0, addr_reg);
+        tcg_out_mov(s, arg0, addr_reg);
     }
 }
 
@@ -898,15 +904,12 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode 
opc,
             /* sgr %ra0/1, %ra2 */
             tcg_out_b9(s, B9_SGR, args[1], args[2]);
         } else if (args[0] == args[2]) {
-            /* lgr %r13, %raa0/2 */
-            tcg_out_b9(s, B9_LGR, TCG_REG_R13, args[2]);
-            /* lgr %ra0/2, %ra1 */
-            tcg_out_b9(s, B9_LGR, args[0], args[1]);
+            tcg_out_mov(s, TCG_REG_R13, args[2]);
+            tcg_out_mov(s, args[0], args[1]);
             /* sgr %ra0/2, %r13 */
             tcg_out_b9(s, B9_SGR, args[0], TCG_REG_R13);
         } else {
-            /* lgr %ra0, %ra1 */
-            tcg_out_b9(s, B9_LGR, args[0], args[1]);
+            tcg_out_mov(s, args[0], args[1]);
             /* sgr %ra0, %ra2 */
             tcg_out_b9(s, B9_SGR, args[0], args[2]);
         }
@@ -920,7 +923,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
         } else if (args[0] == args[2]) {
             tcg_out_b9(s, B9_AGR, args[0], args[1]);
         } else {
-            tcg_out_b9(s, B9_LGR, args[0], args[1]);
+            tcg_out_mov(s, args[0], args[1]);
             tcg_out_b9(s, B9_AGR, args[0], args[2]);
         }
         break;
@@ -960,7 +963,7 @@ do_logic_i64:
         } else if (args[0] == args[2]) {
             tcg_out_b9(s, op, args[0], args[1]);
         } else {
-            tcg_out_b9(s, B9_LGR, args[0], args[1]);
+            tcg_out_mov(s, args[0], args[1]);
             tcg_out_b9(s, op, args[0], args[2]);
         }
         break;
@@ -987,10 +990,10 @@ do_logic_i64:
         dprintf("op 0x%x neg_i64 0x%lx 0x%lx 0x%lx\n",
                 opc, args[0], args[1], args[2]);
         /* FIXME: optimize args[0] != args[1] case */
-        tcg_out_b9(s, B9_LGR, 13, args[1]);
+        tcg_out_mov(s, TCG_REG_R13, args[1]);
         /* lghi %ra0, 0 */
         tcg_out32(s, S390_INS_LGHI | (args[0] << 20));
-        tcg_out_b9(s, B9_SGR, args[0], 13);
+        tcg_out_b9(s, B9_SGR, args[0], TCG_REG_R13);
         break;
 
     case INDEX_op_mul_i32:
@@ -1334,11 +1337,6 @@ void tcg_target_qemu_prologue(TCGContext *s)
     tcg_out16(s, S390_INS_BR | TCG_REG_R14);
 }
 
-static inline void tcg_out_mov(TCGContext *s, int ret, int arg)
-{
-    tcg_out_b9(s, B9_LGR, ret, arg);
-}
-
 static inline void tcg_out_addi(TCGContext *s, int reg, tcg_target_long val)
 {
     tcg_abort();
-- 
1.7.0.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]