From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55215) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vohyy-0002E2-2n for qemu-devel@nongnu.org; Thu, 05 Dec 2013 18:05:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vohys-00053S-T8 for qemu-devel@nongnu.org; Thu, 05 Dec 2013 18:05:20 -0500 Received: from mail-yh0-x236.google.com ([2607:f8b0:4002:c01::236]:57005) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vohys-00053C-Lw for qemu-devel@nongnu.org; Thu, 05 Dec 2013 18:05:14 -0500 Received: by mail-yh0-f54.google.com with SMTP id z12so13152400yhz.13 for ; Thu, 05 Dec 2013 15:05:13 -0800 (PST) Sender: Richard Henderson Message-ID: <52A106A1.5070800@twiddle.net> Date: Fri, 06 Dec 2013 12:05:05 +1300 From: Richard Henderson MIME-Version: 1.0 References: <1386280289-27636-1-git-send-email-peter.maydell@linaro.org> <1386280289-27636-11-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1386280289-27636-11-git-send-email-peter.maydell@linaro.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 10/13] target-arm: A64: add support for bitfield insns List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , qemu-devel@nongnu.org Cc: patches@linaro.org, Michael Matz , Claudio Fontana , Dirk Mueller , Will Newton , Laurent Desnogues , =?ISO-8859-1?Q?Alex_Benn=E9e?= , kvmarm@lists.cs.columbia.edu, Christoffer Dall On 12/06/2013 10:51 AM, Peter Maydell wrote: > From: Claudio Fontana > > This patch implements the C3.4.2 Bitfield instructions: > SBFM, BFM, UBFM. > > Signed-off-by: Claudio Fontana > Signed-off-by: Peter Maydell > --- > target-arm/translate-a64.c | 54 ++++++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 52 insertions(+), 2 deletions(-) Reviewed-by: Richard Henderson > + if (opc != 1) { /* SBFM or UBFM */ > + tcg_gen_movi_i64(tcg_rd, 0); > + } > + > + /* do the bit move operation */ > + if (si >= ri) { > + /* Wd = Wn */ > + tcg_gen_shri_i64(tcg_tmp, tcg_tmp, ri); > + pos = 0; > + len = (si - ri) + 1; > + } else { > + /* Wd<32+s-r,32-r> = Wn */ > + pos = bitsize - ri; > + len = si + 1; > + } > + > + tcg_gen_deposit_i64(tcg_rd, tcg_rd, tcg_tmp, pos, len); > + > + if (opc == 0) { /* SBFM - sign extend the destination field */ > + tcg_gen_shli_i64(tcg_rd, tcg_rd, 64 - (pos + len)); > + tcg_gen_sari_i64(tcg_rd, tcg_rd, 64 - (pos + len)); > + } OPTME: It's probably worth recognizing the common cases of ext{8,16,32}{u,s}. r~