Received: from eggs.gnu.org ([2001:4830:134:3::10]:51483) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwiIZ-000651-2r for qemu-devel@nongnu.org; Fri, 27 Dec 2013 20:02:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VwiIR-00045a-BL for qemu-devel@nongnu.org; Fri, 27 Dec 2013 20:02:39 -0500 Received: from mail-bl2lp0212.outbound.protection.outlook.com ([207.46.163.212]:51733 helo=na01-bl2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwiIR-00045W-5k for qemu-devel@nongnu.org; Fri, 27 Dec 2013 20:02:31 -0500 Message-ID: <1388190463.21454.34.camel@snotra.buserror.net> From: Scott Wood Date: Fri, 27 Dec 2013 18:27:43 -0600 In-Reply-To: <1387399747-4994-3-git-send-email-tommusta@gmail.com> References: <1387399747-4994-1-git-send-email-tommusta@gmail.com> <1387399747-4994-3-git-send-email-tommusta@gmail.com> Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [V3 PATCH 02/14] target-ppc: Add ISA2.06 bpermd Instruction List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Tom Musta Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org On Wed, 2013-12-18 at 14:48 -0600, Tom Musta wrote: > This patch adds the Bit Permute Doubleword (bpermd) instruction, > which was introduced in Power ISA 2.06 as part of the base 64-bit > architecture. Technically it's "Category: Embedded.Phased-in, Server" rather than "Category: Base". e5500 does have it, though, so if IBM's 64-bit booke chips also have it, it might as well be Base. > V2: Addressing stylistic comments from Richard Henderson. > > Signed-off-by: Tom Musta > Reviewed-by: Richard Henderson > --- > target-ppc/helper.h | 1 + > target-ppc/int_helper.c | 20 ++++++++++++++++++++ > target-ppc/translate.c | 10 ++++++++++ > 3 files changed, 31 insertions(+), 0 deletions(-) > > diff --git a/target-ppc/helper.h b/target-ppc/helper.h > index 6250eba..1ec9c65 100644 > --- a/target-ppc/helper.h > +++ b/target-ppc/helper.h > @@ -41,6 +41,7 @@ DEF_HELPER_3(sraw, tl, env, tl, tl) > #if defined(TARGET_PPC64) > DEF_HELPER_FLAGS_1(cntlzd, TCG_CALL_NO_RWG_SE, tl, tl) > DEF_HELPER_FLAGS_1(popcntd, TCG_CALL_NO_RWG_SE, tl, tl) > +DEF_HELPER_3(bpermd, i64, env, i64, i64) > DEF_HELPER_3(srad, tl, env, tl, tl) > #endif > > diff --git a/target-ppc/int_helper.c b/target-ppc/int_helper.c > index e50bdd2..abc69a7 100644 > --- a/target-ppc/int_helper.c > +++ b/target-ppc/int_helper.c > @@ -53,6 +53,26 @@ target_ulong helper_cntlzd(target_ulong t) > } > #endif > > +#if defined(TARGET_PPC64) > + > +uint64_t helper_bpermd(CPUPPCState *env, uint64_t rs, uint64_t rb) > +{ > + int i; > + uint64_t ra = 0; > + > + for (i = 0; i < 8; i++) { > + int index = (rs >> (i*8)) & 0xFF; > + if (index < 64) { > + if (rb & (1ul << (63-index))) { 1ull Don't assume that the host is 64-bit -Scott