From patchwork Sat Sep 14 21:54:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 274967 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 0A4312C00A8 for ; Sun, 15 Sep 2013 08:03:59 +1000 (EST) Received: from localhost ([::1]:54734 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKxwa-0006D7-TU for incoming@patchwork.ozlabs.org; Sat, 14 Sep 2013 18:03:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34566) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKxoC-0001Ft-Jk for qemu-devel@nongnu.org; Sat, 14 Sep 2013 17:55:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VKxo6-00044N-NG for qemu-devel@nongnu.org; Sat, 14 Sep 2013 17:55:16 -0400 Received: from mail-pd0-x232.google.com ([2607:f8b0:400e:c02::232]:41011) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKxo6-00044F-GS for qemu-devel@nongnu.org; Sat, 14 Sep 2013 17:55:10 -0400 Received: by mail-pd0-f178.google.com with SMTP id w10so2651126pde.9 for ; Sat, 14 Sep 2013 14:55:09 -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=0EaJmX3f4GGvgoSUeB63lG25jpjbu6eVc5Jdd4Cy+3c=; b=bEwVK+X3+03WhiuAFvvdHXL4khteKLYe/gUzX1zEYIoAIVohhLFYOUPPRmXr9YopIe BMgMWhbBlZbfevpcapz8LuOvo4Hn4aMyDSU5NbCTGsLrhyD++kMRe9ijBr0vWOx/78Bm feuGMDg6LvEigDkveMVtcC2JqFKjVcL+yNTQB2R5wkD2Q6XIRSuwBrXHuTMEOJiHxYOQ xepZsRaCf6ARD+/sf6OvrbssbLe8LVkYXeK5H061cEBUd5wULcJB/l2Fgc8s0USdK14T S3jrueY6GcaR6ZIopCjJi8kl9pN9HUzemkG3J2uPzN5IZpupqePw6tIPxB4E25wIjtyh ie6g== X-Received: by 10.68.162.5 with SMTP id xw5mr1998518pbb.118.1379195709543; Sat, 14 Sep 2013 14:55:09 -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:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 14 Sep 2013 14:54:27 -0700 Message-Id: <1379195690-6509-11-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:c02::232 Cc: peter.maydell@linaro.org, claudio.fontana@gmail.com Subject: [Qemu-devel] [PATCH v4 10/33] tcg-aarch64: Implement mov with tcg_fmt_* functions 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 Avoid the magic numbers in the current implementation. Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/tcg/aarch64/tcg-target.c b/tcg/aarch64/tcg-target.c index 56625a9..93badfd 100644 --- a/tcg/aarch64/tcg-target.c +++ b/tcg/aarch64/tcg-target.c @@ -379,13 +379,18 @@ static inline void tcg_out_ldst_12(TCGContext *s, | op_type << 20 | scaled_uimm << 10 | rn << 5 | rd); } +/* Register to register move using ORR (shifted register with no shift). */ static inline void tcg_out_movr(TCGContext *s, TCGType ext, - TCGReg rd, TCGReg src) + TCGReg rd, TCGReg rm) { - /* register to register move using MOV (shifted register with no shift) */ - /* using MOV 0x2a0003e0 | (shift).. */ - unsigned int base = ext ? 0xaa0003e0 : 0x2a0003e0; - tcg_out32(s, base | src << 16 | rd); + tcg_fmt_Rdnm(s, INSN_ORR, ext, rd, TCG_REG_XZR, rm); +} + +/* Register to register move using ADDI (move to/from SP). */ +static inline void tcg_out_movr_sp(TCGContext *s, TCGType ext, + TCGReg rd, TCGReg rn) +{ + tcg_fmt_Rdn_aimm(s, INSN_ADDI, ext, rd, rn, 0); } static inline void tcg_out_movi_aux(TCGContext *s, @@ -460,15 +465,6 @@ static inline void tcg_out_ldst(TCGContext *s, enum aarch64_ldst_op_data data, tcg_out_ldst_r(s, data, type, rd, rn, TCG_REG_TMP); } -/* mov alias implemented with add immediate, useful to move to/from SP */ -static inline void tcg_out_movr_sp(TCGContext *s, TCGType ext, - TCGReg rd, TCGReg rn) -{ - /* using ADD 0x11000000 | (ext) | rn << 5 | rd */ - unsigned int base = ext ? 0x91000000 : 0x11000000; - tcg_out32(s, base | rn << 5 | rd); -} - static inline void tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg) {