qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 5/5] target-mips: Add accessors for the two 32-bit h


From: Richard Henderson
Subject: [Qemu-devel] [PATCH 5/5] target-mips: Add accessors for the two 32-bit halves of a 64-bit FPR
Date: Fri, 30 Mar 2012 13:05:44 -0400

Not much used yet, but more users to come.

Signed-off-by: Richard Henderson <address@hidden>
---
 target-mips/translate.c |   46 ++++++++++++++++++++++++++++++----------------
 1 files changed, 30 insertions(+), 16 deletions(-)

diff --git a/target-mips/translate.c b/target-mips/translate.c
index 10d8407..2396339 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -750,6 +750,29 @@ static void gen_store_fpr64(DisasContext *ctx, TCGv_i64 t, 
int reg)
     }
 }
 
+static void gen_load_fpr_pair(DisasContext *ctx, TCGv_i32 tl,
+                              TCGv_i32 th, int reg)
+{
+    gen_load_fpr32(ctx, tl, reg);
+    gen_load_fpr32h(ctx, th, reg);
+}
+
+static void gen_store_fpr_pair(DisasContext *ctx, TCGv_i32 tl,
+                               TCGv_i32 th, int reg)
+{
+#if TCG_TARGET_REG_BITS == 32
+    tcg_gen_mov_i32(TCGV_LOW(fpu_f64[reg]), tl);
+    tcg_gen_mov_i32(TCGV_HIGH(fpu_f64[reg]), th);
+#else
+    if (ctx->hflags & MIPS_HFLAG_F64) {
+        tcg_gen_concat32_i64(fpu_f64[reg], tl, th);
+    } else {
+        tcg_gen_mov_i32(fpu_f32[reg], tl);
+        tcg_gen_mov_i32(fpu_fh32[reg], th);
+    }
+#endif
+}
+
 static inline int get_fp_bit (int cc)
 {
     if (cc)
@@ -7691,8 +7714,7 @@ static void gen_farith (DisasContext *ctx, enum fopcode 
op1,
 
             gen_load_fpr32(ctx, fp0, fs);
             gen_load_fpr32(ctx, fp1, ft);
-            gen_store_fpr32h(ctx, fp0, fd);
-            gen_store_fpr32(ctx, fp1, fd);
+            gen_store_fpr_pair(ctx, fp1, fp0, fd);
             tcg_temp_free_i32(fp0);
             tcg_temp_free_i32(fp1);
         }
@@ -7706,8 +7728,7 @@ static void gen_farith (DisasContext *ctx, enum fopcode 
op1,
 
             gen_load_fpr32(ctx, fp0, fs);
             gen_load_fpr32h(ctx, fp1, ft);
-            gen_store_fpr32(ctx, fp1, fd);
-            gen_store_fpr32h(ctx, fp0, fd);
+            gen_store_fpr_pair(ctx, fp1, fp0, fd);
             tcg_temp_free_i32(fp0);
             tcg_temp_free_i32(fp1);
         }
@@ -7721,8 +7742,7 @@ static void gen_farith (DisasContext *ctx, enum fopcode 
op1,
 
             gen_load_fpr32h(ctx, fp0, fs);
             gen_load_fpr32(ctx, fp1, ft);
-            gen_store_fpr32(ctx, fp1, fd);
-            gen_store_fpr32h(ctx, fp0, fd);
+            gen_store_fpr_pair(ctx, fp1, fp0, fd);
             tcg_temp_free_i32(fp0);
             tcg_temp_free_i32(fp1);
         }
@@ -7736,8 +7756,7 @@ static void gen_farith (DisasContext *ctx, enum fopcode 
op1,
 
             gen_load_fpr32h(ctx, fp0, fs);
             gen_load_fpr32h(ctx, fp1, ft);
-            gen_store_fpr32(ctx, fp1, fd);
-            gen_store_fpr32h(ctx, fp0, fd);
+            gen_store_fpr_pair(ctx, fp1, fp0, fd);
             tcg_temp_free_i32(fp0);
             tcg_temp_free_i32(fp1);
         }
@@ -7909,10 +7928,8 @@ static void gen_flt3_arith (DisasContext *ctx, uint32_t 
opc,
             tcg_gen_andi_tl(t0, t0, 0x7);
 
             tcg_gen_brcondi_tl(TCG_COND_NE, t0, 0, l1);
-            gen_load_fpr32(ctx, fp, fs);
-            gen_load_fpr32h(ctx, fph, fs);
-            gen_store_fpr32(ctx, fp, fd);
-            gen_store_fpr32h(ctx, fph, fd);
+            gen_load_fpr_pair(ctx, fp, fph, fs);
+            gen_store_fpr_pair(ctx, fp, fph, fd);
             tcg_gen_br(l2);
             gen_set_label(l1);
             tcg_gen_brcondi_tl(TCG_COND_NE, t0, 4, l2);
@@ -7920,14 +7937,11 @@ static void gen_flt3_arith (DisasContext *ctx, uint32_t 
opc,
 #ifdef TARGET_WORDS_BIGENDIAN
             gen_load_fpr32(ctx, fp, fs);
             gen_load_fpr32h(ctx, fph, ft);
-            gen_store_fpr32h(ctx, fp, fd);
-            gen_store_fpr32(ctx, fph, fd);
 #else
             gen_load_fpr32h(ctx, fph, fs);
             gen_load_fpr32(ctx, fp, ft);
-            gen_store_fpr32(ctx, fph, fd);
-            gen_store_fpr32h(ctx, fp, fd);
 #endif
+            gen_store_fpr_pair(ctx, fph, fp, fd);
             gen_set_label(l2);
             tcg_temp_free_i32(fp);
             tcg_temp_free_i32(fph);
-- 
1.7.7.6




reply via email to

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