From nobody Tue Nov 26 11:41:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1708551238; cv=none; d=zohomail.com; s=zohoarc; b=C8kLn6Oz0xCIa6qS2Z4ZfqmTov1/B0xhF0b1arbFz4M8C6yATjy8Ao5XSoEx3FL/nlUDn8HEpEnSO4yjrtD6+NMu0O0gK+/gDyxg2N5EqSZN2HPJGQNRNs/Teei4Yu5vgiEfJH/b2lPy7Xa47o+uXo3fOC0GbK8jooQ3fL5+ET4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708551238; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=pcNFT1PFZaOBecPCJAxz5rBCgAHoej/Vx9VoGAU8rlY=; b=fotjt0I7NBlfv8idmkIzLPew1HNpFrhvypFUnXviCBD6C1w3aRmyCpYUhnu475fQF0fSF1BVbNq1WC4/BuQ32rLnL0m3HSbgFGM5/xJrQrx+JtaLjwEubyepIL55KxLfZET3BqC8B2VL+Uq2V4EXbpTU80WUg6tP8s8sn9jrWjg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17085512387034.365751259317335; Wed, 21 Feb 2024 13:33:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rcuD3-0006Dw-7O; Wed, 21 Feb 2024 16:32:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rcuCi-0005a1-9X for qemu-devel@nongnu.org; Wed, 21 Feb 2024 16:32:36 -0500 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rcuCR-0004T2-R3 for qemu-devel@nongnu.org; Wed, 21 Feb 2024 16:32:36 -0500 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1d8da50bffaso37160575ad.2 for ; Wed, 21 Feb 2024 13:32:19 -0800 (PST) Received: from grind.dc1.ventanamicro.com ([177.94.15.159]) by smtp.gmail.com with ESMTPSA id a19-20020a170902ee9300b001dbb0348733sm6618051pld.67.2024.02.21.13.32.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 13:32:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1708551137; x=1709155937; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pcNFT1PFZaOBecPCJAxz5rBCgAHoej/Vx9VoGAU8rlY=; b=J3dyc+nDQiFjlv4EG5wVj96PvZtGQYWYoQGaXnlPIqLek0bhaWOHgZpOKMAZwtAN8O 68u/6Nxm4V4tPMeyS9D98PGkPHH+U+AUAFEExA0XN3GdZjk53hCqlzxZRd4ZbUVRPvph wJ6mnVar8EaWctu+Bh4nleJq7hRaWIy5FmZBcGew9tls8tEdZwFvUjj++CxYZguIeJgG EIE11MdH5pBYpQ/zFE60cE5MVsxHmSbY8rjRL9saWi53a5A4Qbmg1mInuPwK1iPHaMYP uGnrKCgXC+e9bL5a2wOpGZCZU52GBe/B6ZW6AwA8MUUYIb1y6sPI62s2W2bHIujZ23AH 6/qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708551137; x=1709155937; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pcNFT1PFZaOBecPCJAxz5rBCgAHoej/Vx9VoGAU8rlY=; b=fdfXopyTmkMcsRPf6GlmeOjP00AyFkTETVHtGdErhnOKpZ+z/AA7FS1MBvPoreBFYB lu6h7jR6+Y02br+L4g7oozBsmrKdK5rMxrD2ocTMZAEPlEXCmWm9Ld+8Iq2vo+0r49mD xsVB7VWsACk/Zt7H6IXPFuPkHp+2dAdS1jl2gWVLiaFaQ16UAd3cgnQM/wfTetMt3uHR 0Bn1xpPHeLtsppcEVhgTsHjYAbl7LCWlXOr+X2jawX/S7PoxG9qPEtoM2dG7D8AQ6hMN VOeG2xJC/M6MKB0mizrSNWte0WNPxSHSUGtNxrC3BsV5DkxthH6389R6GPTSZOky13In L62g== X-Gm-Message-State: AOJu0YzANXoQ+cshVbebxFrWxN7qTnx+qv0DV4Hhxqt7EGsRpWfTz7ra g60hDGMvPg42NMv7ZVWauHFLDX7YByBMb/cbMP+e/8kCVzFfsSvU8ytg5rBOxvL8Hw8sldQjAgU b X-Google-Smtp-Source: AGHT+IE0oMFdIC3eLKXokwWfVNq5dZ9HKw4GFmS2SCD54KbIiXJUD7T1j+2gZZNRg1tn/Q4SbZsFDQ== X-Received: by 2002:a17:902:dac4:b0:1db:f033:9f95 with SMTP id q4-20020a170902dac400b001dbf0339f95mr12181083plx.66.1708551137663; Wed, 21 Feb 2024 13:32:17 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liwei1518@gmail.com, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, richard.henderson@linaro.org, max.chou@sifive.com, Daniel Henrique Barboza Subject: [PATCH v6 9/9] target/riscv/vector_helper.c: optimize loops in ldst helpers Date: Wed, 21 Feb 2024 18:31:40 -0300 Message-ID: <20240221213140.365232-10-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240221213140.365232-1-dbarboza@ventanamicro.com> References: <20240221213140.365232-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=dbarboza@ventanamicro.com; helo=mail-pl1-x62b.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, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1708551240430100011 Content-Type: text/plain; charset="utf-8" Change the for loops in ldst helpers to do a single increment in the counter, and assign it env->vstart, to avoid re-reading from vstart every time. Suggested-by: Richard Henderson Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis Reviewed-by: Richard Henderson --- target/riscv/vector_helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c index cc7290a1bb..1ab386830a 100644 --- a/target/riscv/vector_helper.c +++ b/target/riscv/vector_helper.c @@ -208,7 +208,7 @@ vext_ldst_stride(void *vd, void *v0, target_ulong base, uint32_t esz =3D 1 << log2_esz; uint32_t vma =3D vext_vma(desc); =20 - for (i =3D env->vstart; i < env->vl; i++, env->vstart++) { + for (i =3D env->vstart; i < env->vl; env->vstart =3D ++i) { k =3D 0; while (k < nf) { if (!vm && !vext_elem_mask(v0, i)) { @@ -274,7 +274,7 @@ vext_ldst_us(void *vd, target_ulong base, CPURISCVState= *env, uint32_t desc, uint32_t esz =3D 1 << log2_esz; =20 /* load bytes from guest memory */ - for (i =3D env->vstart; i < evl; i++, env->vstart++) { + for (i =3D env->vstart; i < evl; env->vstart =3D ++i) { k =3D 0; while (k < nf) { target_ulong addr =3D base + ((i * nf + k) << log2_esz); @@ -388,7 +388,7 @@ vext_ldst_index(void *vd, void *v0, target_ulong base, uint32_t vma =3D vext_vma(desc); =20 /* load bytes from guest memory */ - for (i =3D env->vstart; i < env->vl; i++, env->vstart++) { + for (i =3D env->vstart; i < env->vl; env->vstart =3D ++i) { k =3D 0; while (k < nf) { if (!vm && !vext_elem_mask(v0, i)) { --=20 2.43.2