From patchwork Tue Dec 18 06:38:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 154116 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3370418ljp; Mon, 17 Dec 2018 23:14:02 -0800 (PST) X-Google-Smtp-Source: AFSGD/X6ZoYxFlmKGJiQ6y6BAwk190nJoR9OOw3/UWAE2YDqWFAlpVPVe7vriY/k3RCmneIjZ01Q X-Received: by 2002:ac8:18fa:: with SMTP id o55mr16789729qtk.256.1545117242893; Mon, 17 Dec 2018 23:14:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545117242; cv=none; d=google.com; s=arc-20160816; b=b6OLN0xHLkv2dKr6jEozBewGmfYMTAV3eCQV5nx6W6ALjJHMADo9iG/XICYpfSEa/J AQLk/mwy2km2jwN/uA3zHJfCqPJrZ8J8tIY8vNC0zR3rWzZq8DiYxfjWmoHXs6/4JTVP 7Qa96ji2gTceBLXIzC/o+z5J3VXttagO6AnWAv+2sEk94r3NliJ7yE/Dp2duPb+RGhLY 2fV5r3hYdUEudpWZ5+gwS7V3SA5UoPug6F+xPGdLPpD94Xrut61ayzougcIIA0RQ7lO+ GtbP4eU+mwCa7i29SnqVmkYZk2ThRdghtoWJ+vCi24BXyb/OJDtghjjJ1lbub+JbVmB/ b98A== 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=SXcmeu5bjYHVse3xR5bVWi80NcPVDPvpXGM2YXZ3FDs=; b=UY5o9Do952nY0W7iG6nNjjqIUjw09m5nf9ffiE6Lm4AhhwrDKp7Z/QcoGpScpAOCWX TY9Fgh2oAzrwzq5Fs9VcNG2aALqFkJmhUs7G488meaIBeuXMSx8NrTW8JsQWoBDPuSge 74bNrHupeGKo8rc4x2bgkoU/T6CQMJgD2Jjyug8I1ir+RnuLeBrwwyCDW4iLbSwtyoNv nT2stDCmXWAOF7W2y6NHTf0LQr0EEBGb57PGU0AQxoLeDn90t0bV1oWAMBRsTMxHhlA7 NdtvOSpv7lRz8tTimP6KrFqi7nKLy2wgssqcuOPJ4SWUc3D03L9H5qyIJSxOYXo01xGC iXWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YKWUVpu9; 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 s127si1775551qkc.45.2018.12.17.23.14.02 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 17 Dec 2018 23:14:02 -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=YKWUVpu9; 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]:52232 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ9Zq-0003RP-D0 for patch@linaro.org; Tue, 18 Dec 2018 02:14:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53325) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ936-0001wc-B0 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 01:40:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ92v-0002yS-LJ for qemu-devel@nongnu.org; Tue, 18 Dec 2018 01:40:12 -0500 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:39756) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gZ92v-0002S1-6H for qemu-devel@nongnu.org; Tue, 18 Dec 2018 01:40:01 -0500 Received: by mail-pf1-x443.google.com with SMTP id r136so592943pfc.6 for ; Mon, 17 Dec 2018 22:39:41 -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=SXcmeu5bjYHVse3xR5bVWi80NcPVDPvpXGM2YXZ3FDs=; b=YKWUVpu96ThH9ylAIhYSD7RTZOoEgfXhTgWIjvWE5XG0Sb5AEc64jcEwhMQUrRm1Ij Xrb8UNxDZROAMkJ9cq6/1vI3AhHUElQek9DoCCdyGqeCJ8zI5h+EHsCvgs2d2nRKc3Q+ w6jcim/oMLRnDiG3douaVy3ko7klyhyPb80KY= 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=SXcmeu5bjYHVse3xR5bVWi80NcPVDPvpXGM2YXZ3FDs=; b=Z7I0yzS8GG1r3UAX0E0wKDw5FY/dS096dZZBXwgjkTn3ST4KxMoYxuj+uz6smeKWFb U9ikHQ43PxrEwOPTN+YKhy+r5yJ30zrggoGlqTvq21bg7RhqrSqBaeFGoMxTaDKHhE8k IjEXfEO2bu7hq+oDgSg/rv7/l7/7sLCQiuaeF+cRMd/XhdU3gMr6hCoWMeflG6+IdmRU Li5G9t6Ka4FvkjzcIaR76+esMnueyaarlSR8/KoX/3oykUGf/BWVEOc2+XaCY/cYeNF2 kuuAN8tC0YRrOgvRfOyuLvQEPMs51grOLJU9v8SwztsbA8RCocencWyCMtCJDP0nwsbG 0zsw== X-Gm-Message-State: AA+aEWZNFJsKebyIzhkuaj015u1qdkqbh+L1G/3IjewTqBRibnz6YIxH QdyFg6QSiewwHVzSuvFpwnUrrlwOD7k= X-Received: by 2002:a63:a41:: with SMTP id z1mr1848708pgk.117.1545115180667; Mon, 17 Dec 2018 22:39:40 -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.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 Dec 2018 22:39:40 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 17 Dec 2018 22:38:57 -0800 Message-Id: <20181218063911.2112-21-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::443 Subject: [Qemu-devel] [PATCH 20/34] 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: 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" Signed-off-by: Richard Henderson --- target/ppc/helper.h | 3 -- target/ppc/int_helper.c | 24 --------------- target/ppc/translate/vmx-impl.inc.c | 45 +++++++++++++++++------------ 3 files changed, 26 insertions(+), 46 deletions(-) -- 2.17.2 Acked-by: David Gibson 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 e44c0d90ee..3bf0fdb6c5 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -1918,30 +1918,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)) -#if defined(HOST_WORDS_BIGENDIAN) -#define SPLAT_ELEMENT(element) _SPLAT_MASKED(element) -#else -#define SPLAT_ELEMENT(element) \ - (ARRAY_SIZE(r->element) - 1 - _SPLAT_MASKED(element)) -#endif -#define VSPLT(suffix, element) \ - void helper_vsplt##suffix(ppc_avr_t *r, ppc_avr_t *b, uint32_t splat) \ - { \ - uint32_t s = b->element[SPLAT_ELEMENT(element)]; \ - int i; \ - \ - for (i = 0; i < ARRAY_SIZE(r->element); i++) { \ - r->element[i] = s; \ - } \ - } -VSPLT(b, u8) -VSPLT(h, u16) -VSPLT(w, u32) -#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 be638cdb1a..529ae0e5f5 100644 --- a/target/ppc/translate/vmx-impl.inc.c +++ b/target/ppc/translate/vmx-impl.inc.c @@ -814,24 +814,31 @@ 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; +#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) \ { \ @@ -873,9 +880,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);