From patchwork Fri Oct 11 13:02:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Musta X-Patchwork-Id: 282744 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 771872C00E7 for ; Sat, 12 Oct 2013 00:03:35 +1100 (EST) Received: from localhost ([::1]:54243 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUcNP-00070c-1S for incoming@patchwork.ozlabs.org; Fri, 11 Oct 2013 09:03:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39962) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUcMz-00070D-T5 for qemu-devel@nongnu.org; Fri, 11 Oct 2013 09:03:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VUcMr-0008Ao-9U for qemu-devel@nongnu.org; Fri, 11 Oct 2013 09:03:05 -0400 Received: from mail-qc0-x22f.google.com ([2607:f8b0:400d:c01::22f]:43372) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUcMa-00087r-8y; Fri, 11 Oct 2013 09:02:40 -0400 Received: by mail-qc0-f175.google.com with SMTP id v2so2871947qcr.34 for ; Fri, 11 Oct 2013 06:02:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=EUAPgWQnOyGmZRLbdLksB8HZjaEgGeEtZnhSOrKuQ1k=; b=T4NScigINDeI/Zb52Owv17So+1XNHW3DKRHJi6yR+EPsiPwNQsIMeAZa8jadpXdUkc Dkv8SnXS0E65EHmfMkrJiVS8lW5zMLQedmAf8idO1TLKPxAZRHK1Gk+iA7gC/Huu7F6g IoVVxDV+a2uiMgA8dWLSEU6BOZT1YuNC984L6heR2NAf3zZlbStd3UJUAc95E7TJpj4A Q90rUbLAzbPxfWuZjhcodMYKNql4y30Qjz7xQzYWbOJPbSKntelLJ5eTj8BbzPfAPlEv yvZTAaBnwv9IqJyhpf4LV+n4u0hMqHQk3Pu70vdQfsExH8oy5Br/DLvWxdHFjYFxibcr NbSw== X-Received: by 10.49.3.3 with SMTP id 3mr7451080qey.56.1381496559790; Fri, 11 Oct 2013 06:02:39 -0700 (PDT) Received: from [9.10.80.13] (rchp4.rochester.ibm.com. [129.42.161.36]) by mx.google.com with ESMTPSA id a9sm75278858qed.6.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 11 Oct 2013 06:02:39 -0700 (PDT) Message-ID: <5257F6E6.9050503@gmail.com> Date: Fri, 11 Oct 2013 08:02:30 -0500 From: Tom Musta User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 MIME-Version: 1.0 To: qemu-ppc@nongnu.org References: <5257F4DD.7000204@gmail.com> In-Reply-To: <5257F4DD.7000204@gmail.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c01::22f Cc: Tom Musta , qemu-devel@nongnu.org Subject: [Qemu-devel] [v2 07/13] Add VSX Scalar Move Instructions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch adds the VSX scalar move instructions: - xsabsdp (Scalar Absolute Value Double-Precision) - xsnabspd (Scalar Negative Absolute Value Double-Precision) - xsnegdp (Scalar Negate Double-Precision) - xscpsgndp (Scalar Copy Sign Double-Precision) A common generator macro (VSX_SCALAR_MOVE) is added since these instructions vary only slightly from each other. Macros to support VSX XX2 and XX3 form opcodes are also added. These macros handle the overloading of "opcode 2" space (instruction bits 26:30) caused by AX and BX bits (29 and 30, respectively). Signed-off-by: Tom Musta --- target-ppc/translate.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 66 insertions(+), 0 deletions(-) #undef GEN_SPE diff --git a/target-ppc/translate.c b/target-ppc/translate.c index 8d53cb5..36e04b0 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -7167,6 +7167,55 @@ static void gen_xxpermdi(DisasContext *ctx) tcg_temp_free(xh); tcg_temp_free(xl); } +#define OP_ABS 1 +#define OP_NABS 2 +#define OP_NEG 3 +#define OP_CPSGN 4 +#define SGN_MASK_DP 0x8000000000000000ul +#define SGN_MASK_SP 0x8000000080000000ul + +#define VSX_SCALAR_MOVE(name, op, sgn_mask) \ +static void glue(gen_, name)(DisasContext * ctx) \ + { \ + TCGv_i64 xb; \ + if (unlikely(!ctx->vsx_enabled)) { \ + gen_exception(ctx, POWERPC_EXCP_VSXU); \ + return; \ + } \ + xb = tcg_temp_new(); \ + tcg_gen_mov_i64(xb, cpu_vsrh(xB(ctx->opcode))); \ + switch (op) { \ + case OP_ABS: { \ + tcg_gen_andi_i64(xb, xb, ~(sgn_mask)); \ + break; \ + } \ + case OP_NABS: { \ + tcg_gen_ori_i64(xb, xb, (sgn_mask)); \ + break; \ + } \ + case OP_NEG: { \ + tcg_gen_xori_i64(xb, xb, (sgn_mask)); \ + break; \ + } \ + case OP_CPSGN: { \ + TCGv_i64 xa = tcg_temp_new(); \ + tcg_gen_mov_i64(xa, cpu_vsrh(xA(ctx->opcode))); \ + tcg_gen_andi_i64(xa, xa, (sgn_mask)); \ + tcg_gen_andi_i64(xb, xb, ~(sgn_mask)); \ + tcg_gen_or_i64(xb, xb, xa); \ + tcg_temp_free(xa); \ + break; \ + } \ + } \ + tcg_gen_mov_i64(cpu_vsrh(xT(ctx->opcode)), xb); \ + tcg_temp_free(xb); \ + } + +VSX_SCALAR_MOVE(xsabsdp, OP_ABS, SGN_MASK_DP) +VSX_SCALAR_MOVE(xsnabsdp, OP_NABS, SGN_MASK_DP) +VSX_SCALAR_MOVE(xsnegdp, OP_NEG, SGN_MASK_DP) +VSX_SCALAR_MOVE(xscpsgndp, OP_CPSGN, SGN_MASK_DP) + /*** SPE extension ***/ /* Register moves */ @@ -9626,6 +9675,18 @@ GEN_HANDLER_E(stxsdx, 0x1F, 0xC, 0x16, 0, PPC_NONE, PPC2_VSX), GEN_HANDLER_E(stxvd2x, 0x1F, 0xC, 0x1E, 0, PPC_NONE, PPC2_VSX), GEN_HANDLER_E(stxvw4x, 0x1F, 0xC, 0x1C, 0, PPC_NONE, PPC2_VSX), +#undef GEN_XX2FORM +#define GEN_XX2FORM(name, opc2, opc3, fl2) \ +GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 0, opc3, 0, PPC_NONE, fl2), \ +GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 1, opc3, 0, PPC_NONE, fl2) + +#undef GEN_XX3FORM +#define GEN_XX3FORM(name, opc2, opc3, fl2) \ +GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 0, opc3, 0, PPC_NONE, fl2), \ +GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 1, opc3, 0, PPC_NONE, fl2), \ +GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 2, opc3, 0, PPC_NONE, fl2), \ +GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 3, opc3, 0, PPC_NONE, fl2) + #undef GEN_XX3FORM_DM #define GEN_XX3FORM_DM(name, opc2, opc3) \ GEN_HANDLER2_E(name, #name, 0x3C, opc2|0x00, opc3|0x00, 0, PPC_NONE, PPC2_VSX),\ @@ -9645,6 +9706,11 @@ GEN_HANDLER2_E(name, #name, 0x3C, opc2|0x01, opc3|0x0C, 0, PPC_NONE, PPC2_VSX),\ GEN_HANDLER2_E(name, #name, 0x3C, opc2|0x02, opc3|0x0C, 0, PPC_NONE, PPC2_VSX),\ GEN_HANDLER2_E(name, #name, 0x3C, opc2|0x03, opc3|0x0C, 0, PPC_NONE, PPC2_VSX) +GEN_XX2FORM(xsabsdp, 0x12, 0x15, PPC2_VSX), +GEN_XX2FORM(xsnabsdp, 0x12, 0x16, PPC2_VSX), +GEN_XX2FORM(xsnegdp, 0x12, 0x17, PPC2_VSX), +GEN_XX3FORM(xscpsgndp, 0x00, 0x16, PPC2_VSX), + GEN_XX3FORM_DM(xxpermdi, 0x08, 0x01),