From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56471) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMWKX-0004sx-Jm for qemu-devel@nongnu.org; Sun, 09 Mar 2014 00:31:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WMWKS-0007ty-U7 for qemu-devel@nongnu.org; Sun, 09 Mar 2014 00:31:21 -0500 Received: from mail-qa0-x229.google.com ([2607:f8b0:400d:c00::229]:50225) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMWKS-0007ts-Qp for qemu-devel@nongnu.org; Sun, 09 Mar 2014 00:31:16 -0500 Received: by mail-qa0-f41.google.com with SMTP id j5so5786940qaq.0 for ; Sat, 08 Mar 2014 21:31:16 -0800 (PST) Sender: Richard Henderson From: Richard Henderson Date: Sat, 8 Mar 2014 21:30:42 -0800 Message-Id: <1394343043-1473-10-git-send-email-rth@twiddle.net> In-Reply-To: <1394343043-1473-1-git-send-email-rth@twiddle.net> References: <1394343043-1473-1-git-send-email-rth@twiddle.net> Subject: [Qemu-devel] [PULL 09/10] tcg-aarch64: Simplify tcg_out_ldst_9 encoding List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, aliguori@amazon.com At first glance the code appears to be using 1's compliment encoding, a-la AArch32. Except that the constant is "off", creating a complicated split field 2's compliment encoding. Much clearer to just use a normal mask and shift. Reviewed-by: Claudio Fontana Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/tcg/aarch64/tcg-target.c b/tcg/aarch64/tcg-target.c index 58a5ff3..d75d685 100644 --- a/tcg/aarch64/tcg-target.c +++ b/tcg/aarch64/tcg-target.c @@ -305,18 +305,8 @@ static inline void tcg_out_ldst_9(TCGContext *s, TCGReg rd, TCGReg rn, tcg_target_long offset) { /* use LDUR with BASE register with 9bit signed unscaled offset */ - unsigned int mod, off; - - if (offset < 0) { - off = (256 + offset); - mod = 0x1; - } else { - off = offset; - mod = 0x0; - } - - mod |= op_type; - tcg_out32(s, op_data << 24 | mod << 20 | off << 12 | rn << 5 | rd); + tcg_out32(s, op_data << 24 | op_type << 20 + | (offset & 0x1ff) << 12 | rn << 5 | rd); } /* tcg_out_ldst_12 expects a scaled unsigned immediate offset */ -- 1.8.5.3