From patchwork Sat Feb 17 18:22:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 128687 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1824466ljc; Sat, 17 Feb 2018 10:37:49 -0800 (PST) X-Google-Smtp-Source: AH8x227+UFpqwTpvIXTL6OON16l8ZYQoPTFaY7HwthdtUtC9drNu4cRXRWpFRglF1S3wospcYp8H X-Received: by 10.129.207.11 with SMTP id u11mr7350195ywi.126.1518892669727; Sat, 17 Feb 2018 10:37:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518892669; cv=none; d=google.com; s=arc-20160816; b=p9TYZAkAvpXBp2Zqndl5IXuL/0YJ6h6ELNWeDcDL9OUSWhCwYJdFzg5o2BOmMN8a3z zSwCTLiKPXsjY1KD1WA3nAWa38VguzTiijP/pXURUFWhGI46F/JmnKeCE3wYZfmcfFbO ZKkkAvt1+ka22Rxq82V1U4/3N7Pv2DzNlp+GFUS+30w+6+L32TIEAQNJlVKjY+o7CLQP ru5XvG6YxJ30DJqwy0+wwHlkgK/L0qv933g0u+NOTsIFf7W/B+Z3ZdMAgwI7dmL7psJW g5m0ZLMaw2SZzu8DkLGMbuBqWBHjoJyTVObWIQMvnTvR2TCC+OEmeAzAkgruWkPaIMe/ QPyg== 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=z2zyjf9WQFOCWG11hDLk8qhZRQx78/ZLD2//zJu/aqw=; b=zo47JdeAJXrHa88mkDdnBN4SpWxR/YWBMYo5jhdKz0FpK2aS0mqOV+1abhw/suh6oT KGNUxXYYUPpIigD9xgzuFjGC5iIyC83J7P4i11hi8bnO4nL9bhI4DLid4uMbs0DwgfvU Q7AYWfmxSfUNEqDlkz3EqjddZxvH2xku5+2gKYeYcWn6TpbIGi9oS7ExUATmO+tMNsFe KydVmV0QY20elCHgZka7PskU+KilNPMOytNxQCp4d+oavMEHtxigeleFWGvZ0Bxekh3y Nf92PKJ4Sr+nxLM3o8dgI5YqxcA4R0UldV1PPtY8usuxlZOQPOnJHIHFXS3nCENA0LEX jufQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=MDZ/nNY3; 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 l186si3427075ywe.796.2018.02.17.10.37.49 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 17 Feb 2018 10:37:49 -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=MDZ/nNY3; 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]:48168 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1en7Mr-0003S4-21 for patch@linaro.org; Sat, 17 Feb 2018 13:37:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39765) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1en79K-0000OG-HI for qemu-devel@nongnu.org; Sat, 17 Feb 2018 13:23:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1en79J-0001bs-18 for qemu-devel@nongnu.org; Sat, 17 Feb 2018 13:23:50 -0500 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:45873) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1en79I-0001bL-PS for qemu-devel@nongnu.org; Sat, 17 Feb 2018 13:23:48 -0500 Received: by mail-pf0-x242.google.com with SMTP id w83so592216pfi.12 for ; Sat, 17 Feb 2018 10:23:48 -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=z2zyjf9WQFOCWG11hDLk8qhZRQx78/ZLD2//zJu/aqw=; b=MDZ/nNY3d7UY3Rqv3OzI6wHTPQrdSS2AHfFpYOCxaZ7aC5dBBT59v74eFDUv9UlyL2 agfuO9mokB0vjNCgitmWN1+w9z8Xo4sMLdzGrxg7fjyTp8KKOdvAL6YgsWVeavJgcTHX H2pTEOk7lJ3hnWehZPCUTtpu/oGkfAl+XlRQA= 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=z2zyjf9WQFOCWG11hDLk8qhZRQx78/ZLD2//zJu/aqw=; b=kB9aNAn53lUGD6RIfmSrCIc68JJyrwB4lYOzDUlF7kcNIfpftcfQpvGc3OopWj46aO 9pprlBT9MEkIC0baOz8sByXQAH+XTjlZ+ceFxQlM4d5jsYjiwJa/ucWNn/9zTbeAtcnS Q0sK455LyvQpEB6My190WtzHbzmjbnniCrrcNabgH1QnWNTa0sxgMRDgYG9Bh/DL27Ru YdxZHDmjXuEJZzgoXfEJC+cgyUMdfyoWVjkFtgJ0cSakIePZ8KR9vXvNXJvvSsz2KLOj J7ZE5pF2fyBDTiJQg8t68YTneIM6bJ+AiUm4hIe34cGMETbO2/p966fIHHYvYjhZlFOg vptA== X-Gm-Message-State: APf1xPAB5sB/AoD6u1P2vS5UUxmQSxpmr8NYd0WgqAGcGKcIxofJhNxf BQmP7X+0jqoW8hW2OTSrKJ+fkcdGS20= X-Received: by 10.167.130.193 with SMTP id f1mr9609038pfn.241.1518891827522; Sat, 17 Feb 2018 10:23:47 -0800 (PST) Received: from cloudburst.twiddle.net ([50.0.192.64]) by smtp.gmail.com with ESMTPSA id h15sm13466712pfi.56.2018.02.17.10.23.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Feb 2018 10:23:46 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 17 Feb 2018 10:22:29 -0800 Message-Id: <20180217182323.25885-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180217182323.25885-1-richard.henderson@linaro.org> References: <20180217182323.25885-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:c00::242 Subject: [Qemu-devel] [PATCH v2 13/67] 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: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/arm/helper-sve.h | 21 +++++++++++++++++++++ target/arm/sve_helper.c | 35 +++++++++++++++++++++++++++++++++++ target/arm/translate-sve.c | 25 +++++++++++++++++++++++++ target/arm/sve.decode | 6 ++++++ 4 files changed, 87 insertions(+) -- 2.14.3 Reviewed-by: Peter Maydell 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 6ea806d12b..3054b3cc99 100644 --- a/target/arm/sve_helper.c +++ b/target/arm/sve_helper.c @@ -464,6 +464,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 08c56e55a0..35bcd9229d 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -473,6 +473,31 @@ static void trans_ASRD(DisasContext *s, arg_rpri_esz *a, uint32_t insn) } } +/* + *** SVE Bitwise Shift - Predicated Group + */ + +#define DO_ZPZW(NAME, name) \ +static void 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) { \ + do_zpzz_ool(s, a, fns[a->esz]); \ + } else { \ + unallocated_encoding(s); \ + } \ +} + +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 7ddff8e6bb..177f338fed 100644 --- a/target/arm/sve.decode +++ b/target/arm/sve.decode @@ -159,6 +159,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)