From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44127) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UiUfM-0006zq-CN for qemu-devel@nongnu.org; Fri, 31 May 2013 15:07:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UiUfJ-0008S7-Lo for qemu-devel@nongnu.org; Fri, 31 May 2013 15:07:08 -0400 Received: from mail-vc0-f176.google.com ([209.85.220.176]:33570) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UiUfJ-0008S3-Gs for qemu-devel@nongnu.org; Fri, 31 May 2013 15:07:05 -0400 Received: by mail-vc0-f176.google.com with SMTP id ha11so1316382vcb.35 for ; Fri, 31 May 2013 12:07:04 -0700 (PDT) Sender: Richard Henderson Message-ID: <51A8F4D4.7000805@twiddle.net> Date: Fri, 31 May 2013 12:07:00 -0700 From: Richard Henderson MIME-Version: 1.0 References: <51A8E339.5000500@huawei.com> <51A8E46F.5030707@huawei.com> In-Reply-To: <51A8E46F.5030707@huawei.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/4] tcg/aarch64: more low level ops in preparation of tlb, lookup List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jani Kokkonen Cc: Laurent Desnogues , Peter Maydell , Claudio Fontana , qemu-devel@nongnu.org On 05/31/2013 10:57 AM, Jani Kokkonen wrote: > + ARITH_SUBS = 0x6b, Any reason you're adding SUBS here, but not ANDS? > +/* encode a logical immediate, mapping user parameter > + M=set bits pattern length to S=M-1 */ > +static inline unsigned int > +aarch64_limm(unsigned int m, unsigned int r) > +{ > + assert(m > 0); > + return r << 16 | (m - 1) << 10; > +} > + > +/* test a register against an immediate bit pattern made of > + M set bits rotated right by R. > + Examples: > + to test a 32/64 reg against 0x00000007, pass M = 3, R = 0. > + to test a 32/64 reg against 0x000000ff, pass M = 8, R = 0. > + to test a 32bit reg against 0xff000000, pass M = 8, R = 8. > + to test a 32bit reg against 0xff0000ff, pass M = 16, R = 8. > + */ > +static inline void tcg_out_tst(TCGContext *s, int ext, TCGReg rn, > + unsigned int m, unsigned int r) > +{ > + /* using TST alias of ANDS XZR, Xn,#bimm64 0x7200001f */ > + unsigned int base = ext ? 0xf240001f : 0x7200001f; > + tcg_out32(s, base | aarch64_limm(m, r) | rn << 5); > +} > + > +/* and a register with a bit pattern, similarly to TST, no flags change */ > +static inline void tcg_out_andi(TCGContext *s, int ext, TCGReg rd, TCGReg rn, > + unsigned int m, unsigned int r) > +{ > + /* using AND 0x12000000 */ > + unsigned int base = ext ? 0x92400000 : 0x12000000; > + tcg_out32(s, base | aarch64_limm(m, r) | rn << 5 | rd); > +} > + This should be a separate patch, since it's not related to the tcg_out_arith change. r~