diff mbox series

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

Message ID 20210808160843.84957-3-f4bug@amsat.org
State New
Headers show
Series target/mips: Use tcg_constant_* in TX79 & MXU | expand

Commit Message

Philippe Mathieu-Daudé Aug. 8, 2021, 4:08 p.m. UTC
Replace uses of tcg_const_i32() with the allocate and free close together.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 target/mips/tcg/mxu_translate.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Richard Henderson Aug. 9, 2021, 7:25 p.m. UTC | #1
On 8/8/21 6:08 AM, Philippe Mathieu-Daudé wrote:
> Replace uses of tcg_const_i32() with the allocate and free close together.
> 
> Signed-off-by: Philippe Mathieu-Daudé<f4bug@amsat.org>
> ---
>   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.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~
diff mbox series

Patch

diff --git a/target/mips/tcg/mxu_translate.c b/target/mips/tcg/mxu_translate.c
index f52244e1b2b..85eb7857d36 100644
--- a/target/mips/tcg/mxu_translate.c
+++ b/target/mips/tcg/mxu_translate.c
@@ -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 */