Received: from eggs.gnu.org ([2001:4830:134:3::10]:41318) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWxiN-0001ri-1v for qemu-devel@nongnu.org; Mon, 08 Aug 2016 23:28:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bWxiJ-0002PT-Re for qemu-devel@nongnu.org; Mon, 08 Aug 2016 23:28:26 -0400 Date: Tue, 9 Aug 2016 13:18:11 +1000 From: David Gibson Message-ID: <20160809031811.GE9057@voom.fritz.box> References: <1470315830-23724-1-git-send-email-raji@linux.vnet.ibm.com> <1470315830-23724-2-git-send-email-raji@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Ns7jmDPpOpCD+GE/" Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH v1 1/5] target-ppc: add vector insert instructions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: Rajalakshmi Srinivasaraghavan , qemu-ppc@nongnu.org, qemu-devel@nongnu.org, nikunj@linux.vnet.ibm.com, benh@kernel.crashing.org --Ns7jmDPpOpCD+GE/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Aug 04, 2016 at 10:08:17PM +0530, Richard Henderson wrote: > On 08/04/2016 06:33 PM, Rajalakshmi Srinivasaraghavan wrote: > > +#if defined(HOST_WORDS_BIGENDIAN) > > +#define VINSERT(suffix, element, index) = \ > > + void helper_vinsert##suffix(ppc_avr_t *r, ppc_avr_t *b, uint32_t s= plat) \ > > + { = \ > > + memcpy(&r->u8[SPLAT_ELEMENT(u8)], &b->element[index], = \ It seems odd to use SPLAT_ELEMENT() here but not in the LE case, given that SPLAT_ELEMENT() is already a macro whose definition is conditional on endianness. It might actually be clearer to open code it. > > + sizeof(r->element[0])); = \ > > + } > > +#else > > +#define VINSERT(suffix, element, index) = \ > > + void helper_vinsert##suffix(ppc_avr_t *r, ppc_avr_t *b, uint32_t s= plat) \ > > + { = \ > > + memcpy(&r->u8[(16 - splat) - sizeof(r->element[0])], = \ > > + &b->element[(ARRAY_SIZE(r->element) - index) - 1], = \ > > + sizeof(r->element[0])); = \ > > + } >=20 > Something somewhere needs to check for out of bounds SPLAT, for evil gues= ts. >=20 > The spec says it's undefined; I don't recall if that gives you the latitu= de > to generate an illegal instruction trap during translate. splat is an immediate argument, so that should be done on the generator side, rather than the helper side. It's already partially done by the way it's extracted from the instruction. But, AFAICT that just limits splat to 5 bits, and I'm not sure that's enough for all forms of this instruction. --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --Ns7jmDPpOpCD+GE/ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIbBAEBAgAGBQJXqUtzAAoJEGw4ysog2bOSSAYP8wSCXtb3nkZguA+lkqn+CtAZ 64lxZfMLQntM2WAN/t2z2Odrl1l+bRNuH5coZbqi6XIpMjqv8glDFmE5jl2KuUIH sQTcmf6iuM0jjNHRNwafrDT02KuT/r3Pjc3mugyeuRDcGBfC+Lwev4BlGq40lb3b eWb8NbyAVqBCZpyHpJxdAcF3UdH9Cx+4DvhN+YCLIgUChDpZ4YIW5QQIfIhnbrKT dbZofVANZPLkFkldiPRR0m5SYUvXpUxkx1uCIHf52cKRYSPhhrzh0KznaMDa7eJs Xjy2SvRS73g4MdMQrfBpnO5KiPq32KdHIJqFZX0W4w7Ewsfp6T0Nc1tfM4Zd3UEC FOgZ0Sf8vk6uC0FlmtLUPol5x/GwoQiPGo/BnO+ub4pgIVnqGtNZdpAnEjN1wpsv kwIu+NsQppT+sAcf9xzunRMZ4BjtYUNIAfi2Vg73bRuPJVPDzQ6uF97rQwf4ogZN 2XZBcSMYf5hh3BRQZ1+k8uIPbqEfu2kOBc20Ra6e8QNymQplA4y5N7lIev8kkFYV EugOHoUdq/ooDIwnTT0TimZrtw4An+zAdOUSnjrfhWy/wFURKfp2qtULjXFlkoNi wwIk/WjRahSjn+4jsiuPoV4NkcXn2cwFLmODBUWWrDfz0raWreFKJ0izDvtlKLwV of+1i2/jnAldLb0CK4M= =VfnI -----END PGP SIGNATURE----- --Ns7jmDPpOpCD+GE/--