From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60163) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHzzq-0003j5-2E for qemu-devel@nongnu.org; Mon, 24 Feb 2014 13:11:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WHzzh-0004b7-Ek for qemu-devel@nongnu.org; Mon, 24 Feb 2014 13:11:17 -0500 Sender: Richard Henderson Message-ID: <530B8B39.7020305@twiddle.net> Date: Mon, 24 Feb 2014 10:11:05 -0800 From: Richard Henderson MIME-Version: 1.0 References: <1392240199-2454-1-git-send-email-tommusta@gmail.com> <1392240199-2454-25-git-send-email-tommusta@gmail.com> In-Reply-To: <1392240199-2454-25-git-send-email-tommusta@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 24/28] target-ppc: Altivec 2.07: Vector Polynomial Multiply Sum List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Tom Musta , qemu-devel@nongnu.org Cc: Peter Maydell , qemu-ppc@nongnu.org On 02/12/2014 01:23 PM, Tom Musta wrote: > +#define PMSUM(name, srcfld, trgfld, trgtyp) \ > +void helper_##name(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \ > +{ \ > + int i, j; \ > + trgtyp prod[sizeof(ppc_avr_t)/sizeof(a->srcfld[0])]; \ > + \ > + VECTOR_FOR_INORDER_I(i, srcfld) { \ > + prod[i] = 0; \ > + for (j = 0; j < sizeof(a->srcfld[0]) * 8; j++) { \ > + if (a->srcfld[i] & (1ull< + prod[i] ^= ((trgtyp)b->srcfld[i] << j); \ > + } \ > + } \ > + } \ > + \ > + VECTOR_FOR_INORDER_I(i, trgfld) { \ > + r->trgfld[i] = prod[2*i] ^ prod[2*i+1]; \ > + } \ > +} > + > +PMSUM(vpmsumb, u8, u16, uint16_t) > +PMSUM(vpmsumh, u16, u32, uint32_t) > +PMSUM(vpmsumw, u32, u64, uint64_t) Given that we've now got three targets actually implementing poly multiply (four if anyone ever gets around to implementing the sparc64-2011 insn), perhaps it's time to implement this generically? Perhaps declared in host-utils.c and implemented in util/? Cleanup for another patchset, of course. r~