Patchwork [13/18] tcg/arm: use ext* ops in qemu_ld

login
register
mail settings
Submitter Aurelien Jarno
Date April 7, 2010, 5:51 p.m.
Message ID <1270662685-7379-14-git-send-email-aurelien@aurel32.net>
Download mbox | patch
Permalink /patch/49630/
State New
Headers show

Comments

Aurelien Jarno - April 7, 2010, 5:51 p.m.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 tcg/arm/tcg-target.c |   30 ++++++++++++------------------
 1 files changed, 12 insertions(+), 18 deletions(-)

Patch

diff --git a/tcg/arm/tcg-target.c b/tcg/arm/tcg-target.c
index d24a245..33ca2ca 100644
--- a/tcg/arm/tcg-target.c
+++ b/tcg/arm/tcg-target.c
@@ -475,6 +475,12 @@  static inline void tcg_out_ext8s(TCGContext *s, int cond,
 #endif
 }
 
+static inline void tcg_out_ext8u(TCGContext *s, int cond,
+                                 int rd, int rn)
+{
+    tcg_out_dat_imm(s, cond, ARITH_AND, rd, rn, 0xff);
+}
+
 static inline void tcg_out_ext16s(TCGContext *s, int cond,
                                   int rd, int rn)
 {
@@ -999,16 +1005,10 @@  static inline void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, int opc)
 
     switch (opc) {
     case 0 | 4:
-        tcg_out_dat_reg(s, COND_AL, ARITH_MOV,
-                        TCG_REG_R0, 0, TCG_REG_R0, SHIFT_IMM_LSL(24));
-        tcg_out_dat_reg(s, COND_AL, ARITH_MOV,
-                        data_reg, 0, TCG_REG_R0, SHIFT_IMM_ASR(24));
+        tcg_out_ext8s(s, COND_AL, data_reg, TCG_REG_R0);
         break;
     case 1 | 4:
-        tcg_out_dat_reg(s, COND_AL, ARITH_MOV,
-                        TCG_REG_R0, 0, TCG_REG_R0, SHIFT_IMM_LSL(16));
-        tcg_out_dat_reg(s, COND_AL, ARITH_MOV,
-                        data_reg, 0, TCG_REG_R0, SHIFT_IMM_ASR(16));
+        tcg_out_ext16s(s, COND_AL, data_reg, TCG_REG_R0);
         break;
     case 0:
     case 1:
@@ -1173,14 +1173,11 @@  static inline void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, int opc)
 # if TARGET_LONG_BITS == 32
     switch (opc) {
     case 0:
-        tcg_out_dat_imm(s, COND_AL, ARITH_AND, TCG_REG_R1, data_reg, 0xff);
+        tcg_out_ext8u(s, COND_AL, TCG_REG_R1, data_reg);
         tcg_out_dat_imm(s, COND_AL, ARITH_MOV, TCG_REG_R2, 0, mem_index);
         break;
     case 1:
-        tcg_out_dat_reg(s, COND_AL, ARITH_MOV,
-                        TCG_REG_R1, 0, data_reg, SHIFT_IMM_LSL(16));
-        tcg_out_dat_reg(s, COND_AL, ARITH_MOV,
-                        TCG_REG_R1, 0, TCG_REG_R1, SHIFT_IMM_LSR(16));
+        tcg_out_ext16u(s, COND_AL, TCG_REG_R1, data_reg);
         tcg_out_dat_imm(s, COND_AL, ARITH_MOV, TCG_REG_R2, 0, mem_index);
         break;
     case 2:
@@ -1209,14 +1206,11 @@  static inline void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, int opc)
     }
     switch (opc) {
     case 0:
-        tcg_out_dat_imm(s, COND_AL, ARITH_AND, TCG_REG_R2, data_reg, 0xff);
+        tcg_out_ext8u(s, COND_AL, TCG_REG_R2, data_reg);
         tcg_out_dat_imm(s, COND_AL, ARITH_MOV, TCG_REG_R3, 0, mem_index);
         break;
     case 1:
-        tcg_out_dat_reg(s, COND_AL, ARITH_MOV,
-                        TCG_REG_R2, 0, data_reg, SHIFT_IMM_LSL(16));
-        tcg_out_dat_reg(s, COND_AL, ARITH_MOV,
-                        TCG_REG_R2, 0, TCG_REG_R2, SHIFT_IMM_LSR(16));
+        tcg_out_ext16u(s, COND_AL, TCG_REG_R2, data_reg);
         tcg_out_dat_imm(s, COND_AL, ARITH_MOV, TCG_REG_R3, 0, mem_index);
         break;
     case 2: