From patchwork Tue Sep 6 03:43:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 9315773 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 4D7B3601C0 for ; Tue, 6 Sep 2016 06:31:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 285B3283FD for ; Tue, 6 Sep 2016 06:31:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C82F28601; Tue, 6 Sep 2016 06:31:31 +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 8506A283FD for ; Tue, 6 Sep 2016 06:31:30 +0000 (UTC) Received: from localhost ([::1]:59146 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bh9sz-0005Mo-J2 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Sep 2016 02:29:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50166) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bh7GQ-0003Dz-Sg for qemu-devel@nongnu.org; Mon, 05 Sep 2016 23:41:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bh7GH-0007uh-2v for qemu-devel@nongnu.org; Mon, 05 Sep 2016 23:41:34 -0400 Received: from ozlabs.org ([103.22.144.67]:54677) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bh7GG-0007ki-Dx; Mon, 05 Sep 2016 23:41:24 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3sSspC45qLz9snm; 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=NsvQqfFus1M36XwSpoW364nqnm+6RbDLRlaKDGXmPPA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ONrtEvXynfvzeqpghSNbr6fzAmUUC+FUIWBgKr1JCujCGpVpxvQ0DYjGsJTFeFeNH TvEmKd0N9wM4ID/ZW9w+pU5hoxsRaYhlXQnIyz/0TLUY1wFP1E/JE1Qs97hRmU99/V sMmJwHBDvyWK5DnA4SSbY6u/uu5lkq1q4hFLk+OM= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 6 Sep 2016 13:43:00 +1000 Message-Id: <1473133396-18940-51-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 50/66] target-ppc: add vcmpnez[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: Nikunj A Dadhania , Swapnil Bokade , 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: Swapnil Bokade Adds following instructions: vcmpnezb[.]: Vector Compare Not Equal or Zero Byte vcmpnezh[.]: Vector Compare Not Equal or Zero Halfword vcmpnezw[.]: Vector Compare Not Equal or Zero Word Signed-off-by: Swapnil Bokade [ collapse switch case ] Signed-off-by: Nikunj A Dadhania Reviewed-by: Richard Henderson Signed-off-by: David Gibson --- target-ppc/helper.h | 6 ++++++ target-ppc/int_helper.c | 36 ++++++++++++++++++++++++++++++++++++ target-ppc/translate/vmx-impl.c | 3 +++ target-ppc/translate/vmx-ops.c | 9 +++++++++ 4 files changed, 54 insertions(+) diff --git a/target-ppc/helper.h b/target-ppc/helper.h index ff6287e..e93b84b 100644 --- a/target-ppc/helper.h +++ b/target-ppc/helper.h @@ -144,6 +144,9 @@ DEF_HELPER_4(vcmpequb, void, env, avr, avr, avr) DEF_HELPER_4(vcmpequh, void, env, avr, avr, avr) DEF_HELPER_4(vcmpequw, void, env, avr, avr, avr) DEF_HELPER_4(vcmpequd, void, env, avr, avr, avr) +DEF_HELPER_4(vcmpnezb, void, env, avr, avr, avr) +DEF_HELPER_4(vcmpnezh, void, env, avr, avr, avr) +DEF_HELPER_4(vcmpnezw, void, env, avr, avr, avr) DEF_HELPER_4(vcmpgtub, void, env, avr, avr, avr) DEF_HELPER_4(vcmpgtuh, void, env, avr, avr, avr) DEF_HELPER_4(vcmpgtuw, void, env, avr, avr, avr) @@ -160,6 +163,9 @@ DEF_HELPER_4(vcmpequb_dot, void, env, avr, avr, avr) DEF_HELPER_4(vcmpequh_dot, void, env, avr, avr, avr) DEF_HELPER_4(vcmpequw_dot, void, env, avr, avr, avr) DEF_HELPER_4(vcmpequd_dot, void, env, avr, avr, avr) +DEF_HELPER_4(vcmpnezb_dot, void, env, avr, avr, avr) +DEF_HELPER_4(vcmpnezh_dot, void, env, avr, avr, avr) +DEF_HELPER_4(vcmpnezw_dot, void, env, avr, avr, avr) DEF_HELPER_4(vcmpgtub_dot, void, env, avr, avr, avr) DEF_HELPER_4(vcmpgtuh_dot, void, env, avr, avr, avr) DEF_HELPER_4(vcmpgtuw_dot, void, env, avr, avr, avr) diff --git a/target-ppc/int_helper.c b/target-ppc/int_helper.c index ef487d0..9b4de69 100644 --- a/target-ppc/int_helper.c +++ b/target-ppc/int_helper.c @@ -719,6 +719,42 @@ VCMP(gtsd, >, s64) #undef VCMP_DO #undef VCMP +#define VCMPNEZ_DO(suffix, element, etype, record) \ +void helper_vcmpnez##suffix(CPUPPCState *env, ppc_avr_t *r, \ + ppc_avr_t *a, ppc_avr_t *b) \ +{ \ + etype ones = (etype)-1; \ + etype all = ones; \ + etype none = 0; \ + int i; \ + \ + for (i = 0; i < ARRAY_SIZE(r->element); i++) { \ + etype result = ((a->element[i] == 0) \ + || (b->element[i] == 0) \ + || (a->element[i] != b->element[i]) ? \ + ones : 0x0); \ + r->element[i] = result; \ + all &= result; \ + none |= result; \ + } \ + if (record) { \ + env->crf[6] = ((all != 0) << 3) | ((none == 0) << 1); \ + } \ +} + +/* VCMPNEZ - Vector compare not equal to zero + * suffix - instruction mnemonic suffix (b: byte, h: halfword, w: word) + * element - element type to access from vector + */ +#define VCMPNEZ(suffix, element, etype) \ + VCMPNEZ_DO(suffix, element, etype, 0) \ + VCMPNEZ_DO(suffix##_dot, element, etype, 1) +VCMPNEZ(b, u8, uint8_t) +VCMPNEZ(h, u16, uint16_t) +VCMPNEZ(w, u32, uint32_t) +#undef VCMPNEZ_DO +#undef VCMPNEZ + #define VCMPFP_DO(suffix, compare, order, record) \ void helper_vcmp##suffix(CPUPPCState *env, ppc_avr_t *r, \ ppc_avr_t *a, ppc_avr_t *b) \ diff --git a/target-ppc/translate/vmx-impl.c b/target-ppc/translate/vmx-impl.c index ad0345f..5cd007e 100644 --- a/target-ppc/translate/vmx-impl.c +++ b/target-ppc/translate/vmx-impl.c @@ -493,6 +493,9 @@ GEN_VXRFORM(vcmpequb, 3, 0) GEN_VXRFORM(vcmpequh, 3, 1) GEN_VXRFORM(vcmpequw, 3, 2) GEN_VXRFORM(vcmpequd, 3, 3) +GEN_VXRFORM(vcmpnezb, 3, 4) +GEN_VXRFORM(vcmpnezh, 3, 5) +GEN_VXRFORM(vcmpnezw, 3, 6) GEN_VXRFORM(vcmpgtsb, 3, 12) GEN_VXRFORM(vcmpgtsh, 3, 13) GEN_VXRFORM(vcmpgtsw, 3, 14) diff --git a/target-ppc/translate/vmx-ops.c b/target-ppc/translate/vmx-ops.c index 59016af..0be6989 100644 --- a/target-ppc/translate/vmx-ops.c +++ b/target-ppc/translate/vmx-ops.c @@ -160,12 +160,21 @@ GEN_VXFORM(vminfp, 5, 17), #define GEN_VXRFORM1(opname, name, str, opc2, opc3) \ GEN_HANDLER2(name, str, 0x4, opc2, opc3, 0x00000000, PPC_ALTIVEC), +#define GEN_VXRFORM1_300(opname, name, str, opc2, opc3) \ +GEN_HANDLER2_E(name, str, 0x4, opc2, opc3, 0x00000000, PPC_NONE, PPC2_ISA300), #define GEN_VXRFORM(name, opc2, opc3) \ GEN_VXRFORM1(name, name, #name, opc2, opc3) \ GEN_VXRFORM1(name##_dot, name##_, #name ".", opc2, (opc3 | (0x1 << 4))) +#define GEN_VXRFORM_300(name, opc2, opc3) \ + GEN_VXRFORM1_300(name, name, #name, opc2, opc3) \ + GEN_VXRFORM1_300(name##_dot, name##_, #name ".", opc2, (opc3 | (0x1 << 4))) + GEN_VXRFORM(vcmpequb, 3, 0) GEN_VXRFORM(vcmpequh, 3, 1) GEN_VXRFORM(vcmpequw, 3, 2) +GEN_VXRFORM_300(vcmpnezb, 3, 4) +GEN_VXRFORM_300(vcmpnezh, 3, 5) +GEN_VXRFORM_300(vcmpnezw, 3, 6) GEN_VXRFORM(vcmpgtsb, 3, 12) GEN_VXRFORM(vcmpgtsh, 3, 13) GEN_VXRFORM(vcmpgtsw, 3, 14)