]> git.proxmox.com Git - mirror_qemu.git/commitdiff
tcg-aarch64: Special case small constants in tcg_out_movi
authorRichard Henderson <rth@twiddle.net>
Wed, 11 Sep 2013 20:44:17 +0000 (13:44 -0700)
committerRichard Henderson <rth@redhat.com>
Wed, 16 Apr 2014 16:12:58 +0000 (12:12 -0400)
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg/aarch64/tcg-target.c

index c1d989571f2ba35f38b0ff2bfe9f8f187da93223..a08f6c782b6ac6737e45bbf2b0347af0cbe20436 100644 (file)
@@ -578,6 +578,16 @@ static void tcg_out_movi(TCGContext *s, TCGType type, TCGReg rd,
         type = TCG_TYPE_I32;
     }
 
+    /* Speed things up by handling the common case of small positive
+       and negative values specially.  */
+    if ((value & ~0xffffull) == 0) {
+        tcg_out_insn(s, 3405, MOVZ, type, rd, value, 0);
+        return;
+    } else if ((ivalue & ~0xffffull) == 0) {
+        tcg_out_insn(s, 3405, MOVN, type, rd, ivalue, 0);
+        return;
+    }
+
     /* Check for bitfield immediates.  For the benefit of 32-bit quantities,
        use the sign-extended value.  That lets us match rotated values such
        as 0xff0000ff with the same 64-bit logic matching 0xffffffffff0000ff. */