From patchwork Sat Sep 14 21:54:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 274984 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 479FC2C00F8 for ; Sun, 15 Sep 2013 08:42:20 +1000 (EST) Received: from localhost ([::1]:54710 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKxtz-0002vA-AQ for incoming@patchwork.ozlabs.org; Sat, 14 Sep 2013 18:01:15 -0400 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=XtOzhFFg0U8amt3dXhOJ5cIFoXpkOiG76Dqx4KLeo9Q=; b=hQ3y6/jc1cfuiGmHbCWJlwZVBwUSPToshH+6rTwYtkYCMFUHJbJtgvpRKRS0B+vLgo vBfpWm9X3YH9yNpBNJSv+4MTwZcPJvRTFqh20ufy4xhtIYJGAX0qa2in84rDSCCZs6mc G/+HCmxyyoDtMAU/ogQwdARdF+wjLO6SVvPh0shnotvEUDwXSsC/oFFjX8dxZshjI4CJ DxidoJ/PGYXzaAqZKfIFMlbys3mNsarf/4mzkuSOulDnUC2YVM4Oyjf6U8VGezgIUDGb yY1Bo7QT43PlwWdexxRT7eg6IKhiIHJcnqJSRxHCnKpfATJL1yrORfwMJH1OPrdLbbje L8sA== X-Received: by 10.68.176.132 with SMTP id ci4mr20779057pbc.7.1379195730268; Sat, 14 Sep 2013 14:55:30 -0700 (PDT) Received: from pebble.twiddle.net (50-194-63-110-static.hfc.comcastbusiness.net. [50.194.63.110]) by mx.google.com with ESMTPSA id gg10sm20458962pbc.46.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 14 Sep 2013 14:55:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 14 Sep 2013 14:54:41 -0700 Message-Id: <1379195690-6509-25-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1379195690-6509-1-git-send-email-rth@twiddle.net> References: <1379195690-6509-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::22a Cc: peter.maydell@linaro.org, claudio.fontana@gmail.com Subject: [Qemu-devel] [PATCH v4 24/33] tcg-aarch64: Special case small constants in tcg_out_movi X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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.