From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55577) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLUWA-0004so-L6 for qemu-devel@nongnu.org; Mon, 16 Sep 2013 04:50:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VLUW5-0004HY-Ji for qemu-devel@nongnu.org; Mon, 16 Sep 2013 04:50:50 -0400 Received: from lhrrgout.huawei.com ([194.213.3.17]:58154) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLUW4-0004HM-RI for qemu-devel@nongnu.org; Mon, 16 Sep 2013 04:50:45 -0400 Message-ID: <5236C655.20708@huawei.com> Date: Mon, 16 Sep 2013 10:50:29 +0200 From: Claudio Fontana MIME-Version: 1.0 References: <1379195690-6509-1-git-send-email-rth@twiddle.net> <1379195690-6509-11-git-send-email-rth@twiddle.net> In-Reply-To: <1379195690-6509-11-git-send-email-rth@twiddle.net> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 10/33] tcg-aarch64: Implement mov with tcg_fmt_* functions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org, claudio.fontana@gmail.com On 14.09.2013 23:54, Richard Henderson wrote: > 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); > } > I am ok with reusing the existing functions of course, this is an improvement. See the comments about the tcg_fmt_* functions in previous patches for the related issues. > -/* 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) > { >