From patchwork Wed May 16 22:29:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 136057 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1529981lji; Wed, 16 May 2018 15:38:18 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoMh1N0HWHjFvpAwPlU/kTYIETA6HtQNRaHBPA0mguxcFZ9O3p150DZ7vB9ZZd8XyviLOM+ X-Received: by 2002:a0c:b3c7:: with SMTP id b7-v6mr2960908qvf.86.1526510297818; Wed, 16 May 2018 15:38:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526510297; cv=none; d=google.com; s=arc-20160816; b=HZhihEoMEkRKxHQXqy0oimfyBJNo6kpxPwbzKFaNSmrxw7/P5pLBFJPKZlYgCLnbN4 bdVJhSqaGG8s1QO44mqRCoNt7o7sejJ57Oi2F0kPWLJVkDtxz/Kxc5ielSQ0DllzLY64 v3C4Ilc46OeZDqmj8oDJEVGOvz8mrFIeGfvixUIBFY4V+ibZhyA+gHSkJJ6ScBrhUG0n TvvyPscmndmzMqDJmjEWoKfu3Pid2gD9jVse8BPNlEE+sTFikOtJ9XyUoHS/MmobWlmU xf6clxT2detgXtrNVHQ8hP6QLjCAjIZGH+IdnQJvb7dgBnl1KWWrv6+kAq8AXh/ASdod s6+Q== 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:arc-authentication-results; bh=jn7iQEcALvVjdLYSB5FiKkJpuIIKitvxbTtwkOopkaE=; b=ctfFyfb9vu9bqE51IF5W+Qlm/0t55zSflxYW13XTBiw9vTlbLXcPxsZbPk+VPKr2Q7 GLlFSj9rKyfcZHetoMJ9rXi4kIfKQYjuv6EPqMhpV+2Ge6yWsQLlzLYF9J+ZWrM1Ease 5ZRMm8diCHNHCvC13a9gglUGOqCoOD2ezaBkqZPsG3GgzQoo+4HD1HwhqzfyAs/VLhUL DCfmmko5KpqMUX7VAvAQEV96s5+a4TDjdJI/P+ZvE4mSE5PJ3ZjbK8kw/B3MzTwamh/+ IfEvokiL0Y1gZApKrwQnuQXb2oUb1SFQzF4xqWQj+ljpJ9/uQ2HWP3uO0Kr95koSmOIl yklA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=X7R1dc1J; 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 i64-v6si3837556qkh.374.2018.05.16.15.38.17 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 16 May 2018 15:38:17 -0700 (PDT) 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=X7R1dc1J; 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]:44811 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJ53p-0004tj-7d for patch@linaro.org; Wed, 16 May 2018 18:38:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41176) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJ4wK-0007io-Gz for qemu-devel@nongnu.org; Wed, 16 May 2018 18:30:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fJ4wH-0007Tx-3x for qemu-devel@nongnu.org; Wed, 16 May 2018 18:30:32 -0400 Received: from mail-pg0-x235.google.com ([2607:f8b0:400e:c05::235]:44038) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fJ4wG-0007TO-CT for qemu-devel@nongnu.org; Wed, 16 May 2018 18:30:29 -0400 Received: by mail-pg0-x235.google.com with SMTP id c22-v6so228478pgn.11 for ; Wed, 16 May 2018 15:30:28 -0700 (PDT) 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=jn7iQEcALvVjdLYSB5FiKkJpuIIKitvxbTtwkOopkaE=; b=X7R1dc1JIY3Vvh6awzmE88YMEnBUWWDWR/5Ptbo2PQKxHvsbKwfbnEW/Zky55VVAjr E8/mDG1iRyvjYggS4sbQaY5WKtL1tXV+AqMrsM27TQzuyNAFazjHUl2VZxjThqkOOrJt TH4uBqYusWTfY7FkZENryiSEW/bOjM0AaSjWY= 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=jn7iQEcALvVjdLYSB5FiKkJpuIIKitvxbTtwkOopkaE=; b=GGVzw6QahiWIZSV53E87RL8b38l69xFFw4Ygeepa16MCc+6sU67Nk3zCCttpxOj8tr gE/kjBKrJ6GO1DLN/Sp1OZSwt4mqfmFexcvqXc55GaRuquK8SpJUSEcKCDiR9rHfN0X+ ZGGdldVo4pBlIRrkr1F/QakWk+ryFpENnJB1iGERR9o+jOqf5j+MxIRdAdapHvVcdqtI s7UNF3B5i5UpfvU5UO8C4f9n7YoggkyPityMI4wB9coSL7U6OrmV+vDQmBFbG6++dQbZ YVJGYOgCVuUBXLETf8847M+qNLHqzG09mYudN1jEEQXn2I3s1L2HCRuUauXDDeYK9heP GrTA== X-Gm-Message-State: ALKqPwepSpEyZBiIpb+HvldllFPkXbAZdQAoD/3KWLBXqigwyUPmgBxg 6uhuxTdifTMDqfuVPtYiqnUgap+oeas= X-Received: by 2002:a62:78c:: with SMTP id 12-v6mr2751850pfh.178.1526509826989; Wed, 16 May 2018 15:30:26 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-2-170.tukw.qwest.net. [97.113.2.170]) by smtp.gmail.com with ESMTPSA id j1-v6sm6640418pfc.159.2018.05.16.15.30.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 15:30:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 16 May 2018 15:29:52 -0700 Message-Id: <20180516223007.10256-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180516223007.10256-1-richard.henderson@linaro.org> References: <20180516223007.10256-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::235 Subject: [Qemu-devel] [PATCH v3-a 12/27] target/arm: Implement SVE bitwise shift by wide elements (predicated) 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: peter.maydell@linaro.org, qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/helper-sve.h | 21 +++++++++++++++++++++ target/arm/sve_helper.c | 35 +++++++++++++++++++++++++++++++++++ target/arm/translate-sve.c | 24 ++++++++++++++++++++++++ target/arm/sve.decode | 6 ++++++ 4 files changed, 86 insertions(+) -- 2.17.0 diff --git a/target/arm/helper-sve.h b/target/arm/helper-sve.h index 0cc02ee59e..d516580134 100644 --- a/target/arm/helper-sve.h +++ b/target/arm/helper-sve.h @@ -195,6 +195,27 @@ DEF_HELPER_FLAGS_5(sve_lsl_zpzz_s, TCG_CALL_NO_RWG, DEF_HELPER_FLAGS_5(sve_lsl_zpzz_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(sve_asr_zpzw_b, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(sve_asr_zpzw_h, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(sve_asr_zpzw_s, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) + +DEF_HELPER_FLAGS_5(sve_lsr_zpzw_b, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(sve_lsr_zpzw_h, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(sve_lsr_zpzw_s, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) + +DEF_HELPER_FLAGS_5(sve_lsl_zpzw_b, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(sve_lsl_zpzw_h, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(sve_lsl_zpzw_s, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) + DEF_HELPER_FLAGS_3(sve_orv_b, TCG_CALL_NO_RWG, i64, ptr, ptr, i32) DEF_HELPER_FLAGS_3(sve_orv_h, TCG_CALL_NO_RWG, i64, ptr, ptr, i32) DEF_HELPER_FLAGS_3(sve_orv_s, TCG_CALL_NO_RWG, i64, ptr, ptr, i32) diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c index ece3a81ad3..a5d12603e5 100644 --- a/target/arm/sve_helper.c +++ b/target/arm/sve_helper.c @@ -465,6 +465,41 @@ DO_ZPZZ_D(sve_lsl_zpzz_d, uint64_t, DO_LSL) #undef DO_ZPZZ #undef DO_ZPZZ_D +/* Three-operand expander, controlled by a predicate, in which the + * third operand is "wide". That is, for D = N op M, the same 64-bit + * value of M is used with all of the narrower values of N. + */ +#define DO_ZPZW(NAME, TYPE, TYPEW, H, OP) \ +void HELPER(NAME)(void *vd, void *vn, void *vm, void *vg, uint32_t desc) \ +{ \ + intptr_t i, opr_sz = simd_oprsz(desc); \ + for (i = 0; i < opr_sz; ) { \ + uint8_t pg = *(uint8_t *)(vg + H1(i >> 3)); \ + TYPEW mm = *(TYPEW *)(vm + i); \ + do { \ + if (pg & 1) { \ + TYPE nn = *(TYPE *)(vn + H(i)); \ + *(TYPE *)(vd + H(i)) = OP(nn, mm); \ + } \ + i += sizeof(TYPE), pg >>= sizeof(TYPE); \ + } while (i & 7); \ + } \ +} + +DO_ZPZW(sve_asr_zpzw_b, int8_t, uint64_t, H1, DO_ASR) +DO_ZPZW(sve_lsr_zpzw_b, uint8_t, uint64_t, H1, DO_LSR) +DO_ZPZW(sve_lsl_zpzw_b, uint8_t, uint64_t, H1, DO_LSL) + +DO_ZPZW(sve_asr_zpzw_h, int16_t, uint64_t, H1_2, DO_ASR) +DO_ZPZW(sve_lsr_zpzw_h, uint16_t, uint64_t, H1_2, DO_LSR) +DO_ZPZW(sve_lsl_zpzw_h, uint16_t, uint64_t, H1_2, DO_LSL) + +DO_ZPZW(sve_asr_zpzw_s, int32_t, uint64_t, H1_4, DO_ASR) +DO_ZPZW(sve_lsr_zpzw_s, uint32_t, uint64_t, H1_4, DO_LSR) +DO_ZPZW(sve_lsl_zpzw_s, uint32_t, uint64_t, H1_4, DO_LSL) + +#undef DO_ZPZW + /* Two-operand reduction expander, controlled by a predicate. * The difference between TYPERED and TYPERET has to do with * sign-extension. E.g. for SMAX, TYPERED must be signed, diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index f0400e35d9..438df6359e 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -497,6 +497,30 @@ static bool trans_ASRD(DisasContext *s, arg_rpri_esz *a, uint32_t insn) } } +/* + *** SVE Bitwise Shift - Predicated Group + */ + +#define DO_ZPZW(NAME, name) \ +static bool trans_##NAME##_zpzw(DisasContext *s, arg_rprr_esz *a, \ + uint32_t insn) \ +{ \ + static gen_helper_gvec_4 * const fns[3] = { \ + gen_helper_sve_##name##_zpzw_b, gen_helper_sve_##name##_zpzw_h, \ + gen_helper_sve_##name##_zpzw_s, \ + }; \ + if (a->esz < 0 || a->esz >= 3) { \ + return false; \ + } \ + return do_zpzz_ool(s, a, fns[a->esz]); \ +} + +DO_ZPZW(ASR, asr) +DO_ZPZW(LSR, lsr) +DO_ZPZW(LSL, lsl) + +#undef DO_ZPZW + /* *** SVE Predicate Logical Operations Group */ diff --git a/target/arm/sve.decode b/target/arm/sve.decode index 8267963b6b..1de289e55d 100644 --- a/target/arm/sve.decode +++ b/target/arm/sve.decode @@ -157,6 +157,12 @@ ASR_zpzz 00000100 .. 010 100 100 ... ..... ..... @rdm_pg_rn # ASRR LSR_zpzz 00000100 .. 010 101 100 ... ..... ..... @rdm_pg_rn # LSRR LSL_zpzz 00000100 .. 010 111 100 ... ..... ..... @rdm_pg_rn # LSLR +# SVE bitwise shift by wide elements (predicated) +# Note these require size != 3. +ASR_zpzw 00000100 .. 011 000 100 ... ..... ..... @rdn_pg_rm +LSR_zpzw 00000100 .. 011 001 100 ... ..... ..... @rdn_pg_rm +LSL_zpzw 00000100 .. 011 011 100 ... ..... ..... @rdn_pg_rm + ### SVE Logical - Unpredicated Group # SVE bitwise logical operations (unpredicated)