From patchwork Mon Jul 11 13:57:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589361 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3286604mab; Mon, 11 Jul 2022 07:14:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tV3pPrVus9eRddTn70ac1Qov4g+/qGpM7jnS3thGHi356fDqmDzlTQRpQl88JTsfSXOLFJ X-Received: by 2002:ac8:5ac9:0:b0:31a:63e6:eee3 with SMTP id d9-20020ac85ac9000000b0031a63e6eee3mr13539511qtd.120.1657548892895; Mon, 11 Jul 2022 07:14:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657548892; cv=none; d=google.com; s=arc-20160816; b=ifwIMDTrU/6w113otKmrsjQ4quAqiBEAB5Bgzkzt+B23nFtBOlmtQkwEY+k5I7PO/t q48xv3y1CCMGEDtfUfBHRmHlqxK6I5hFru1JGU2PuLtBHiH9kMPaZkMRbrIyQM+wQVpF 00e8Wjv3afrtmToLt6CABrPfTx/bW72Ntqju7fT2u8SiOosSvq+duIv4ylRRsRXSIH6K y4/Q4q3uY+T6vs6Orck5nDbEEMczLGSQ3DOSeZls6F0eQcQF8ViUZvqbwfl5/jkNNQMQ iIGkWXLPllggyXz84UM4myhjOjJfzRuwrQCDs5QmcGaGi9+rFvOeOp5+RUL2J5ATtPtv TTwg== 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=0SnW41amKkOvYQy7JWpeer4ukEO9PLX9nZ7OoMrxHX8=; b=QhOylrTe5qLeEsIHLAwPVddsvFzBfCyo6oScYEUrJ+L4fH5UZc51iI6y8guJLJNAtm ljgs7Sw+hF84ePUABUUmoSlGHLHur5yQ8kzuQ4LWL/jK2h1AYiacS6SkYJ1emujRvjZ6 C786WlyJ9JN5LiYAsNw7aZAoIBuAvVEvn9fKx+2BlKCfAeFynsKe/imgMpeozzsv6Z2I 1rVH0D6KBttOsoBJ9s5L6pRUpgHw5+diemAWw4nnFhE8ckhitD39DrHXDyTAlF0R4Lkg BFa2i/JUTAxpMd5az8EYYCOFz+iDF57l9KxDsQApBP2CZfkjVUwlLgIPGr3AtPRBq0s5 1QiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YdSN+EVt; 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 f15-20020a05622a1a0f00b0031bf5ebaaf3si5308766qtb.47.2022.07.11.07.14.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:14:52 -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=YdSN+EVt; 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]:42714 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAuBY-0002qa-CN for patch@linaro.org; Mon, 11 Jul 2022 10:14:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42862) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oAtvd-0006c6-HS for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:26 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:43747) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oAtvT-0002q3-Qq for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:25 -0400 Received: by mail-wr1-x42e.google.com with SMTP id d16so7106529wrv.10 for ; Mon, 11 Jul 2022 06:58:06 -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=0SnW41amKkOvYQy7JWpeer4ukEO9PLX9nZ7OoMrxHX8=; b=YdSN+EVtwVxk5j2FeViqmNxXOPCPNpNpS+AsgMR0sGVuq1IWuN4+P2Kot83rAOg5oV ga68QBZtn9xwzhovi873WrEUrzAJHOWLedjPVeAlJhwyzwR1qid3KnM2vL/vzybauVIt 037lWWqQ095jkR55wuE3Ah01/8KE3hkWVMgjAQGc9DWx8Dkw8io05quxmNgISspDHUSX 0ALIJkSFW9mtee0lV2mZPCyI2oll7iFkQT1HNz7jBEldrzozHMKV3RqBZAJ0/n8+cOMp bk0BqFArgR9Jwc0eLPYaI09sxmCd4IiqwN2ktsvaq3XLIRl7A+Dimj3AlRk9rsevHUHj 3eCQ== 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=0SnW41amKkOvYQy7JWpeer4ukEO9PLX9nZ7OoMrxHX8=; b=WUwbHj8cr1cZJFLmWPXdp+ajmKzAoF7/i5VA/5XsuKDQwvIyx66aGSmUyDcqT4dUnS nsuWA/t60nNpzezG+2M4AJUIpcSl1DhnRcmVWttc8zYhyHTceavcQmPwe3QQpsJsJk6f 2kA6Fkw4PspElxMvMVQw18GT1dSgMFuQw3uZBEn848U6/pzQDcJHae3LVDTFpQv9v9WF VU2mDQcGB+tyOIfPfsEL5r8qes/42XtjhkMeCl0HF59G1bgyXeYzSE4zaLyQ8a7I7JXk 4cQsA4LZi4cMWQLGwKaaLorCSyLzD+VxaDny8QMaPAPI1K3vQKr0amRDTcPBOjVV0UBh 2eSQ== X-Gm-Message-State: AJIora/MMGOfPLTh6WbaWZJ9jHnQgBXpHKW40dmCdlvSiLfGknNPWd/8 f7ExSkafsK3wmEHIjjsKGDcsZxWrZqGaoA== X-Received: by 2002:a5d:5151:0:b0:21d:730b:c64a with SMTP id u17-20020a5d5151000000b0021d730bc64amr17336831wrt.392.1657547885843; Mon, 11 Jul 2022 06:58:05 -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:05 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 17/45] target/arm: Implement SME RDSVL, ADDSVL, ADDSPL Date: Mon, 11 Jul 2022 14:57:22 +0100 Message-Id: <20220711135750.765803-18-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 These SME instructions are nominally within the SVE decode space, so we add them to sve.decode and translate-sve.c. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-18-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/translate-a64.h | 12 ++++++++++++ target/arm/sve.decode | 5 ++++- target/arm/translate-sve.c | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 1 deletion(-) diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h index 02fb95e0199..099d3d11d60 100644 --- a/target/arm/translate-a64.h +++ b/target/arm/translate-a64.h @@ -128,6 +128,12 @@ static inline int vec_full_reg_size(DisasContext *s) return s->vl; } +/* Return the byte size of the vector register, SVL / 8. */ +static inline int streaming_vec_reg_size(DisasContext *s) +{ + return s->svl; +} + /* * Return the offset info CPUARMState of the predicate vector register Pn. * Note for this purpose, FFR is P16. @@ -143,6 +149,12 @@ static inline int pred_full_reg_size(DisasContext *s) return s->vl >> 3; } +/* Return the byte size of the predicate register, SVL / 64. */ +static inline int streaming_pred_reg_size(DisasContext *s) +{ + return s->svl >> 3; +} + /* * Round up the size of a register to a size allowed by * the tcg vector infrastructure. Any operation which uses this diff --git a/target/arm/sve.decode b/target/arm/sve.decode index 908643d7d90..95af08c139f 100644 --- a/target/arm/sve.decode +++ b/target/arm/sve.decode @@ -449,14 +449,17 @@ INDEX_ri 00000100 esz:2 1 imm:s5 010001 rn:5 rd:5 # SVE index generation (register start, register increment) INDEX_rr 00000100 .. 1 ..... 010011 ..... ..... @rd_rn_rm -### SVE Stack Allocation Group +### SVE / Streaming SVE Stack Allocation Group # SVE stack frame adjustment ADDVL 00000100 001 ..... 01010 ...... ..... @rd_rn_i6 +ADDSVL 00000100 001 ..... 01011 ...... ..... @rd_rn_i6 ADDPL 00000100 011 ..... 01010 ...... ..... @rd_rn_i6 +ADDSPL 00000100 011 ..... 01011 ...... ..... @rd_rn_i6 # SVE stack frame size RDVL 00000100 101 11111 01010 imm:s6 rd:5 +RDSVL 00000100 101 11111 01011 imm:s6 rd:5 ### SVE Bitwise Shift - Unpredicated Group diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 96e934c1ea9..95016e49e9d 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -1286,6 +1286,19 @@ static bool trans_ADDVL(DisasContext *s, arg_ADDVL *a) return true; } +static bool trans_ADDSVL(DisasContext *s, arg_ADDSVL *a) +{ + if (!dc_isar_feature(aa64_sme, s)) { + return false; + } + if (sme_enabled_check(s)) { + TCGv_i64 rd = cpu_reg_sp(s, a->rd); + TCGv_i64 rn = cpu_reg_sp(s, a->rn); + tcg_gen_addi_i64(rd, rn, a->imm * streaming_vec_reg_size(s)); + } + return true; +} + static bool trans_ADDPL(DisasContext *s, arg_ADDPL *a) { if (!dc_isar_feature(aa64_sve, s)) { @@ -1299,6 +1312,19 @@ static bool trans_ADDPL(DisasContext *s, arg_ADDPL *a) return true; } +static bool trans_ADDSPL(DisasContext *s, arg_ADDSPL *a) +{ + if (!dc_isar_feature(aa64_sme, s)) { + return false; + } + if (sme_enabled_check(s)) { + TCGv_i64 rd = cpu_reg_sp(s, a->rd); + TCGv_i64 rn = cpu_reg_sp(s, a->rn); + tcg_gen_addi_i64(rd, rn, a->imm * streaming_pred_reg_size(s)); + } + return true; +} + static bool trans_RDVL(DisasContext *s, arg_RDVL *a) { if (!dc_isar_feature(aa64_sve, s)) { @@ -1311,6 +1337,18 @@ static bool trans_RDVL(DisasContext *s, arg_RDVL *a) return true; } +static bool trans_RDSVL(DisasContext *s, arg_RDSVL *a) +{ + if (!dc_isar_feature(aa64_sme, s)) { + return false; + } + if (sme_enabled_check(s)) { + TCGv_i64 reg = cpu_reg(s, a->rd); + tcg_gen_movi_i64(reg, a->imm * streaming_vec_reg_size(s)); + } + return true; +} + /* *** SVE Compute Vector Address Group */