From patchwork Tue Sep 6 03:42:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 9315685 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8821760760 for ; Tue, 6 Sep 2016 05:33:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A5C128B4A for ; Tue, 6 Sep 2016 05:33:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5F41528B59; Tue, 6 Sep 2016 05:33:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 349E728B56 for ; Tue, 6 Sep 2016 05:33:55 +0000 (UTC) Received: from localhost ([::1]:58779 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bh918-0007zJ-ED for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Sep 2016 01:33:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50175) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bh7GQ-0003E0-Sh for qemu-devel@nongnu.org; Mon, 05 Sep 2016 23:41:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bh7GH-0007ut-Af for qemu-devel@nongnu.org; Mon, 05 Sep 2016 23:41:34 -0400 Received: from ozlabs.org ([103.22.144.67]:47838) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bh7GG-0007kg-LO; Mon, 05 Sep 2016 23:41:25 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3sSspC71SKz9sC4; Tue, 6 Sep 2016 13:41:20 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1473133283; bh=pFN+bCRg3ISNncgGxr80svELFLpA6klAj8ka7VoWo3E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kd6svFyQRHQx9u7j4avitGH4jeRbufddinMpAe6RQPFVSI/iDKFnGEbf6rCX7Vn7W Y1//PQLrXdqBWzsuEafPGn7qbJ3BlBBKBenM+MM8Fs/cJwQSm+GZw3cbnILfBTjZQb WNe0rWPr52JG70IALqmYJqcabA/q3QG9tCEPkTI4= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 6 Sep 2016 13:42:59 +1000 Message-Id: <1473133396-18940-50-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1473133396-18940-1-git-send-email-david@gibson.dropbear.id.au> References: <1473133396-18940-1-git-send-email-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 49/66] target-ppc: add vabsdu[b, h, w] instructions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sandipan Das , Nikunj A Dadhania , agraf@suse.de, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Sandipan Das Adds following instructions: vabsdub: Vector Absolute Difference Unsigned Byte vabsduh: Vector Absolute Difference Unsigned Halfword vabsduw: Vector Absolute Difference Unsigned Word Signed-off-by: Sandipan Das [ use ISA300 define. Drop etype ] Signed-off-by: Nikunj A Dadhania Reviewed-by: Richard Henderson Signed-off-by: David Gibson --- target-ppc/helper.h | 3 +++ target-ppc/int_helper.c | 24 ++++++++++++++++++++++++ target-ppc/translate/vmx-impl.c | 9 +++++++++ target-ppc/translate/vmx-ops.c | 6 +++--- 4 files changed, 39 insertions(+), 3 deletions(-) diff --git a/target-ppc/helper.h b/target-ppc/helper.h index 68fd19e..ff6287e 100644 --- a/target-ppc/helper.h +++ b/target-ppc/helper.h @@ -118,6 +118,9 @@ DEF_HELPER_3(vsubudm, void, avr, avr, avr) DEF_HELPER_3(vavgub, void, avr, avr, avr) DEF_HELPER_3(vavguh, void, avr, avr, avr) DEF_HELPER_3(vavguw, void, avr, avr, avr) +DEF_HELPER_3(vabsdub, void, avr, avr, avr) +DEF_HELPER_3(vabsduh, void, avr, avr, avr) +DEF_HELPER_3(vabsduw, void, avr, avr, avr) DEF_HELPER_3(vavgsb, void, avr, avr, avr) DEF_HELPER_3(vavgsh, void, avr, avr, avr) DEF_HELPER_3(vavgsw, void, avr, avr, avr) diff --git a/target-ppc/int_helper.c b/target-ppc/int_helper.c index 15947ad..ef487d0 100644 --- a/target-ppc/int_helper.c +++ b/target-ppc/int_helper.c @@ -629,6 +629,30 @@ VAVG(w, s32, int64_t, u32, uint64_t) #undef VAVG_DO #undef VAVG +#define VABSDU_DO(name, element) \ +void helper_v##name(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \ +{ \ + int i; \ + \ + for (i = 0; i < ARRAY_SIZE(r->element); i++) { \ + r->element[i] = (a->element[i] > b->element[i]) ? \ + (a->element[i] - b->element[i]) : \ + (b->element[i] - a->element[i]); \ + } \ +} + +/* VABSDU - Vector absolute difference unsigned + * name - instruction mnemonic suffix (b: byte, h: halfword, w: word) + * element - element type to access from vector + */ +#define VABSDU(type, element) \ + VABSDU_DO(absdu##type, element) +VABSDU(b, u8) +VABSDU(h, u16) +VABSDU(w, u32) +#undef VABSDU_DO +#undef VABSDU + #define VCF(suffix, cvt, element) \ void helper_vcf##suffix(CPUPPCState *env, ppc_avr_t *r, \ ppc_avr_t *b, uint32_t uim) \ diff --git a/target-ppc/translate/vmx-impl.c b/target-ppc/translate/vmx-impl.c index 110e19c..ad0345f 100644 --- a/target-ppc/translate/vmx-impl.c +++ b/target-ppc/translate/vmx-impl.c @@ -301,8 +301,17 @@ GEN_VXFORM(vminsh, 1, 13); GEN_VXFORM(vminsw, 1, 14); GEN_VXFORM(vminsd, 1, 15); GEN_VXFORM(vavgub, 1, 16); +GEN_VXFORM(vabsdub, 1, 16); +GEN_VXFORM_DUAL(vavgub, PPC_ALTIVEC, PPC_NONE, \ + vabsdub, PPC_NONE, PPC2_ISA300) GEN_VXFORM(vavguh, 1, 17); +GEN_VXFORM(vabsduh, 1, 17); +GEN_VXFORM_DUAL(vavguh, PPC_ALTIVEC, PPC_NONE, \ + vabsduh, PPC_NONE, PPC2_ISA300) GEN_VXFORM(vavguw, 1, 18); +GEN_VXFORM(vabsduw, 1, 18); +GEN_VXFORM_DUAL(vavguw, PPC_ALTIVEC, PPC_NONE, \ + vabsduw, PPC_NONE, PPC2_ISA300) GEN_VXFORM(vavgsb, 1, 20); GEN_VXFORM(vavgsh, 1, 21); GEN_VXFORM(vavgsw, 1, 22); diff --git a/target-ppc/translate/vmx-ops.c b/target-ppc/translate/vmx-ops.c index 185dc71..59016af 100644 --- a/target-ppc/translate/vmx-ops.c +++ b/target-ppc/translate/vmx-ops.c @@ -69,9 +69,9 @@ GEN_VXFORM(vminsb, 1, 12), GEN_VXFORM(vminsh, 1, 13), GEN_VXFORM(vminsw, 1, 14), GEN_VXFORM_207(vminsd, 1, 15), -GEN_VXFORM(vavgub, 1, 16), -GEN_VXFORM(vavguh, 1, 17), -GEN_VXFORM(vavguw, 1, 18), +GEN_VXFORM_DUAL(vavgub, vabsdub, 1, 16, PPC_ALTIVEC, PPC_NONE), +GEN_VXFORM_DUAL(vavguh, vabsduh, 1, 17, PPC_ALTIVEC, PPC_NONE), +GEN_VXFORM_DUAL(vavguw, vabsduw, 1, 18, PPC_ALTIVEC, PPC_NONE), GEN_VXFORM(vavgsb, 1, 20), GEN_VXFORM(vavgsh, 1, 21), GEN_VXFORM(vavgsw, 1, 22),