From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45899) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYdZr-0002EU-4z for qemu-devel@nongnu.org; Fri, 11 Apr 2014 11:41:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WYdZm-00047m-Do for qemu-devel@nongnu.org; Fri, 11 Apr 2014 11:41:15 -0400 Received: from mail-qc0-x22d.google.com ([2607:f8b0:400d:c01::22d]:48104) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYdZm-00047d-AX for qemu-devel@nongnu.org; Fri, 11 Apr 2014 11:41:10 -0400 Received: by mail-qc0-f173.google.com with SMTP id r5so6164919qcx.32 for ; Fri, 11 Apr 2014 08:41:09 -0700 (PDT) Sender: Richard Henderson From: Richard Henderson Date: Fri, 11 Apr 2014 08:40:08 -0700 Message-Id: <1397230827-24222-7-git-send-email-rth@twiddle.net> In-Reply-To: <1397230827-24222-1-git-send-email-rth@twiddle.net> References: <1397230827-24222-1-git-send-email-rth@twiddle.net> Subject: [Qemu-devel] [PATCH v4 06/25] tcg-aarch64: Special case small constants in tcg_out_movi List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: claudio.fontana@huawei.com Reviewed-by: Claudio Fontana Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tcg/aarch64/tcg-target.c b/tcg/aarch64/tcg-target.c index c1d9895..a08f6c7 100644 --- a/tcg/aarch64/tcg-target.c +++ b/tcg/aarch64/tcg-target.c @@ -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. */ -- 1.9.0