From patchwork Fri Apr 30 20:25:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 429850 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp778959jao; Fri, 30 Apr 2021 13:41:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVDXEfPZkxZtQOw1capWFCKF8u31c12G4wU0pSZuuezOIwLYwOJ+AZd9p+mRlUwGwB/6vA X-Received: by 2002:a9d:6c54:: with SMTP id g20mr5194394otq.116.1619815304519; Fri, 30 Apr 2021 13:41:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619815304; cv=none; d=google.com; s=arc-20160816; b=lX+GMyKt/J/zqcrdlTI7wQJx9k9coPL2j0WhCOgvNrH//FyGdH+oPJrL3/GnauXj7a utEQu8BDX6V7zCUBHvGBmmEe/7za61RZ4YrNWIom6CXA7cUMLxB7j8ZbZ1161p4uRmWe dHj5dRCWfoytDvvpylhPo2j9WqZU9b8kx3gTkX6lBauXgjUGF283OlNC8uj8phEr1k/M q7nN0xshiv5fLQvLL5DvBWSG4vNC/8J2TXbatEyrC+qHsPVxExktp4WKGdGX6HYJ0XVv YCh4CQgO/fPl+th/afb3UXtEfJ3YRDnpMKZbpfoAY7loV7LeJTdMidiJMcTfczzgfqK6 tZ1Q== 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=m7pBVh/c5AJy1bfjiUtGsaKpsFfSNoR5ZeoaFlHjYWiOUBkOHit1206yJIixJH5Wu5 hW1OPKi13r9ppdOlCZMoZ5z7l6q6SgQoJiXeMXw+eK1spOcWPkTB8kIpSwnYnN5ncykF yrE6m5oZQkR0Ho9U9Tyd1VVQkq9RhBvTZOdY8EqlPbGFL9ZbyqBT93u2wSaY0L+LSohn QjGQ1qPMXUrTRZHAkfqQVkXu+9Nf8hKO6Tk8CiewSwEdYA5Px2wnKBVITCWkVby6C+u1 K06yrP9MllNKrlLwXC15k2+k4Scfa1nBDHZXx/17ocGIj6zSrwUXYJq1C5CLWaVVQBC8 ow/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=trRNhIVg; 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 n18si4145630otf.19.2021.04.30.13.41.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Apr 2021 13:41:44 -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=trRNhIVg; 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]:34648 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcZxH-0007XQ-SO for patch@linaro.org; Fri, 30 Apr 2021 16:41:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51824) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcZia-0008Rl-N6 for qemu-devel@nongnu.org; Fri, 30 Apr 2021 16:26:32 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]:53056) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lcZiP-000614-4a for qemu-devel@nongnu.org; Fri, 30 Apr 2021 16:26:32 -0400 Received: by mail-pj1-x1034.google.com with SMTP id ge1so244033pjb.2 for ; Fri, 30 Apr 2021 13:26:20 -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=trRNhIVgi69kJghI+oxB01zCsaQSUlulS9UUZnDOOpjN4x4dJ3brJIVXezJicq3X1f A1mQGoXPzGBIviVgnxAEAOTQnbjTWtaBkGDbpP7a8Ev9U4/BiMWRzNmiaShe89q3WDRd vHwRVNbD30dEoRxunYSsi0H4floc/efje7xR2xWDYUMeqTzEUKnH3+Y/hJxAI5LfH9Pc +9ZyMIwWm/wN1I0w4Gai5RHc0zvrepaGfwDqoiecoWsFaai0ZW7A+K8GSiotTQuarVuH Wf/hWY3JgDNhkPhjOPDCcnSCuPRo1fpDkqELL8DMNztmiBAuLTJnCdDEqvSrzjEVf9X3 6qmA== 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=tJmjonifFxydD1qnROj8bC88NyQ5UQ/dcghmKP68SKwryhnmQJ2Nr1Q89GkDeTGo6f FD3RI5JVFCJmx69GUUxUuvfUkQhOqE6Ghk8W8qNay9uU5Yol8OGvZLAfW2wiLKmpqJiF 4MdXgzTyqDiHUREFvEKe/UymManwwDRWX04sX1BU/4dIh7hk09UJ3fiwuOFc+8Dg9U7A SHrOJimEo5h8pKmT0yjw98oWin26wkv1R8HGe2O9W6h1bxtVEvkVvsFJNKO+pnQc0Hkk cmIWpAjD+/8/NjJ+RAlCVw4og+FcLQZQBJL0vBdurOK5UlA8GbSu25ZQ/T1KWETfD9Gl Sxcg== X-Gm-Message-State: AOAM530azrNVixR05ZWy0z2KC5izlUJC2U6x1WtQTd5NC3Tem02LHXIy 63O18qdl+9eHTu5EGIt1BpUXwd9PpwnfRg== X-Received: by 2002:a17:90a:488a:: with SMTP id b10mr7086548pjh.2.1619814379613; Fri, 30 Apr 2021 13:26:19 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id e6sm2905257pfd.219.2021.04.30.13.26.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Apr 2021 13:26:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v6 14/82] target/arm: Implement PMULLB and PMULLT Date: Fri, 30 Apr 2021 13:25:02 -0700 Message-Id: <20210430202610.1136687-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210430202610.1136687-1-richard.henderson@linaro.org> References: <20210430202610.1136687-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.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=unavailable 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 Reviewed-by: Peter Maydell 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) \