From patchwork Fri Apr 11 15:40:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 338575 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 071051400D9 for ; Sat, 12 Apr 2014 02:10:30 +1000 (EST) Received: from localhost ([::1]:58464 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYdhr-0005gW-2f for incoming@patchwork.ozlabs.org; Fri, 11 Apr 2014 11:49:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46219) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYdaK-0003Ep-HW for qemu-devel@nongnu.org; Fri, 11 Apr 2014 11:41:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WYdaF-0004IZ-Kp for qemu-devel@nongnu.org; Fri, 11 Apr 2014 11:41:44 -0400 Received: from mail-qg0-x235.google.com ([2607:f8b0:400d:c04::235]:51464) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYdaF-0004IR-HI for qemu-devel@nongnu.org; Fri, 11 Apr 2014 11:41:39 -0400 Received: by mail-qg0-f53.google.com with SMTP id f51so4773208qge.40 for ; Fri, 11 Apr 2014 08:41:39 -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=eqnvD/+JybYbEeW3FpIO32qtPlzJ/5m02yicOXbmYhY=; b=ATF4FXqFhO12E0od/bHly3CBHUAuOxnZr/GSDvL8bR3RHLTaS6gMf0K1XZiPYUu2Ir L87JP2VvwBmstZYdFnVczgnSbHsRiBm5+VhzIL4q3HkvXvod2Jtcn/qpDdFsr8PP2RJx OAv1lMuJaG7fEaGXHE4NDcuMJ2lL3EUhI51x9WOCw9UzJRtAMzpp4OVacp9RGYiXUlib bvM/bNK7ttSbi9g4BL1RjXax2a+SPrPZr1wW0bOxVWqbaH0JE/YlfHlnnPck7z2/Z0De LJ5FE3ZPjEu3RAalhix+Nu0ZFNHXKF32rM1kP6H2rvqBBHBFHtDsO7FZm1Bcb5I/XkYK c2Hg== X-Received: by 10.140.86.168 with SMTP id p37mr28920741qgd.23.1397230899039; Fri, 11 Apr 2014 08:41:39 -0700 (PDT) Received: from anchor.com (50-194-63-110-static.hfc.comcastbusiness.net. [50.194.63.110]) by mx.google.com with ESMTPSA id g7sm14238884qaf.14.2014.04.11.08.41.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Apr 2014 08:41:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 11 Apr 2014 08:40:26 -0700 Message-Id: <1397230827-24222-25-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1397230827-24222-1-git-send-email-rth@twiddle.net> References: <1397230827-24222-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:400d:c04::235 Cc: claudio.fontana@huawei.com Subject: [Qemu-devel] [PATCH v4 24/25] tcg-aarch64: Prefer unsigned offsets before signed offsets for ldst 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 The assembler seems to prefer them, perhaps we should too. Reviewed-by: Claudio Fontana Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tcg/aarch64/tcg-target.c b/tcg/aarch64/tcg-target.c index 3235824..7ff4be7 100644 --- a/tcg/aarch64/tcg-target.c +++ b/tcg/aarch64/tcg-target.c @@ -669,11 +669,6 @@ static void tcg_out_ldst(TCGContext *s, AArch64Insn insn, { TCGMemOp size = (uint32_t)insn >> 30; - if (offset >= -256 && offset < 256) { - tcg_out_insn_3312(s, insn, rd, rn, offset); - return; - } - /* If the offset is naturally aligned and in range, then we can use the scaled uimm12 encoding */ if (offset >= 0 && !(offset & ((1 << size) - 1))) { @@ -684,6 +679,12 @@ static void tcg_out_ldst(TCGContext *s, AArch64Insn insn, } } + /* Small signed offsets can use the unscaled encoding. */ + if (offset >= -256 && offset < 256) { + tcg_out_insn_3312(s, insn, rd, rn, offset); + return; + } + /* Worst-case scenario, move offset to temp register, use reg offset. */ tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_TMP, offset); tcg_out_ldst_r(s, insn, rd, rn, TCG_REG_TMP);