From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34744) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKxoX-0001oC-Ih for qemu-devel@nongnu.org; Sat, 14 Sep 2013 17:55:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VKxoR-00049e-Go for qemu-devel@nongnu.org; Sat, 14 Sep 2013 17:55:37 -0400 Received: from mail-pa0-x22a.google.com ([2607:f8b0:400e:c03::22a]:35944) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKxoR-00049T-7p for qemu-devel@nongnu.org; Sat, 14 Sep 2013 17:55:31 -0400 Received: by mail-pa0-f42.google.com with SMTP id lj1so3914173pab.29 for ; Sat, 14 Sep 2013 14:55:30 -0700 (PDT) Sender: Richard Henderson From: Richard Henderson Date: Sat, 14 Sep 2013 14:54:41 -0700 Message-Id: <1379195690-6509-25-git-send-email-rth@twiddle.net> In-Reply-To: <1379195690-6509-1-git-send-email-rth@twiddle.net> References: <1379195690-6509-1-git-send-email-rth@twiddle.net> Subject: [Qemu-devel] [PATCH v4 24/33] 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: peter.maydell@linaro.org, claudio.fontana@gmail.com Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tcg/aarch64/tcg-target.c b/tcg/aarch64/tcg-target.c index 9effee7..e50abcb 100644 --- a/tcg/aarch64/tcg-target.c +++ b/tcg/aarch64/tcg-target.c @@ -573,6 +573,17 @@ 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_fmt_Rd_uimm(s, INSN_MOVZ, type, rd, value, 0); + return; + } + if ((~svalue & ~0xffffull) == 0) { + tcg_fmt_Rd_uimm(s, INSN_MOVN, type, rd, ~svalue, 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.8.3.1