From patchwork Tue Dec 18 06:38:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 154085 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3346947ljp; Mon, 17 Dec 2018 22:43:32 -0800 (PST) X-Google-Smtp-Source: AFSGD/XXdC2dVOG1Gp3wT1CWx3Py/mDbX/hll5YT6t5j0Nm7UIuEMHHZGRAJ+2/VXYSb80d96KPV X-Received: by 2002:aed:2539:: with SMTP id v54mr16060193qtc.211.1545115412397; Mon, 17 Dec 2018 22:43:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545115412; cv=none; d=google.com; s=arc-20160816; b=zr49R75dfROnYmBepaV0HMliCJIXt5A3WME3ErHfO3cRpKUTJz2/4uZVVsa+Vs0YfX bWjYSLK9m5Bg4/cEZ6m+CwJ2H5bgDRE1B8rFo/Nez33gHhq9G2ReHVyNAolk25r6Bpnc eq5pvQhx0ldVlUowoVOIiRmq09nhEJkYZR019lNljJiq3EjOJIwyBKDuIv3rfNiaIW2I dxYddgcXlhunlPZapxLtRuQktis1C0Z6YMOdgm0MtllAQdr4BVo7A8UQJQuzCvMXJ/Dw V4AA3NnZ+CA4zVvrE349wSLrHWQf0bx1XkniyEaIs5H4sPB0Fse0tOnljFVQxFhwUgaS wHAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=Sc18c1Pqj8TnGqV/khtRQDx5GJjTX20aUE98Ks0uh5Q=; b=T3BbPxcPS3ZM4lcJIYbhgRUE4B3Fid9xikmYGl8EsLnYFkzV8iFgoQQh5QWv1ewsOc J4edueGJsQmRCnnJcL3Ucr7nDbbgva5Yvg6INZl6jBb3F1qNu7iDw2oZDKXdSl8Vv0Ww 68hWOva9mXARh5jyWYsoM79MZfgdt/pIL6onFowCWwUFWoLrWeCyjaaoB2q/HZk06Yyh PZ1lF9qGt4m/y5QeUEYOUNn5BQ9DjlmnzFShwnP95CYri/VTwyAJv3kjO4pj49rGEc+Q enabCVMhkeu2VJJDVjN6kNQ1XDkKCXIPR5j60bdzximW4P20I3FC62iAB28YQD76qVir ptNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=L++mHnBd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id y47si1130224qtb.175.2018.12.17.22.43.32 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 17 Dec 2018 22:43:32 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=L++mHnBd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52036 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ96J-0004bm-NF for patch@linaro.org; Tue, 18 Dec 2018 01:43:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52824) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ92r-0001dJ-Pd for qemu-devel@nongnu.org; Tue, 18 Dec 2018 01:40:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ92p-0002ne-0u for qemu-devel@nongnu.org; Tue, 18 Dec 2018 01:39:57 -0500 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:33774) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gZ92o-0002EC-LL for qemu-devel@nongnu.org; Tue, 18 Dec 2018 01:39:54 -0500 Received: by mail-pf1-x442.google.com with SMTP id c123so7663614pfb.0 for ; Mon, 17 Dec 2018 22:39:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Sc18c1Pqj8TnGqV/khtRQDx5GJjTX20aUE98Ks0uh5Q=; b=L++mHnBdH1iloEx94+8o5rxsPFYhXBS5CYKfAtd0Ysx9RtY5cOJTtVGUm0W1V1LBjk s/oK2jCDzaNBQ2hqPzHv26si53omCdQkuZkegiTFHBhqhX9hbzIBxiFxnWihIqvVUVTL YciHia/kLouaFc+PFbBE2sgECpj3iPQAaOJls= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Sc18c1Pqj8TnGqV/khtRQDx5GJjTX20aUE98Ks0uh5Q=; b=YspUhDbu2p08lcXmsoZbMCj+FV2GYtyT0rtk4k+88jkSEwpkAyUxOI1WIrGnNG2Nzy Nit0COL9mK0t37KXsCmyT01iASjb5PgQLWSI4Kqw2dBn1aSzjahcd3d6uQ7fPWeHH94y vH1eCfrhA7hSFGlNwDgWKD3jsxCNTiegvzAaN2ZoOcxetxxuT5JeGycEmbjKcUt/D7tC 6y2agy1mrxECGrqdnUA/IibOVEPIsEcEEEMBGUlR12qRE+PTplMKhVwZhMNeqycBC2Cx H3cdMJLwtnLG0/UhLqtQCgKLn9G99cytPblRnSpvxOEkSouuuhClNQldtF75iZrPZ1Q/ rzeQ== X-Gm-Message-State: AA+aEWa6ZcDuJr8VwmSWlLxb4rkE80tY4kSybdmjzBuuAlKvOkK9Ufbk uvMZVDJ5LN/KisnkA1HGby8xGBafbQY= X-Received: by 2002:a65:47ca:: with SMTP id f10mr15117895pgs.166.1545115176887; Mon, 17 Dec 2018 22:39:36 -0800 (PST) Received: from cloudburst.twiddle.net (97-126-115-157.tukw.qwest.net. [97.126.115.157]) by smtp.gmail.com with ESMTPSA id c7sm27072509pfh.18.2018.12.17.22.39.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 Dec 2018 22:39:35 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 17 Dec 2018 22:38:54 -0800 Message-Id: <20181218063911.2112-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181218063911.2112-1-richard.henderson@linaro.org> References: <20181218063911.2112-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::442 Subject: [Qemu-devel] [PATCH 17/34] target/ppc: convert VMX logical instructions to use vector operations 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: qemu-ppc@nongnu.org, mark.cave-ayland@ilande.co.uk, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Mark Cave-Ayland Signed-off-by: Mark Cave-Ayland Reviewed-by: Richard Henderson Message-Id: <20181217122405.18732-9-mark.cave-ayland@ilande.co.uk> --- target/ppc/translate.c | 1 + target/ppc/translate/vmx-impl.inc.c | 63 ++++++++++++++++------------- 2 files changed, 37 insertions(+), 27 deletions(-) -- 2.17.2 Acked-by: David Gibson diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 8e89aec14d..1b61bfa093 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -24,6 +24,7 @@ #include "disas/disas.h" #include "exec/exec-all.h" #include "tcg-op.h" +#include "tcg-op-gvec.h" #include "qemu/host-utils.h" #include "exec/cpu_ldst.h" diff --git a/target/ppc/translate/vmx-impl.inc.c b/target/ppc/translate/vmx-impl.inc.c index 75d2b2280f..c13828a09d 100644 --- a/target/ppc/translate/vmx-impl.inc.c +++ b/target/ppc/translate/vmx-impl.inc.c @@ -262,41 +262,50 @@ GEN_VX_VMUL10(vmul10euq, 1, 0); GEN_VX_VMUL10(vmul10cuq, 0, 1); GEN_VX_VMUL10(vmul10ecuq, 1, 1); -/* Logical operations */ -#define GEN_VX_LOGICAL(name, tcg_op, opc2, opc3) \ -static void glue(gen_, name)(DisasContext *ctx) \ +#define GEN_VXFORM_V(name, vece, tcg_op, opc2, opc3) \ +static void glue(gen_, name)(DisasContext *ctx) \ { \ - TCGv_i64 t0 = tcg_temp_new_i64(); \ - TCGv_i64 t1 = tcg_temp_new_i64(); \ - TCGv_i64 avr = tcg_temp_new_i64(); \ - \ if (unlikely(!ctx->altivec_enabled)) { \ gen_exception(ctx, POWERPC_EXCP_VPU); \ return; \ } \ - get_avr64(t0, rA(ctx->opcode), true); \ - get_avr64(t1, rB(ctx->opcode), true); \ - tcg_op(avr, t0, t1); \ - set_avr64(rD(ctx->opcode), avr, true); \ \ - get_avr64(t0, rA(ctx->opcode), false); \ - get_avr64(t1, rB(ctx->opcode), false); \ - tcg_op(avr, t0, t1); \ - set_avr64(rD(ctx->opcode), avr, false); \ - \ - tcg_temp_free_i64(t0); \ - tcg_temp_free_i64(t1); \ - tcg_temp_free_i64(avr); \ + tcg_op(vece, \ + avr64_offset(rD(ctx->opcode), true), \ + avr64_offset(rA(ctx->opcode), true), \ + avr64_offset(rB(ctx->opcode), true), \ + 16, 16); \ } -GEN_VX_LOGICAL(vand, tcg_gen_and_i64, 2, 16); -GEN_VX_LOGICAL(vandc, tcg_gen_andc_i64, 2, 17); -GEN_VX_LOGICAL(vor, tcg_gen_or_i64, 2, 18); -GEN_VX_LOGICAL(vxor, tcg_gen_xor_i64, 2, 19); -GEN_VX_LOGICAL(vnor, tcg_gen_nor_i64, 2, 20); -GEN_VX_LOGICAL(veqv, tcg_gen_eqv_i64, 2, 26); -GEN_VX_LOGICAL(vnand, tcg_gen_nand_i64, 2, 22); -GEN_VX_LOGICAL(vorc, tcg_gen_orc_i64, 2, 21); +#define GEN_VXFORM_VN(name, vece, tcg_op, opc2, opc3) \ +static void glue(gen_, name)(DisasContext *ctx) \ +{ \ + if (unlikely(!ctx->altivec_enabled)) { \ + gen_exception(ctx, POWERPC_EXCP_VPU); \ + return; \ + } \ + \ + tcg_op(vece, \ + avr64_offset(rD(ctx->opcode), true), \ + avr64_offset(rA(ctx->opcode), true), \ + avr64_offset(rB(ctx->opcode), true), \ + 16, 16); \ + \ + tcg_gen_gvec_not(vece, \ + avr64_offset(rD(ctx->opcode), true), \ + avr64_offset(rD(ctx->opcode), true), \ + 16, 16); \ +} + +/* Logical operations */ +GEN_VXFORM_V(vand, MO_64, tcg_gen_gvec_and, 2, 16); +GEN_VXFORM_V(vandc, MO_64, tcg_gen_gvec_andc, 2, 17); +GEN_VXFORM_V(vor, MO_64, tcg_gen_gvec_or, 2, 18); +GEN_VXFORM_V(vxor, MO_64, tcg_gen_gvec_xor, 2, 19); +GEN_VXFORM_VN(vnor, MO_64, tcg_gen_gvec_or, 2, 20); +GEN_VXFORM_VN(veqv, MO_64, tcg_gen_gvec_xor, 2, 26); +GEN_VXFORM_VN(vnand, MO_64, tcg_gen_gvec_and, 2, 22); +GEN_VXFORM_V(vorc, MO_64, tcg_gen_gvec_orc, 2, 21); #define GEN_VXFORM(name, opc2, opc3) \ static void glue(gen_, name)(DisasContext *ctx) \