From patchwork Fri Apr 16 21:01:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 422608 Delivered-To: patch@linaro.org Received: by 2002:a02:6a6f:0:0:0:0:0 with SMTP id m47csp726915jaf; Fri, 16 Apr 2021 14:18:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxTFax1KtSu5vWhHxS6uA562dsJc+hx+O3sskfbM6L1+ROcYVLicn/FInYnQTHblxc2DZN X-Received: by 2002:a05:6830:318a:: with SMTP id p10mr5319420ots.116.1618607930992; Fri, 16 Apr 2021 14:18:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618607930; cv=none; d=google.com; s=arc-20160816; b=dwbuVjg4kVBGDckvpJ+V8yySlnFnT3QJzMdS7qtDmM2Go64Eo4NzZc4RC1W4tGLbkf PPIrf9ogDABX7orMkhYYG559i9MvEXWyocTUZhA2pCGNQPH/emsEYJ9FZ5F9G1cZxrFl v3SEb1nG4hmJDuU5zNQ7FtibKMPZrYP44ZugHQ69GmPraYvEM0aYToTWtTulttSkA3jt +t5yjoKrCcR3x9vDanbf4JqfYPBSZ1e7NljF2dIctZY6cGGS9Dup8MYeBJy0irWDkyuX vQ2fVdqiOU5cqzoTmA2jQ6lljwDwRJy2CnhYEQ4u50+/brB7Ot3F7djI6X51zDJgT5Mi Wt2Q== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=TFy/ivv1KJ7f/BHQOtAUnbXQPt7AVG5AmrGqJKBkDA4=; b=PdXGSQJj5/ZU+HY08yrL9LVTLtxNqm2uJ/ZNtOB3NkeXk5rPkgPtcrsenNmycjuBL9 RPwJYn6sCan9reiP1OPR4jZISsjX+19uKS1Zeyzp49RqVRo7ib9X+pb2xRlOsEWtTjTj oJ6G1IrDs3xsjv5nKi/CJ+8KBY1FUWGtdhTtu/yirS+YE5NIogDBTW0dSFN06NLT+Ox2 1k/gVjewieUrBC7db4ZIgc7cS/yt0TINQF94OskVFugH7XeOAwaMdP9pl33Eu6irfeU8 RY5nVHgbTDZTQ+NtjK+A84lDUvxbmx5U2XgndecXmt391VKHvvLe8HmTXY2zJBjrduwi tlsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WKDyHlxc; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s23si6675248otr.50.2021.04.16.14.18.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Apr 2021 14:18:50 -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=pass header.i=@linaro.org header.s=google header.b=WKDyHlxc; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:32838 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lXVrW-0007l3-BA for patch@linaro.org; Fri, 16 Apr 2021 17:18:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43638) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lXVcE-0004Dj-VB for qemu-devel@nongnu.org; Fri, 16 Apr 2021 17:03:03 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:44600) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lXVcA-00016a-1u for qemu-devel@nongnu.org; Fri, 16 Apr 2021 17:03:02 -0400 Received: by mail-pj1-x102a.google.com with SMTP id q14-20020a17090a430eb02901503aaee02bso4204092pjg.3 for ; Fri, 16 Apr 2021 14:02:57 -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 :mime-version:content-transfer-encoding; bh=TFy/ivv1KJ7f/BHQOtAUnbXQPt7AVG5AmrGqJKBkDA4=; b=WKDyHlxceEpqJV88s4LmQXhW6Lxl7VktxaEznJyfZL6FPpoi58PZ5Ox9xTD4NSdCwE Y5gTaUpek+OpVRro48GkxxcX8bDwe+yZMJpRaw30HdkL3Cis7jWcMJiNpmzlhVmldmbn YC1/bdfKry5NJHeq/5N9RX9WDsG49hPIL9QBCMAwkVN0nPTnO2238KESaztfT9UVnZJ3 EVjg+imp/my0Ez+1U7gtLCGJe9ZKgdzAHoSCWb7+j2YO7MMb0eezcO3j3S83EpchQXrn a0NbUc0UlkymOt10bJlqySsjAaFB5jO9tRkU6VdKZ92Dpmednl5ocPiZr+3GbhseDxDP n2Ag== 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:mime-version:content-transfer-encoding; bh=TFy/ivv1KJ7f/BHQOtAUnbXQPt7AVG5AmrGqJKBkDA4=; b=IL0z+K8E6vbHTvmIA2yIhG4AWETukvEcT1jCuTLzj0dLJQKdP7ShUpnILWwGko3gyw s/mPkt73Ft0MKQNfCrDTMIblCNsHnCcH7CWxxTUP7YLLbM8aDIAzqomGgcfot5d2CjFY DToI8aG81lm4OVpU5dwkA4mtJUD90vF3bgoBgMG1LoWwn4vY1cfHAW/skt3SiJLmJqBf XKp/Vgp/nwagcMiraG2ZYnau8LIrx6VjRcblV9LBLeHnYxr3le3j47OOn0PMhB/O+ach RFLuUk3j4xKbIycXJDDwqcUfdL4HbT8TxWtpS0SHh967JpPtvMZzuVIIFsle6yKnDSdJ nk1A== X-Gm-Message-State: AOAM5327GOb5IUzf+w5Zf4dWPIkJgp/xrFrYU4HpYVbpekDOiFQoCeJA /bfqT1ZFO2T0prvxBgqQJLW5kbnqPJUpFA== X-Received: by 2002:a17:90a:c08f:: with SMTP id o15mr11696060pjs.22.1618606976923; Fri, 16 Apr 2021 14:02:56 -0700 (PDT) Received: from localhost.localdomain ([71.212.131.83]) by smtp.gmail.com with ESMTPSA id m15sm5920640pjz.36.2021.04.16.14.02.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 14:02:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 14/81] target/arm: Implement PMULLB and PMULLT Date: Fri, 16 Apr 2021 14:01:33 -0700 Message-Id: <20210416210240.1591291-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210416210240.1591291-1-richard.henderson@linaro.org> References: <20210416210240.1591291-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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/cpu.h | 10 ++++++++++ target/arm/helper-sve.h | 1 + target/arm/sve.decode | 2 ++ target/arm/translate-sve.c | 22 ++++++++++++++++++++++ target/arm/vec_helper.c | 24 ++++++++++++++++++++++++ 5 files changed, 59 insertions(+) -- 2.25.1 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index a6e1fa6333..902579d24b 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -4231,6 +4231,16 @@ static inline bool isar_feature_aa64_sve2(const ARMISARegisters *id) return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, SVEVER) != 0; } +static inline bool isar_feature_aa64_sve2_aes(const ARMISARegisters *id) +{ + return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, AES) != 0; +} + +static inline bool isar_feature_aa64_sve2_pmull128(const ARMISARegisters *id) +{ + return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, AES) >= 2; +} + /* * Feature tests for "does this exist in either 32-bit or 64-bit?" */ diff --git a/target/arm/helper-sve.h b/target/arm/helper-sve.h index ad8121eec6..bf3e533eb4 100644 --- a/target/arm/helper-sve.h +++ b/target/arm/helper-sve.h @@ -2363,3 +2363,4 @@ DEF_HELPER_FLAGS_4(sve2_umull_zzz_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(sve2_umull_zzz_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(sve2_pmull_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sve2_pmull_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) diff --git a/target/arm/sve.decode b/target/arm/sve.decode index d9a72b7661..016c15ebb6 100644 --- a/target/arm/sve.decode +++ b/target/arm/sve.decode @@ -1201,6 +1201,8 @@ USUBWT 01000101 .. 0 ..... 010 111 ..... ..... @rd_rn_rm SQDMULLB_zzz 01000101 .. 0 ..... 011 000 ..... ..... @rd_rn_rm SQDMULLT_zzz 01000101 .. 0 ..... 011 001 ..... ..... @rd_rn_rm +PMULLB 01000101 .. 0 ..... 011 010 ..... ..... @rd_rn_rm +PMULLT 01000101 .. 0 ..... 011 011 ..... ..... @rd_rn_rm SMULLB_zzz 01000101 .. 0 ..... 011 100 ..... ..... @rd_rn_rm SMULLT_zzz 01000101 .. 0 ..... 011 101 ..... ..... @rd_rn_rm UMULLB_zzz 01000101 .. 0 ..... 011 110 ..... ..... @rd_rn_rm diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 19a1f289d8..fbdccc1c68 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -6030,6 +6030,28 @@ DO_SVE2_ZZZ_TB(SMULLT_zzz, smull_zzz, true, true) DO_SVE2_ZZZ_TB(UMULLB_zzz, umull_zzz, false, false) DO_SVE2_ZZZ_TB(UMULLT_zzz, umull_zzz, true, true) +static bool do_trans_pmull(DisasContext *s, arg_rrr_esz *a, bool sel) +{ + static gen_helper_gvec_3 * const fns[4] = { + gen_helper_gvec_pmull_q, gen_helper_sve2_pmull_h, + NULL, gen_helper_sve2_pmull_d, + }; + if (a->esz == 0 && !dc_isar_feature(aa64_sve2_pmull128, s)) { + return false; + } + return do_sve2_zzw_ool(s, a, fns[a->esz], sel); +} + +static bool trans_PMULLB(DisasContext *s, arg_rrr_esz *a) +{ + return do_trans_pmull(s, a, false); +} + +static bool trans_PMULLT(DisasContext *s, arg_rrr_esz *a) +{ + return do_trans_pmull(s, a, true); +} + #define DO_SVE2_ZZZ_WTB(NAME, name, SEL2) \ static bool trans_##NAME(DisasContext *s, arg_rrr_esz *a) \ { \ diff --git a/target/arm/vec_helper.c b/target/arm/vec_helper.c index 40b92100bf..b0ce597060 100644 --- a/target/arm/vec_helper.c +++ b/target/arm/vec_helper.c @@ -1750,6 +1750,30 @@ void HELPER(sve2_pmull_h)(void *vd, void *vn, void *vm, uint32_t desc) d[i] = pmull_h(nn, mm); } } + +static uint64_t pmull_d(uint64_t op1, uint64_t op2) +{ + uint64_t result = 0; + int i; + + for (i = 0; i < 32; ++i) { + uint64_t mask = -((op1 >> i) & 1); + result ^= (op2 << i) & mask; + } + return result; +} + +void HELPER(sve2_pmull_d)(void *vd, void *vn, void *vm, uint32_t desc) +{ + intptr_t sel = H4(simd_data(desc)); + intptr_t i, opr_sz = simd_oprsz(desc); + uint32_t *n = vn, *m = vm; + uint64_t *d = vd; + + for (i = 0; i < opr_sz / 8; ++i) { + d[i] = pmull_d(n[2 * i + sel], m[2 * i + sel]); + } +} #endif #define DO_CMP0(NAME, TYPE, OP) \