tcg-sparc: Fix small 32-bit movi
authorRichard Henderson <rth@twiddle.net>
Fri, 7 Mar 2014 00:06:24 +0000 (16:06 -0800)
committerRichard Henderson <rth@twiddle.net>
Mon, 28 Apr 2014 18:06:35 +0000 (11:06 -0700)
We tested imm13 before discarding garbage high bits.

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg/sparc/tcg-target.c

index a977c57..1526f2c 100644 (file)
@@ -432,6 +432,11 @@ static void tcg_out_movi(TCGContext *s, TCGType type,
 {
     tcg_target_long hi, lo = (int32_t)arg;
 
+    /* Make sure we test 32-bit constants for imm13 properly.  */
+    if (type == TCG_TYPE_I32) {
+        arg = lo;
+    }
+
     /* A 13-bit constant sign-extended to 64-bits.  */
     if (check_fit_tl(arg, 13)) {
         tcg_out_movi_imm13(s, ret, arg);