tcg/loongarch64: Conditionalize tcg_out_exts_i32_i64
authorRichard Henderson <richard.henderson@linaro.org>
Thu, 6 Apr 2023 01:37:25 +0000 (18:37 -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,
via ".w" instructions, 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/loongarch64/tcg-target.c.inc

index 21c2fc9e98d7e16bac98789d51eb50d614e7fbc7..0940788c6f2cb405d263bb36ecff590041a4dac4 100644 (file)
@@ -463,7 +463,9 @@ static void tcg_out_ext32s(TCGContext *s, TCGReg ret, TCGReg arg)
 
 static void tcg_out_exts_i32_i64(TCGContext *s, TCGReg ret, TCGReg arg)
 {
-    tcg_out_ext32s(s, ret, arg);
+    if (ret != arg) {
+        tcg_out_ext32s(s, ret, arg);
+    }
 }
 
 static void tcg_out_extu_i32_i64(TCGContext *s, TCGReg ret, TCGReg arg)