Skip to contentSkip to conversation

target/mips: Use tcg_constant_* in TX79 & MXU

PATCH In review Philippe Mathieu-Daudé 2 participants 5 messages Aug 8, 2021 – Aug 9, 2021

lore
Share & tools
lore
#0 lore raw

cover target/mips: Use tcg_constant_* in TX79 & MXU

Philippe Mathieu-Daudé (2):
target/mips/tx79: Use tcg_constant_tl()
target/mips/mxu: Use tcg_constant_i32()

 target/mips/tcg/mxu_translate.c  | 6 ++----
 target/mips/tcg/tx79_translate.c | 6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)
Signature · 1 line
2.31.1
#1 lore raw

PATCH 1/2 target/mips/tx79: Use tcg_constant_tl()

Replace uses of tcg_const_tl() with the allocate and free close together.

---
 target/mips/tcg/tx79_translate.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
target/mips/tcg/tx79_translate.c +2 -4
index 6d51fe17c1a..0dacdf2a619 100644
@@ -247,8 +247,8 @@ static bool trans_parallel_compare(DisasContext *ctx, arg_r *a,
         return true;
     }
 
-    c0 = tcg_const_tl(0);
-    c1 = tcg_const_tl(0xffffffff);
+    c0 = tcg_constant_tl(0);
+    c1 = tcg_constant_tl(0xffffffff);
     ax = tcg_temp_new_i64();
     bx = tcg_temp_new_i64();
     t0 = tcg_temp_new_i64();
@@ -279,8 +279,6 @@ static bool trans_parallel_compare(DisasContext *ctx, arg_r *a,
     tcg_temp_free(t0);
     tcg_temp_free(bx);
     tcg_temp_free(ax);
-    tcg_temp_free(c1);
-    tcg_temp_free(c0);
 
     return true;
 }
Signature · 1 line
2.31.1
#3 lore raw

PATCH 2/2 target/mips/mxu: Use tcg_constant_i32()

In reply to Philippe Mathieu-Daudé

Replace uses of tcg_const_i32() with the allocate and free close together.

---
 target/mips/tcg/mxu_translate.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
target/mips/tcg/mxu_translate.c +2 -4
index f52244e1b2b..85eb7857d36 100644
@@ -1101,7 +1101,7 @@ static void gen_mxu_D16MAX_D16MIN(DisasContext *ctx)
         uint32_t XRx = XRb ? XRb : XRc;
         /* ...and do half-word-wise max/min with one operand 0 */
         TCGv_i32 t0 = tcg_temp_new();
-        TCGv_i32 t1 = tcg_const_i32(0);
+        TCGv_i32 t1 = tcg_constant_i32(0);
 
         /* the left half-word first */
         tcg_gen_andi_i32(t0, mxu_gpr[XRx - 1], 0xFFFF0000);
@@ -1126,7 +1126,6 @@ static void gen_mxu_D16MAX_D16MIN(DisasContext *ctx)
         /* finally update the destination */
         tcg_gen_or_i32(mxu_gpr[XRa - 1], mxu_gpr[XRa - 1], t0);
 
-        tcg_temp_free(t1);
         tcg_temp_free(t0);
     } else if (unlikely(XRb == XRc)) {
         /* both operands same -> just set destination to one of them */
@@ -1198,7 +1197,7 @@ static void gen_mxu_Q8MAX_Q8MIN(DisasContext *ctx)
         uint32_t XRx = XRb ? XRb : XRc;
         /* ...and do byte-wise max/min with one operand 0 */
         TCGv_i32 t0 = tcg_temp_new();
-        TCGv_i32 t1 = tcg_const_i32(0);
+        TCGv_i32 t1 = tcg_constant_i32(0);
         int32_t i;
 
         /* the leftmost byte (byte 3) first */
@@ -1227,7 +1226,6 @@ static void gen_mxu_Q8MAX_Q8MIN(DisasContext *ctx)
             tcg_gen_or_i32(mxu_gpr[XRa - 1], mxu_gpr[XRa - 1], t0);
         }
 
-        tcg_temp_free(t1);
         tcg_temp_free(t0);
     } else if (unlikely(XRb == XRc)) {
         /* both operands same -> just set destination to one of them */
Signature · 1 line
2.31.1
Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH-for-6.2 2/2] target/mips/mxu: Use tcg_constant_i32()

Quoted 6 lines · Philippe Mathieu-Daudé

Replace uses of tcg_const_i32() with the allocate and free close together.

---
  target/mips/tcg/mxu_translate.c | 6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)

In my opinion these functions should be simplified by dropping all of the special casing for the zero register and simply let the tcg optimizer do its thing.

But failing that, this is fine.

r~