On 12/06/2013 10:51 AM, Peter Maydell wrote: > From: Claudio Fontana <claudio.fontana@xxxxxxxxxx> > > This patch implements the C3.4.2 Bitfield instructions: > SBFM, BFM, UBFM. > > Signed-off-by: Claudio Fontana <claudio.fontana@xxxxxxxxxx> > Signed-off-by: Peter Maydell <peter.maydell@xxxxxxxxxx> > --- > target-arm/translate-a64.c | 54 ++++++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 52 insertions(+), 2 deletions(-) Reviewed-by: Richard Henderson <rth@xxxxxxxxxxx> > + if (opc != 1) { /* SBFM or UBFM */ > + tcg_gen_movi_i64(tcg_rd, 0); > + } > + > + /* do the bit move operation */ > + if (si >= ri) { > + /* Wd<s-r:0> = Wn<s:r> */ > + tcg_gen_shri_i64(tcg_tmp, tcg_tmp, ri); > + pos = 0; > + len = (si - ri) + 1; > + } else { > + /* Wd<32+s-r,32-r> = Wn<s:0> */ > + 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~ _______________________________________________ kvmarm mailing list kvmarm@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/cucslists/listinfo/kvmarm