From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LJE1M-0000po-4B for qemu-devel@nongnu.org; Sat, 03 Jan 2009 16:27:00 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LJE1L-0000ox-ER for qemu-devel@nongnu.org; Sat, 03 Jan 2009 16:26:59 -0500 Received: from [199.232.76.173] (port=52555 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LJE1K-0000oc-UF for qemu-devel@nongnu.org; Sat, 03 Jan 2009 16:26:58 -0500 Received: from hall.aurel32.net ([88.191.82.174]:55156) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LJE1K-0004aX-CF for qemu-devel@nongnu.org; Sat, 03 Jan 2009 16:26:58 -0500 Date: Sat, 3 Jan 2009 22:26:55 +0100 From: Aurelien Jarno Subject: Re: [Qemu-devel] [PATCH 20/40] Add vs{l,r} instructions. Message-ID: <20090103212655.GC18974@volta.aurel32.net> References: <1230693022-18380-1-git-send-email-froydnj@codesourcery.com> <1230693022-18380-21-git-send-email-froydnj@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <1230693022-18380-21-git-send-email-froydnj@codesourcery.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nathan Froyd Cc: qemu-devel@nongnu.org On Tue, Dec 30, 2008 at 07:10:02PM -0800, Nathan Froyd wrote: > > Signed-off-by: Nathan Froyd > --- > target-ppc/helper.h | 2 ++ > target-ppc/op_helper.c | 36 ++++++++++++++++++++++++++++++++++++ > target-ppc/translate.c | 2 ++ > 3 files changed, 40 insertions(+), 0 deletions(-) > > diff --git a/target-ppc/helper.h b/target-ppc/helper.h > index cf2a655..5f94e9f 100644 > --- a/target-ppc/helper.h > +++ b/target-ppc/helper.h > @@ -176,6 +176,8 @@ DEF_HELPER_3(vsubuws, void, avr, avr, avr) > DEF_HELPER_3(vrlb, void, avr, avr, avr) > DEF_HELPER_3(vrlh, void, avr, avr, avr) > DEF_HELPER_3(vrlw, void, avr, avr, avr) > +DEF_HELPER_3(vsl, void, avr, avr, avr) > +DEF_HELPER_3(vsr, void, avr, avr, avr) > > DEF_HELPER_1(efscfsi, i32, i32) > DEF_HELPER_1(efscfui, i32, i32) > diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c > index 15eee72..ce47ef1 100644 > --- a/target-ppc/op_helper.c > +++ b/target-ppc/op_helper.c > @@ -2210,6 +2210,42 @@ VROTATE(h, u16) > VROTATE(w, u32) > #undef VROTATE > > +#if defined(WORDS_BIGENDIAN) > +#define LEFT 0 > +#define RIGHT 1 > +#else > +#define LEFT 1 > +#define RIGHT 0 > +#endif > +#define VSHIFT(suffix, leftp) \ > + void helper_vs##suffix (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \ > + { \ > + int shift = b->u8[LO_IDX*0x15] & 0x7; \ > + int doit = 1; \ > + int i; \ > + for (i = 0; i < ARRAY_SIZE(r->u8); i++) { \ > + doit = doit && ((b->u8[i] & 0x7) == shift); \ > + } \ According to the specification, the result is undefined in that case. I think that always doing the computation is fine. > + if (doit) { \ > + if (shift == 0) { \ > + *r = *a; \ > + } else if (leftp) { \ > + uint64_t carry = a->u64[LO_IDX] >> (64 - shift); \ > + r->u64[HI_IDX] = (a->u64[HI_IDX] << shift) | carry; \ > + r->u64[LO_IDX] = a->u64[LO_IDX] << shift; \ > + } else { \ > + uint64_t carry = a->u64[HI_IDX] << (64 - shift); \ > + r->u64[LO_IDX] = (a->u64[LO_IDX] >> shift) | carry; \ > + r->u64[HI_IDX] = a->u64[HI_IDX] >> shift; \ > + } \ > + } \ > + } > +VSHIFT(l, LEFT) > +VSHIFT(r, RIGHT) > +#undef VSHIFT > +#undef LEFT > +#undef RIGHT > + > #define VSL(suffix, element) \ > void helper_vsl##suffix (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \ > { \ > diff --git a/target-ppc/translate.c b/target-ppc/translate.c > index a853683..b50aba3 100644 > --- a/target-ppc/translate.c > +++ b/target-ppc/translate.c > @@ -6316,6 +6316,8 @@ GEN_VXFORM(vsubsws, 0, 30); > GEN_VXFORM(vrlb, 2, 0); > GEN_VXFORM(vrlh, 2, 1); > GEN_VXFORM(vrlw, 2, 2); > +GEN_VXFORM(vsl, 2, 7); > +GEN_VXFORM(vsr, 2, 11); > > #define GEN_VXRFORM1(opname, name, str, opc2, opc3) \ > GEN_HANDLER2(name, str, 0x4, opc2, opc3, 0x00000000, PPC_ALTIVEC) \ > -- > 1.6.0.5 > > > > -- .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' aurel32@debian.org | aurelien@aurel32.net `- people.debian.org/~aurel32 | www.aurel32.net