From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43421) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMYmi-0007rN-AW for qemu-devel@nongnu.org; Sun, 09 Mar 2014 04:08:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WMYmc-0007R0-Fa for qemu-devel@nongnu.org; Sun, 09 Mar 2014 04:08:36 -0400 Received: from mail-qg0-x22d.google.com ([2607:f8b0:400d:c04::22d]:64383) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMYmc-0007QM-C0 for qemu-devel@nongnu.org; Sun, 09 Mar 2014 04:08:30 -0400 Received: by mail-qg0-f45.google.com with SMTP id j5so16951340qga.4 for ; Sun, 09 Mar 2014 00:08:30 -0800 (PST) Sender: Richard Henderson From: Richard Henderson Date: Sun, 9 Mar 2014 00:07:49 -0800 Message-Id: <1394352479-5625-5-git-send-email-rth@twiddle.net> In-Reply-To: <1394352479-5625-1-git-send-email-rth@twiddle.net> References: <1394352479-5625-1-git-send-email-rth@twiddle.net> Subject: [Qemu-devel] [PATCH 04/14] tcg-aarch64: Implement mov with tcg_out_insn List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, peter.maydell@linaro.org, claudio.fontana@huawei.com Avoid the magic numbers in the current implementation. Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/tcg/aarch64/tcg-target.c b/tcg/aarch64/tcg-target.c index b5f19ad..9b6374d 100644 --- a/tcg/aarch64/tcg-target.c +++ b/tcg/aarch64/tcg-target.c @@ -376,13 +376,16 @@ static inline void tcg_out_ldst_12(TCGContext *s, | op_type << 20 | scaled_uimm << 10 | rn << 5 | rd); } -static inline void tcg_out_movr(TCGContext *s, TCGType ext, - TCGReg rd, TCGReg src) +/* Register to register move using ORR (shifted register with no shift). */ +static void tcg_out_movr(TCGContext *s, TCGType ext, 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_out_insn(s, 3510, ORR, ext, rd, TCG_REG_XZR, rm); +} + +/* Register to register move using ADDI (move to/from SP). */ +static void tcg_out_movr_sp(TCGContext *s, TCGType ext, TCGReg rd, TCGReg rn) +{ + tcg_out_insn(s, 3401, ADDI, ext, rd, rn, 0); } static inline void tcg_out_movi_aux(TCGContext *s, @@ -457,15 +460,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) { -- 1.8.5.3