From patchwork Thu Jun 2 21:47:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 578132 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp950840max; Thu, 2 Jun 2022 15:09:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzqi+790y23jv8Un7y3E30mXXA8xTy6tNpKICv6TyEGDRdm8fprbKBZKQHwX/WY/n7dkxl X-Received: by 2002:a05:622a:41:b0:2f3:c678:34df with SMTP id y1-20020a05622a004100b002f3c67834dfmr5304368qtw.67.1654207752598; Thu, 02 Jun 2022 15:09:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654207752; cv=none; d=google.com; s=arc-20160816; b=mjp9y9KCte8msVftSlarmxzdD8CHC3w8OVigXMnTxY9R9jF/fnRBN4i8BGsVRGpDy6 yhCbVRch6fCSkb2olDlWGcnLG8N+LqmCEt5nb2HkeVAQ/iJ08Yf1p5v+DkS9sPbLvV5i QbAOg4XRNoWVvcuFmYSDTTlm/VWmzJtqyMiQoydCJepISgITuH41yOc/+FUGWJWAFMv9 sO2IXuoY15h4RqBLh5O6pRxZnVPkdDqSUHSLAeWwclsdVsQayMvsdACPWbn8xUwJcjXS s8KSZjsVIWPZmWQfWUxlz/1NATLxKwP8BQGnA3F+CMDKkc6pbAuBzqHxW89+nGby4UOf r/DQ== 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:cc:to :from:dkim-signature; bh=wdmw1yZnvA+hHeQ/W/SOHIyofz1vGsnPTS9QtN7as88=; b=KJYuc0XN+1j2QvhKahUaY3fC2SRv32fRdA/zJNaTFctJFFqZ4iOYYLpRo22Pip4Syj JFr7XIA0UwOl/8h2J7yoMXm1V35D4y1uL3nLbZA69TXdz6n9sgUCkEXre48mfWSIk2+8 U/SMSwAWTtLK1oBxFjip/AOvwbqtDKbl8cMEZz/EBTMfsLQ1psZ/gTA/lnjpNECsRxgg sAaVHANGlEvtLeY2hZ+uSZO0pBM/ZC1ukP2VRoUTLWWOhDvbetpaFAwu25wtx+sOjf7i nGzBc1pnsqzKitPYij1e0HR1dqKnCpys89RdmZHHcArtevtnemx59h9zLa4U2nSKLcpy 9YOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="yrBi8/HO"; 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 a9-20020a05622a02c900b002f9a24295cdsi2469523qtx.758.2022.06.02.15.09.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jun 2022 15:09:12 -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="yrBi8/HO"; 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]:54858 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwt0C-0006Kh-5g for patch@linaro.org; Thu, 02 Jun 2022 18:09:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36744) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwsgn-0004ec-6g for qemu-devel@nongnu.org; Thu, 02 Jun 2022 17:49:09 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]:36649) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nwsgj-00005A-MQ for qemu-devel@nongnu.org; Thu, 02 Jun 2022 17:49:08 -0400 Received: by mail-pf1-x42f.google.com with SMTP id 15so5806471pfy.3 for ; Thu, 02 Jun 2022 14:49:05 -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=wdmw1yZnvA+hHeQ/W/SOHIyofz1vGsnPTS9QtN7as88=; b=yrBi8/HOIzwuYuwb3tsIBKPlLlv4ge6+TAx7ctt8P+ZhZyKbL87/APHr8HDXPfRftX O9ogNZKIXwn52SyHNdaoui/53O1zN3zB0V2ZRK+hxU7NtZzrNgvuSgtXiclMviy4JR8n k+VSn+EHwsrrbtePViwGaia+noLkrQKj9pXHfqlSvwaNObjhN9F5zPL9SzZCBgav9Xdi PhUCc7wDlsQ7BXEP8NSF9Rl+tvRYM0CxjrP/4vx278HnFf3Z4GRuj+lloneqSHBoZWDW Kh8uH+5HHn5WCDNfxTf6SZJenJTr1JI/pMboTWvnDR7IKo63CpdtOkTdlO9bOilm9Ct/ rRrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wdmw1yZnvA+hHeQ/W/SOHIyofz1vGsnPTS9QtN7as88=; b=z0U8qdfi0Gilnu04cRVxE4c/AA2XIUsIcOjnMRs46ju7adNzG4Ec79WMI2N8UmNhiw fZaLAj8DAP1mmqYwgIbH7ofyn6EquTEtG61sLzlrNG4pdB2up6c3xnS8jxBHBrHouUwm i7eB1anFP5Uo2f46aANqWA0dckkMxCvewUpljigK/+A16f76xl3iCNB7/xJc51bXkrHe ntV1NKNXDsB2quuNurzaURA813DJFZ7o+ggZT22edCE1w3dPmz7GIupZ1SXFE28d235Z h8JIpn8K3fVcuXAaavDupXdPnitAbKqYlsDqTapCanYXjqeTKxoIZV3Qj5aarwPowsK8 cTug== X-Gm-Message-State: AOAM5328XiTpproXhZNto/B2w6E95jHcAcmpEDT/UfhWQS364zuI9cfH zg70Aie4wiogljZFj+nSP4D6C2gs8o27Gw== X-Received: by 2002:a63:91ca:0:b0:3fc:9077:c7c7 with SMTP id l193-20020a6391ca000000b003fc9077c7c7mr6000905pge.201.1654206543279; Thu, 02 Jun 2022 14:49:03 -0700 (PDT) Received: from stoup.. (174-21-71-225.tukw.qwest.net. [174.21.71.225]) by smtp.gmail.com with ESMTPSA id bf7-20020a170902b90700b00163c6ac211fsm3988760plb.111.2022.06.02.14.49.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jun 2022 14:49:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 10/71] target/arm: Merge aarch64_sve_zcr_get_valid_len into caller Date: Thu, 2 Jun 2022 14:47:52 -0700 Message-Id: <20220602214853.496211-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220602214853.496211-1-richard.henderson@linaro.org> References: <20220602214853.496211-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.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=unavailable 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" This function is used only once, and will need modification for Streaming SVE mode. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/internals.h | 11 ----------- target/arm/helper.c | 30 +++++++++++------------------- 2 files changed, 11 insertions(+), 30 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index a73f2a94c5..4dcdca918b 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -189,17 +189,6 @@ void arm_translate_init(void); void arm_cpu_synchronize_from_tb(CPUState *cs, const TranslationBlock *tb); #endif /* CONFIG_TCG */ -/** - * aarch64_sve_zcr_get_valid_len: - * @cpu: cpu context - * @start_len: maximum len to consider - * - * Return the maximum supported sve vector length <= @start_len. - * Note that both @start_len and the return value are in units - * of ZCR_ELx.LEN, so the vector bit length is (x + 1) * 128. - */ -uint32_t aarch64_sve_zcr_get_valid_len(ARMCPU *cpu, uint32_t start_len); - enum arm_fprounding { FPROUNDING_TIEEVEN, FPROUNDING_POSINF, diff --git a/target/arm/helper.c b/target/arm/helper.c index dc8f1e44cc..e84d30e5fc 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6222,39 +6222,31 @@ int sve_exception_el(CPUARMState *env, int el) return 0; } -uint32_t aarch64_sve_zcr_get_valid_len(ARMCPU *cpu, uint32_t start_len) -{ - uint32_t end_len; - - start_len = MIN(start_len, ARM_MAX_VQ - 1); - end_len = start_len; - - if (!test_bit(start_len, cpu->sve_vq_map)) { - end_len = find_last_bit(cpu->sve_vq_map, start_len); - assert(end_len < start_len); - } - return end_len; -} - /* * Given that SVE is enabled, return the vector length for EL. */ uint32_t sve_zcr_len_for_el(CPUARMState *env, int el) { ARMCPU *cpu = env_archcpu(env); - uint32_t zcr_len = cpu->sve_max_vq - 1; + uint32_t len = cpu->sve_max_vq - 1; + uint32_t end_len; if (el <= 1 && !el_is_in_host(env, el)) { - zcr_len = MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[1]); + len = MIN(len, 0xf & (uint32_t)env->vfp.zcr_el[1]); } if (el <= 2 && arm_feature(env, ARM_FEATURE_EL2)) { - zcr_len = MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[2]); + len = MIN(len, 0xf & (uint32_t)env->vfp.zcr_el[2]); } if (arm_feature(env, ARM_FEATURE_EL3)) { - zcr_len = MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[3]); + len = MIN(len, 0xf & (uint32_t)env->vfp.zcr_el[3]); } - return aarch64_sve_zcr_get_valid_len(cpu, zcr_len); + end_len = len; + if (!test_bit(len, cpu->sve_vq_map)) { + end_len = find_last_bit(cpu->sve_vq_map, len); + assert(end_len < len); + } + return end_len; } static void zcr_write(CPUARMState *env, const ARMCPRegInfo *ri,