From patchwork Mon Feb 18 14:30:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 158633 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2619320jaa; Mon, 18 Feb 2019 07:27:01 -0800 (PST) X-Google-Smtp-Source: AHgI3IaUfKb9r8z08YMau+IYg1HmNPhY2kRk9D91ENMoXvwXGkW8i0sGoTEJsjlrL92h13VHro1R X-Received: by 2002:a25:8b8f:: with SMTP id j15mr19466639ybl.373.1550503621891; Mon, 18 Feb 2019 07:27:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550503621; cv=none; d=google.com; s=arc-20160816; b=OPgPgbDvqz7uWpZmxUe10WQfEeaQcCFeMOq3mQI2Yp/doVjpHKzej6MExiVzolykpL GMQDzbFYQm5mhTkZprQx316+oopX48dwFL/iUuJ/P+dGa8CVJNbL/3nMUCQBDpWBzQ9j 4wcdl39KTkBq2lKEw7dOHEVns0QV8w4+jCep+yTwQapfGJo0/3ypqj18+0VH2X+WndCl CqMHhLFbwXlqylrLgpEIp6KxxAa+MlSwEnHLp9L6d5BGH6zbGgap8cLYd+PgZHtLHQYp LS8U5N7t4IDBZoqQcaxvZF97AiOzTAif79qo81MQHI6f73w5amsIMnsUy71ebmU55tsP yG9Q== 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=TQwWBZls1kQ/NUKYMMRzEt/s2VK98xivggZDC3mS0RA=; b=kNHFpceztPPc8xosrhybhYmEkfqA0jaCRkmpsMPAyGPQQu20j1dDRdYVM+3j9sbgd7 u1KCFEsGb/if7SCr+kC3T/IKlmOB929OCd8cHPMkjMVleep4K+qTneSUVeiwxqztgmz2 DVFHRda2gYel+BuLXKaLGHaV14F0K1ns4wD9VPoFggATtqh8pL/g/r4gVPQ1JBRrwOEH WImKyYS35SCjFrHZwPxeh2PnyCAluOWqO9Ui9L7QSggFolwKGma51zd+Qw3EGPTqTEIU 9jU8d5lPDVBHAhReBmOJ2s8m+NQjf0/SWJuIyL/76QWQ32D20GnnTf1lMT7PI2SNMlqc xfKg== 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=kx07n7Uw; 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 z8si2331107ywd.416.2019.02.18.07.27.01 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 18 Feb 2019 07:27:01 -0800 (PST) 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=kx07n7Uw; 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]:60528 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkov-0001E0-FA for patch@linaro.org; Mon, 18 Feb 2019 10:27:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39623) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjyF-0006qx-RR for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjxw-0003GK-Mk for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:27 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:55463) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjxv-0003BR-MX; Mon, 18 Feb 2019 09:32:16 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435s10R1Wz9sRR; Tue, 19 Feb 2019 01:31:16 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500277; bh=WubUiDDXXur8qFHgUdiC67JJm1jDf1+DCdSvFn1QqUk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kx07n7UwHo5HO2TEh2bpG6O+BTWuc0Aqy/opcsO86e+pNas7tPrHOp5cRubtc4/3k BmhHoYHpwiCHs47OXeFTRTjDssnKJKg7neatYpMQL9J7WIgnxrZLwQ4HUOUty2lTTD 7uRdt95ShlUSzGNJnbrmd0qXP25roKty/pEpkhNQ= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:36 +1100 Message-Id: <20190218143049.17142-31-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-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 30/43] target/ppc: convert vsplt[bhw] 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: Richard Henderson , groug@kaod.org, 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 Signed-off-by: Richard Henderson Acked-by: David Gibson Message-Id: <20190215100058.20015-5-mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson --- target/ppc/helper.h | 3 -- target/ppc/int_helper.c | 19 ------------ target/ppc/translate/vmx-impl.inc.c | 46 +++++++++++++++++------------ 3 files changed, 27 insertions(+), 41 deletions(-) -- 2.20.1 diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 2aa60e5d36..069daa9883 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -246,9 +246,6 @@ DEF_HELPER_3(vrld, void, avr, avr, avr) DEF_HELPER_3(vsl, void, avr, avr, avr) DEF_HELPER_3(vsr, void, avr, avr, avr) DEF_HELPER_4(vsldoi, void, avr, avr, avr, i32) -DEF_HELPER_3(vspltb, void, avr, avr, i32) -DEF_HELPER_3(vsplth, void, avr, avr, i32) -DEF_HELPER_3(vspltw, void, avr, avr, i32) DEF_HELPER_3(vextractub, void, avr, avr, i32) DEF_HELPER_3(vextractuh, void, avr, avr, i32) DEF_HELPER_3(vextractuw, void, avr, avr, i32) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 2f793a3543..5c9623e952 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -1869,25 +1869,6 @@ void helper_vslo(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) #endif } -/* Experimental testing shows that hardware masks the immediate. */ -#define _SPLAT_MASKED(element) (splat & (ARRAY_SIZE(r->element) - 1)) -#define SPLAT_ELEMENT(element) _SPLAT_MASKED(element) -#define VSPLT(suffix, element, access) \ - void helper_vsplt##suffix(ppc_avr_t *r, ppc_avr_t *b, uint32_t splat) \ - { \ - uint32_t s = b->access(SPLAT_ELEMENT(element)); \ - int i; \ - \ - for (i = 0; i < ARRAY_SIZE(r->element); i++) { \ - r->access(i) = s; \ - } \ - } -VSPLT(b, u8, VsrB) -VSPLT(h, u16, VsrH) -VSPLT(w, u32, VsrW) -#undef VSPLT -#undef SPLAT_ELEMENT -#undef _SPLAT_MASKED #if defined(HOST_WORDS_BIGENDIAN) #define VINSERT(suffix, element) \ void helper_vinsert##suffix(ppc_avr_t *r, ppc_avr_t *b, uint32_t index) \ diff --git a/target/ppc/translate/vmx-impl.inc.c b/target/ppc/translate/vmx-impl.inc.c index c26c342e16..41ddbd879f 100644 --- a/target/ppc/translate/vmx-impl.inc.c +++ b/target/ppc/translate/vmx-impl.inc.c @@ -798,24 +798,32 @@ GEN_VXFORM_NOA(vprtybw, 1, 24); GEN_VXFORM_NOA(vprtybd, 1, 24); GEN_VXFORM_NOA(vprtybq, 1, 24); -#define GEN_VXFORM_UIMM(name, opc2, opc3) \ -static void glue(gen_, name)(DisasContext *ctx) \ - { \ - TCGv_ptr rb, rd; \ - TCGv_i32 uimm; \ - if (unlikely(!ctx->altivec_enabled)) { \ - gen_exception(ctx, POWERPC_EXCP_VPU); \ - return; \ - } \ - uimm = tcg_const_i32(UIMM5(ctx->opcode)); \ - rb = gen_avr_ptr(rB(ctx->opcode)); \ - rd = gen_avr_ptr(rD(ctx->opcode)); \ - gen_helper_##name (rd, rb, uimm); \ - tcg_temp_free_i32(uimm); \ - tcg_temp_free_ptr(rb); \ - tcg_temp_free_ptr(rd); \ +static void gen_vsplt(DisasContext *ctx, int vece) +{ + int uimm, dofs, bofs; + + if (unlikely(!ctx->altivec_enabled)) { + gen_exception(ctx, POWERPC_EXCP_VPU); + return; } + uimm = UIMM5(ctx->opcode); + bofs = avr64_offset(rB(ctx->opcode), true); + dofs = avr64_offset(rD(ctx->opcode), true); + + /* Experimental testing shows that hardware masks the immediate. */ + bofs += (uimm << vece) & 15; +#ifndef HOST_WORDS_BIGENDIAN + bofs ^= 15; + bofs &= ~((1 << vece) - 1); +#endif + + tcg_gen_gvec_dup_mem(vece, dofs, bofs, 16, 16); +} + +#define GEN_VXFORM_VSPLT(name, vece, opc2, opc3) \ +static void glue(gen_, name)(DisasContext *ctx) { gen_vsplt(ctx, vece); } + #define GEN_VXFORM_UIMM_ENV(name, opc2, opc3) \ static void glue(gen_, name)(DisasContext *ctx) \ { \ @@ -858,9 +866,9 @@ static void glue(gen_, name)(DisasContext *ctx) \ tcg_temp_free_ptr(rd); \ } -GEN_VXFORM_UIMM(vspltb, 6, 8); -GEN_VXFORM_UIMM(vsplth, 6, 9); -GEN_VXFORM_UIMM(vspltw, 6, 10); +GEN_VXFORM_VSPLT(vspltb, MO_8, 6, 8); +GEN_VXFORM_VSPLT(vsplth, MO_16, 6, 9); +GEN_VXFORM_VSPLT(vspltw, MO_32, 6, 10); GEN_VXFORM_UIMM_SPLAT(vextractub, 6, 8, 15); GEN_VXFORM_UIMM_SPLAT(vextractuh, 6, 9, 14); GEN_VXFORM_UIMM_SPLAT(vextractuw, 6, 10, 12);