From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LL01u-0005Kr-DW for qemu-devel@nongnu.org; Thu, 08 Jan 2009 13:54:54 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LL01r-0005K8-J7 for qemu-devel@nongnu.org; Thu, 08 Jan 2009 13:54:52 -0500 Received: from [199.232.76.173] (port=56725 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LL01q-0005K5-R2 for qemu-devel@nongnu.org; Thu, 08 Jan 2009 13:54:50 -0500 Received: from savannah.gnu.org ([199.232.41.3]:45505 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LL01q-0007r2-9M for qemu-devel@nongnu.org; Thu, 08 Jan 2009 13:54:50 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1LL01p-0004ZF-Ox for qemu-devel@nongnu.org; Thu, 08 Jan 2009 18:54:49 +0000 Received: from aurel32 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1LL01p-0004Z6-3U for qemu-devel@nongnu.org; Thu, 08 Jan 2009 18:54:49 +0000 MIME-Version: 1.0 Errors-To: aurel32 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Aurelien Jarno Message-Id: Date: Thu, 08 Jan 2009 18:54:49 +0000 Subject: [Qemu-devel] [6237] Add vs{l,r} instructions Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 6237 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6237 Author: aurel32 Date: 2009-01-08 18:54:48 +0000 (Thu, 08 Jan 2009) Log Message: ----------- Add vs{l,r} instructions Signed-off-by: Nathan Froyd Signed-off-by: Aurelien Jarno Modified Paths: -------------- trunk/target-ppc/helper.h trunk/target-ppc/op_helper.c trunk/target-ppc/translate.c Modified: trunk/target-ppc/helper.h =================================================================== --- trunk/target-ppc/helper.h 2009-01-08 18:54:38 UTC (rev 6236) +++ trunk/target-ppc/helper.h 2009-01-08 18:54:48 UTC (rev 6237) @@ -173,6 +173,8 @@ 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_4(vsldoi, void, avr, avr, avr, i32) DEF_HELPER_3(vspltb, void, avr, avr, i32) DEF_HELPER_3(vsplth, void, avr, avr, i32) Modified: trunk/target-ppc/op_helper.c =================================================================== --- trunk/target-ppc/op_helper.c 2009-01-08 18:54:38 UTC (rev 6236) +++ trunk/target-ppc/op_helper.c 2009-01-08 18:54:48 UTC (rev 6237) @@ -2452,6 +2452,45 @@ r->u64[1] = (a->u64[1] & ~c->u64[1]) | (b->u64[1] & c->u64[1]); } +#if defined(WORDS_BIGENDIAN) +#define LEFT 0 +#define RIGHT 1 +#else +#define LEFT 1 +#define RIGHT 0 +#endif +/* The specification says that the results are undefined if all of the + * shift counts are not identical. We check to make sure that they are + * to conform to what real hardware appears to do. */ +#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); \ + } \ + 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) \ { \ Modified: trunk/target-ppc/translate.c =================================================================== --- trunk/target-ppc/translate.c 2009-01-08 18:54:38 UTC (rev 6236) +++ trunk/target-ppc/translate.c 2009-01-08 18:54:48 UTC (rev 6237) @@ -6344,6 +6344,8 @@ 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); GEN_VXFORM(vpkuhum, 7, 0); GEN_VXFORM(vpkuwum, 7, 1); GEN_VXFORM(vpkuhus, 7, 2);