From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51190) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOeg4-0000hu-Qu for qemu-devel@nongnu.org; Fri, 14 Mar 2014 22:50:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WOefy-0007cA-OS for qemu-devel@nongnu.org; Fri, 14 Mar 2014 22:50:24 -0400 Received: from mail-pd0-x229.google.com ([2607:f8b0:400e:c02::229]:56373) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOefy-0007b1-8c for qemu-devel@nongnu.org; Fri, 14 Mar 2014 22:50:18 -0400 Received: by mail-pd0-f169.google.com with SMTP id fp1so3306377pdb.28 for ; Fri, 14 Mar 2014 19:50:17 -0700 (PDT) Sender: Richard Henderson From: Richard Henderson Date: Fri, 14 Mar 2014 19:48:50 -0700 Message-Id: <1394851732-25692-25-git-send-email-rth@twiddle.net> In-Reply-To: <1394851732-25692-1-git-send-email-rth@twiddle.net> References: <1394851732-25692-1-git-send-email-rth@twiddle.net> Subject: [Qemu-devel] [PATCH 24/26] tcg-aarch64: Prefer unsigned offsets before signed offsets for ldst 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 The assembler seems to prefer them, perhaps we should too. Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tcg/aarch64/tcg-target.c b/tcg/aarch64/tcg-target.c index fde3df7..3bbd24c 100644 --- a/tcg/aarch64/tcg-target.c +++ b/tcg/aarch64/tcg-target.c @@ -636,11 +636,6 @@ static void tcg_out_ldst_r(TCGContext *s, TCGMemOp size, AArch64LdstType type, static void tcg_out_ldst(TCGContext *s, TCGMemOp size, AArch64LdstType type, TCGReg rd, TCGReg rn, intptr_t offset) { - if (offset >= -256 && offset < 256) { - tcg_out_ldst_9(s, size, type, 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))) { @@ -651,6 +646,11 @@ static void tcg_out_ldst(TCGContext *s, TCGMemOp size, AArch64LdstType type, } } + if (offset >= -256 && offset < 256) { + tcg_out_ldst_9(s, size, type, 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, size, type, rd, rn, TCG_REG_TMP); -- 1.8.5.3