From patchwork Tue May 21 06:29:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 164688 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp1238280ili; Mon, 20 May 2019 23:52:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqxbnuD4vtTtqgJHo2jE/ZX1AbvulzWDPQ4r1X5pE3AxkmGDFhb8Bg4yRsjB+uXWFbjAqqEl X-Received: by 2002:a17:906:4e56:: with SMTP id g22mr55662578ejw.51.1558421524284; Mon, 20 May 2019 23:52:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558421524; cv=none; d=google.com; s=arc-20160816; b=x/iBJGeB+Lb6sm0iB/qhFd8pulpoOnDpXu8XRIWtuCgVl/OUe6tKNPLQSM1lZTU/j2 aQjQZ6h+Kr8Zfkl4Iq1d7/XevKyki4mnjyCAya0agFXe4zz+1LrzjqMuOT79CB0pzT/8 cwPSO5oBKN9NOXASDfTC+++ZhZQ+SWqO4Q6swlGcSaydIDb7HXdaMKTWO1Z7Iewq9opV WscQzs65cdXgflVOvG35jAcKZE4zEp8kPxq6/tp6T3DnQ8Pq5TAB+LVGb/q7wHQJ4ypT zUEZVGCwN9BslTvP6aj86NjwthPiWOB4D4LMXePl9C6IJWqAt+D2B6U4TSPhQ9KgESA7 zDFQ== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=Q4vQpRCrULRKjtDudnOslqA204HDOwhHqNHhJKFh4UE=; b=oJCY+Zvml2fmrRHprDwH4V/r4Gfb6Bebbnifl6a9uSjI2UowziAlCAoaJxe6ydKMQL tudlla9k/CyeFPJqkVDKj3zsr4EsDGiGwaO7JX3Z56/qabiV2YsKjC7nCXI5HcaG2pA5 fOI/Ipu4HqDwgN1Mbw065CQ0aXQKnq/IylPwm8at9HtSqFFtFFrsmDlAAXg/dsSBsCpb x2px4P6vtrCwckR5+BghGfcQqEDr4GBT2OrEeHgz740cUuQTVHgdaFNeySevmEk3Zxa9 Nl5ucCk0Dp43hOBvUdruLrqYLjbPcFBjVMPUi7PApAGVNBXwo/2oP9OzjEPLqGew419/ AhMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gibson.dropbear.id.au header.s=201602 header.b=V6tslp1u; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k9si1690412ejp.58.2019.05.20.23.52.03 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 20 May 2019 23:52:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gibson.dropbear.id.au header.s=201602 header.b=V6tslp1u; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([127.0.0.1]:47678 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSyd1-0000KJ-4Z for patch@linaro.org; Tue, 21 May 2019 02:52:03 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49230) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSyHt-0006QC-RR for qemu-devel@nongnu.org; Tue, 21 May 2019 02:30:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSyHs-0008Jl-1e for qemu-devel@nongnu.org; Tue, 21 May 2019 02:30:13 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:42417) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hSyHq-0007nU-Mu; Tue, 21 May 2019 02:30:11 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 457Qpg6v5jz9sPD; Tue, 21 May 2019 16:29:31 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1558420171; bh=JovPQt+w+OsaE4OA9JcscahCs/Ep/b23xTHJ4b5HExg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V6tslp1uav4sKP3WDnnYDChf20x5kLpoHkN3QeYIgKnTLbuTVTKqrj3jBdApcrdhy C23qMkdtH7v8NAQ+8J80sh7dlJ0nAFLa9W04t8RF9yzjdhpqV283HZH+dCsuXEVp55 3d4quL0ecFn5IO8/wCw8n5+sFKsYpXHos/he2htg= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 21 May 2019 16:29:08 +1000 Message-Id: <20190521062924.6930-23-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190521062924.6930-1-david@gibson.dropbear.id.au> References: <20190521062924.6930-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 22/38] target/ppc: Use vector variable shifts for VSL, VSR, VSRA 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: lvivier@redhat.com, gkurz@kaod.org, Richard Henderson , qemu-devel@nongnu.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson The gvec expanders take care of masking the shift amount against the element width. Signed-off-by: Richard Henderson Message-Id: <20190518191430.21686-2-richard.henderson@linaro.org> Signed-off-by: David Gibson --- target/ppc/helper.h | 12 ---------- target/ppc/int_helper.c | 37 ----------------------------- target/ppc/translate/vmx-impl.inc.c | 24 +++++++++---------- 3 files changed, 12 insertions(+), 61 deletions(-) -- 2.21.0 diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 638a6e99c4..02b67a333e 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -180,18 +180,6 @@ DEF_HELPER_3(vmuloub, void, avr, avr, avr) DEF_HELPER_3(vmulouh, void, avr, avr, avr) DEF_HELPER_3(vmulouw, void, avr, avr, avr) DEF_HELPER_3(vmuluwm, void, avr, avr, avr) -DEF_HELPER_3(vsrab, void, avr, avr, avr) -DEF_HELPER_3(vsrah, void, avr, avr, avr) -DEF_HELPER_3(vsraw, void, avr, avr, avr) -DEF_HELPER_3(vsrad, void, avr, avr, avr) -DEF_HELPER_3(vsrb, void, avr, avr, avr) -DEF_HELPER_3(vsrh, void, avr, avr, avr) -DEF_HELPER_3(vsrw, void, avr, avr, avr) -DEF_HELPER_3(vsrd, void, avr, avr, avr) -DEF_HELPER_3(vslb, void, avr, avr, avr) -DEF_HELPER_3(vslh, void, avr, avr, avr) -DEF_HELPER_3(vslw, void, avr, avr, avr) -DEF_HELPER_3(vsld, void, avr, avr, avr) DEF_HELPER_3(vslo, void, avr, avr, avr) DEF_HELPER_3(vsro, void, avr, avr, avr) DEF_HELPER_3(vsrv, void, avr, avr, avr) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index f5c81acd53..0b22774a9d 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -1776,23 +1776,6 @@ VSHIFT(l, 1) VSHIFT(r, 0) #undef VSHIFT -#define VSL(suffix, element, mask) \ - void helper_vsl##suffix(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \ - { \ - int i; \ - \ - for (i = 0; i < ARRAY_SIZE(r->element); i++) { \ - unsigned int shift = b->element[i] & mask; \ - \ - r->element[i] = a->element[i] << shift; \ - } \ - } -VSL(b, u8, 0x7) -VSL(h, u16, 0x0F) -VSL(w, u32, 0x1F) -VSL(d, u64, 0x3F) -#undef VSL - void helper_vslv(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) { int i; @@ -1965,26 +1948,6 @@ VNEG(vnegw, s32) VNEG(vnegd, s64) #undef VNEG -#define VSR(suffix, element, mask) \ - void helper_vsr##suffix(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \ - { \ - int i; \ - \ - for (i = 0; i < ARRAY_SIZE(r->element); i++) { \ - unsigned int shift = b->element[i] & mask; \ - r->element[i] = a->element[i] >> shift; \ - } \ - } -VSR(ab, s8, 0x7) -VSR(ah, s16, 0xF) -VSR(aw, s32, 0x1F) -VSR(ad, s64, 0x3F) -VSR(b, u8, 0x7) -VSR(h, u16, 0xF) -VSR(w, u32, 0x1F) -VSR(d, u64, 0x3F) -#undef VSR - void helper_vsro(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) { int sh = (b->VsrB(0xf) >> 3) & 0xf; diff --git a/target/ppc/translate/vmx-impl.inc.c b/target/ppc/translate/vmx-impl.inc.c index 6861f4c5b9..663275b729 100644 --- a/target/ppc/translate/vmx-impl.inc.c +++ b/target/ppc/translate/vmx-impl.inc.c @@ -530,21 +530,21 @@ GEN_VXFORM(vmuleuw, 4, 10); GEN_VXFORM(vmulesb, 4, 12); GEN_VXFORM(vmulesh, 4, 13); GEN_VXFORM(vmulesw, 4, 14); -GEN_VXFORM(vslb, 2, 4); -GEN_VXFORM(vslh, 2, 5); -GEN_VXFORM(vslw, 2, 6); +GEN_VXFORM_V(vslb, MO_8, tcg_gen_gvec_shlv, 2, 4); +GEN_VXFORM_V(vslh, MO_16, tcg_gen_gvec_shlv, 2, 5); +GEN_VXFORM_V(vslw, MO_32, tcg_gen_gvec_shlv, 2, 6); GEN_VXFORM(vrlwnm, 2, 6); GEN_VXFORM_DUAL(vslw, PPC_ALTIVEC, PPC_NONE, \ vrlwnm, PPC_NONE, PPC2_ISA300) -GEN_VXFORM(vsld, 2, 23); -GEN_VXFORM(vsrb, 2, 8); -GEN_VXFORM(vsrh, 2, 9); -GEN_VXFORM(vsrw, 2, 10); -GEN_VXFORM(vsrd, 2, 27); -GEN_VXFORM(vsrab, 2, 12); -GEN_VXFORM(vsrah, 2, 13); -GEN_VXFORM(vsraw, 2, 14); -GEN_VXFORM(vsrad, 2, 15); +GEN_VXFORM_V(vsld, MO_64, tcg_gen_gvec_shlv, 2, 23); +GEN_VXFORM_V(vsrb, MO_8, tcg_gen_gvec_shrv, 2, 8); +GEN_VXFORM_V(vsrh, MO_16, tcg_gen_gvec_shrv, 2, 9); +GEN_VXFORM_V(vsrw, MO_32, tcg_gen_gvec_shrv, 2, 10); +GEN_VXFORM_V(vsrd, MO_64, tcg_gen_gvec_shrv, 2, 27); +GEN_VXFORM_V(vsrab, MO_8, tcg_gen_gvec_sarv, 2, 12); +GEN_VXFORM_V(vsrah, MO_16, tcg_gen_gvec_sarv, 2, 13); +GEN_VXFORM_V(vsraw, MO_32, tcg_gen_gvec_sarv, 2, 14); +GEN_VXFORM_V(vsrad, MO_64, tcg_gen_gvec_sarv, 2, 15); GEN_VXFORM(vsrv, 2, 28); GEN_VXFORM(vslv, 2, 29); GEN_VXFORM(vslo, 6, 16);