From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LC3Pm-0008Oc-D8 for qemu-devel@nongnu.org; Sun, 14 Dec 2008 21:42:34 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LC3Pk-0008N0-KE for qemu-devel@nongnu.org; Sun, 14 Dec 2008 21:42:33 -0500 Received: from [199.232.76.173] (port=48442 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LC3Pk-0008Mg-5w for qemu-devel@nongnu.org; Sun, 14 Dec 2008 21:42:32 -0500 Received: from mx20.gnu.org ([199.232.41.8]:31637) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LC3Pj-0002jB-9K for qemu-devel@nongnu.org; Sun, 14 Dec 2008 21:42:31 -0500 Received: from mail.codesourcery.com ([65.74.133.4]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LC3Pf-0002u0-Dt for qemu-devel@nongnu.org; Sun, 14 Dec 2008 21:42:27 -0500 From: Nathan Froyd Date: Sun, 14 Dec 2008 18:15:00 -0800 Message-Id: <1229307315-16807-28-git-send-email-froydnj@codesourcery.com> In-Reply-To: <1229307315-16807-1-git-send-email-froydnj@codesourcery.com> References: <1229307315-16807-1-git-send-email-froydnj@codesourcery.com> Subject: [Qemu-devel] [PATCH 27/42] target-ppc: add vsplt{b, h, w} 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 Signed-off-by: Nathan Froyd --- target-ppc/helper.h | 3 +++ target-ppc/op_helper.c | 22 ++++++++++++++++++++++ target-ppc/translate.c | 4 ++++ 3 files changed, 29 insertions(+), 0 deletions(-) diff --git a/target-ppc/helper.h b/target-ppc/helper.h index 9fbcc4a..2ca4e26 100644 --- a/target-ppc/helper.h +++ b/target-ppc/helper.h @@ -182,6 +182,9 @@ DEF_HELPER_4(vsldoi, void, avr, avr, avr, i32) DEF_HELPER_2(vspltisb, void, avr, i32) DEF_HELPER_2(vspltish, void, avr, i32) DEF_HELPER_2(vspltisw, void, avr, i32) +DEF_HELPER_3(vspltb, void, avr, avr, i32) +DEF_HELPER_3(vsplth, void, avr, avr, i32) +DEF_HELPER_3(vspltw, void, avr, avr, i32) 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 ac99324..44af1cc 100644 --- a/target-ppc/op_helper.c +++ b/target-ppc/op_helper.c @@ -2354,6 +2354,28 @@ void helper_vslo (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) #endif } +/* Experimental testing shows that hardware masks the immediate. */ +#define _SPLAT_MASKED(element) (splat & (N_ELEMS(element) - 1)) +#if defined(WORDS_BIGENDIAN) +#define SPLAT_ELEMENT(element) _SPLAT_MASKED(element) +#else +#define SPLAT_ELEMENT(element) (N_ELEMS(element)-1 - _SPLAT_MASKED(element)) +#endif +#define VSPLT(suffix, element) \ + void helper_vsplt##suffix (ppc_avr_t *r, ppc_avr_t *b, uint32_t splat) \ + { \ + uint32_t s = b->element[SPLAT_ELEMENT(element)]; \ + VECTOR_FOR (element) { \ + r->element[i] = s; \ + } \ + } +VSPLT(b, u8) +VSPLT(h, u16) +VSPLT(w, u32) +#undef VSPLT +#undef SPLAT_ELEMENT +#undef _SPLAT_MASKED + #define VSPLTI(suffix, element, splat_type) \ void helper_vspltis##suffix (ppc_avr_t *r, uint32_t splat) \ { \ diff --git a/target-ppc/translate.c b/target-ppc/translate.c index a21b2f5..4331548 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -6337,6 +6337,10 @@ GEN_VXFORM_SIMM(vspltisw, 908); tcg_temp_free(rd); \ } +GEN_VXFORM_UIMM(vspltb, 524); +GEN_VXFORM_UIMM(vsplth, 588); +GEN_VXFORM_UIMM(vspltw, 652); + #define GEN_VXRFORM1(opname, name, str, xo, rc) \ GEN_HANDLER2(name, str, 0x4, (xo >> 1) & 0x1f, ((xo >> 6) & 0x1f) | (rc << 4), 0x00000000, PPC_ALTIVEC) \ { \ -- 1.6.0.5