From patchwork Mon Jul 11 13:57:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589347 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3270234mab; Mon, 11 Jul 2022 06:59:56 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tR2EttVo/tTWnF7ExU37Enq2lIBGdpB1nSSxAyTSAHI2z/ZDRWOXvWKHVfc1oVBmizphIX X-Received: by 2002:a05:6214:f6c:b0:470:3e03:a24a with SMTP id iy12-20020a0562140f6c00b004703e03a24amr13758558qvb.25.1657547996828; Mon, 11 Jul 2022 06:59:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657547996; cv=none; d=google.com; s=arc-20160816; b=JHgIKKYmJjcbEHMgHv8aape9o6jqnmfmKWoF//pkKVWVjzPZnhwgEN6I9KyJg/q7Cj UMggnRQlHjVGcLpeKzhe5SU5Xrh0Hn/0f4zPn0ZeowyK8/09cn6BL6RjiGfXPa1b9dy4 bJgkpsSTrFP2cYQ9N4SeE+RRXOcoOuR1mf4b4VYJhbYKllFsdFfaInKUtjn3YeQ00ZS+ 8T/xvXA9zeaUvonzta8WLivFpMFzt/Gtv5p4VyEgqwa2TWrwZl5d28xEgSFFFfkBSORk uXyDupI+x/76ilxzGOJCDXQ4uYviColwihKOYixv0P3+jnB0o0hYdSrOZR6dpkJya0Lo a0fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=xU+wxBR/nb5VhvZR6dMFf9W7EuBiUbFbtZKkKknvG9M=; b=X9X+jY2e9IeKphHnU9GdnylP+WbFQEpSVtiY0fdLvd3+WWrGKCT6WoHz2TmpewkO5G 8he00mWpitpfYh604m3DrlcCl8lG3JSGUS2JBFjoaUmLJADYACJiTx/QKCdNQFmXpTk2 9ZPU3/D+NmbX+X7nz+eayrVApJ70LfHlclw/XvqzZI1mmaVOIpMN9lGg50E0RTcymiWG eC4r4k4/H+71xirnBFGVPJa8kz8NZK0SmYN3v9vOdPQGGl48kBQzf8ycRe4l44vEmyPC bqoWvKfawHp58AYn/vdMclpGnOqrtDgMObxATFLKn57WVSfYqMS1sY58s7ZRPRfYcDQm fopw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I3+YpVZm; 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 gh3-20020a05621429c300b004736f73052fsi1747780qvb.468.2022.07.11.06.59.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 06:59:56 -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=I3+YpVZm; 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]:40236 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAtx6-0006c5-DC for patch@linaro.org; Mon, 11 Jul 2022 09:59:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42742) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oAtvV-0006Yc-Mf for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:18 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:46667) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oAtvQ-0002qA-6J for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:16 -0400 Received: by mail-wr1-x42e.google.com with SMTP id v16so7099852wrd.13 for ; Mon, 11 Jul 2022 06:58:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=xU+wxBR/nb5VhvZR6dMFf9W7EuBiUbFbtZKkKknvG9M=; b=I3+YpVZmJGcz8r6Tx+fKQJezfhERsRh8glJlDJ8XdzOX28Gn1ut4s3SYBzO/Rbx73e ql6CSIcVhqb+cAbF4gwB3qqCFQgb4QluoG1jZhRODSpAQSaJKu+8O3gtOfDeW81eIjUO TTOg8ukuRDeUq06RnJWEqmgiuRV2TAZuqQdrD7Yb/mhBbTYScViEXmDyDn+TC9ihqf4P 97aNugH9Ufu5/GVugf8GdYddhvwo/WVNMfeKC0yiEziSs3NacmkRTPkiyRcMs6ptSpwC C0e5ixXhXrZ29YDQzNTbCClrOnQklgZNNXrgfG4vua3YSITftnibwPw+mq4GPisuivfL OjeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xU+wxBR/nb5VhvZR6dMFf9W7EuBiUbFbtZKkKknvG9M=; b=muiXkKO3fGQfBjlKWRvWQGdun3uv1kf9mDMl5WH+318U405pcVX79Cd+ud2b9pitCE vZn4eb5IUQ2gpmSLBnap3hJEgCe0vdAAgMKcPFyyhqYRqw/NehzRYmAtfVLZW/QIjDLc StiDGZ7LfwlH/bNcwBExC8Ul8HUr97DkMs9tCvYlNHGXXdWxWjYDJRDcxiGX0xzFJLP/ AyYDl3rEriQhYwwS6BIocnC4XMTkhM2+brQt1XepXTEkuFj1gqC63DHQjnZ1AFfr9iAT W8k9QSyJP6aFyUUCbJc0CfoF1sXzWKz5jZYgrf3rWtwYW8otGTFBo0gRJonmHOCAWiP+ yqew== X-Gm-Message-State: AJIora/DL5rmOl37a401QcdnlmF73U9lZ6CByWnWYCviSutDwWfddFxb heydUztPb+Fv5qXPsp4+8ZJzX1k+yfq+lg== X-Received: by 2002:adf:fbc6:0:b0:21d:3fc3:99e with SMTP id d6-20020adffbc6000000b0021d3fc3099emr17158821wrs.550.1657547886560; Mon, 11 Jul 2022 06:58:06 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id q123-20020a1c4381000000b00397402ae674sm7595596wma.11.2022.07.11.06.58.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:06 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 18/45] target/arm: Implement SME ZERO Date: Mon, 11 Jul 2022 14:57:23 +0100 Message-Id: <20220711135750.765803-19-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220711135750.765803-1-peter.maydell@linaro.org> References: <20220711135750.765803-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42e.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-19-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/helper-sme.h | 2 ++ target/arm/sme.decode | 4 ++++ target/arm/sme_helper.c | 25 +++++++++++++++++++++++++ target/arm/translate-sme.c | 13 +++++++++++++ 4 files changed, 44 insertions(+) diff --git a/target/arm/helper-sme.h b/target/arm/helper-sme.h index 3bd48c235f0..c4ee1f09e46 100644 --- a/target/arm/helper-sme.h +++ b/target/arm/helper-sme.h @@ -19,3 +19,5 @@ DEF_HELPER_FLAGS_2(set_pstate_sm, TCG_CALL_NO_RWG, void, env, i32) DEF_HELPER_FLAGS_2(set_pstate_za, TCG_CALL_NO_RWG, void, env, i32) + +DEF_HELPER_FLAGS_3(sme_zero, TCG_CALL_NO_RWG, void, env, i32, i32) diff --git a/target/arm/sme.decode b/target/arm/sme.decode index c25c031a71d..6e4483fdcea 100644 --- a/target/arm/sme.decode +++ b/target/arm/sme.decode @@ -18,3 +18,7 @@ # # This file is processed by scripts/decodetree.py # + +### SME Misc + +ZERO 11000000 00 001 00000000000 imm:8 diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c index b2157255943..eef2df73e11 100644 --- a/target/arm/sme_helper.c +++ b/target/arm/sme_helper.c @@ -59,3 +59,28 @@ void helper_set_pstate_za(CPUARMState *env, uint32_t i) memset(env->zarray, 0, sizeof(env->zarray)); } } + +void helper_sme_zero(CPUARMState *env, uint32_t imm, uint32_t svl) +{ + uint32_t i; + + /* + * Special case clearing the entire ZA space. + * This falls into the CONSTRAINED UNPREDICTABLE zeroing of any + * parts of the ZA storage outside of SVL. + */ + if (imm == 0xff) { + memset(env->zarray, 0, sizeof(env->zarray)); + return; + } + + /* + * Recall that ZAnH.D[m] is spread across ZA[n+8*m], + * so each row is discontiguous within ZA[]. + */ + for (i = 0; i < svl; i++) { + if (imm & (1 << (i % 8))) { + memset(&env->zarray[i], 0, svl); + } + } +} diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c index 786c93fb2db..971504559b3 100644 --- a/target/arm/translate-sme.c +++ b/target/arm/translate-sme.c @@ -33,3 +33,16 @@ */ #include "decode-sme.c.inc" + + +static bool trans_ZERO(DisasContext *s, arg_ZERO *a) +{ + if (!dc_isar_feature(aa64_sme, s)) { + return false; + } + if (sme_za_enabled_check(s)) { + gen_helper_sme_zero(cpu_env, tcg_constant_i32(a->imm), + tcg_constant_i32(streaming_vec_reg_size(s))); + } + return true; +}