tcg/mips: Conditionalize tcg_out_exts_i32_i64
authorRichard Henderson <richard.henderson@linaro.org>
Thu, 6 Apr 2023 01:40:44 +0000 (18:40 -0700)
committerRichard Henderson <richard.henderson@linaro.org>
Tue, 2 May 2023 20:05:45 +0000 (13:05 -0700)
Since TCG_TYPE_I32 values are kept sign-extended in registers, we need not
extend if the register matches.  This is already relied upon by comparisons.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
tcg/mips/tcg-target.c.inc

index 346c6143545d2eb2d9f3224bdc000b564c1e6770..a83ebe8729c77c14c2a5f795d6c0f56ff025ac86 100644 (file)
@@ -582,7 +582,9 @@ static void tcg_out_ext32s(TCGContext *s, TCGReg rd, TCGReg rs)
 
 static void tcg_out_exts_i32_i64(TCGContext *s, TCGReg rd, TCGReg rs)
 {
-    tcg_out_ext32s(s, rd, rs);
+    if (rd != rs) {
+        tcg_out_ext32s(s, rd, rs);
+    }
 }
 
 static void tcg_out_extu_i32_i64(TCGContext *s, TCGReg rd, TCGReg rs)