From nobody Tue Nov 26 18:47:10 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=1705357645; cv=none; d=zohomail.com; s=zohoarc; b=KoRXIAR1G8JEH1CvBCQNHp00sHm1RPgMfRwTZf2Fy25WDuzHnzhv1NiqLQW8qNbWSl61T3gM3e7KYXz+eXsVoLUb8gWnthH9KURJyMXEOLnktzx7ghzmbJLHrKMvYsqChAUVK+CBO6a4rJOzDTEQFECpVoeqLRaAbYTjoHyYNhA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705357645; 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=lT0phRZ9oTpRjBU5KO4G/ql0H7YMEWcTrCKQ7fmArKs=; b=MxfL+gewpChc9azrPp/IWnjBtVjDVrFC/UVNuHiLTcDF517DJdS/tlsOUFucXbalCZO+kcc+LZg5NvySr925+lTeJcfURcctCed7BC9Ib2rGqdGxWKOW5pEQLcAKrCcDKBLSvRf3ZMaNQ6kk50c6l4i6qbQhghc3M6e43ZaX7u8= 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 1705357645099234.88588793395547; Mon, 15 Jan 2024 14:27:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rPVOp-0000W6-WC; Mon, 15 Jan 2024 17:25:44 -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 1rPVOo-0000V3-GP for qemu-devel@nongnu.org; Mon, 15 Jan 2024 17:25:42 -0500 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rPVOl-00061u-Ly for qemu-devel@nongnu.org; Mon, 15 Jan 2024 17:25:42 -0500 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6d9b1589a75so4334531b3a.3 for ; Mon, 15 Jan 2024 14:25:39 -0800 (PST) Received: from grind.. ([152.234.123.64]) by smtp.gmail.com with ESMTPSA id ks19-20020a056a004b9300b006d977f70cd5sm8125940pfb.23.2024.01.15.14.25.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 14:25:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1705357538; x=1705962338; 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=lT0phRZ9oTpRjBU5KO4G/ql0H7YMEWcTrCKQ7fmArKs=; b=gCezON85c9HX6I5MQDAjp/ywFGzDOMIe9g9D3O8sk4EdrSPuBsNyUE2PJHv7kF+7lE E/p6b0FxALniEdrOStPLuF7RhESot2sTYPqDSQtNAMCph2dueWcE2QEVkO3KcdXOMmtI sB1zA035QD1tfPn9FOKa4mQRclU+Wy1//ond4FPRdrb3OKfwRf5t/foVF2BTNgJzK+sR GaGDRTOqggEGtYiUi8PQ0tfr271Vay7IAuKPMPBDGD0GoQb6WCbS72SDvcdNOX2cO57V 3hzQbojlWbrQqC/isAxUlqOZRL6gxVkFSse5xdxY2W1o4l8ifflXpSARPTq4YHtkfdGs M3eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705357538; x=1705962338; 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=lT0phRZ9oTpRjBU5KO4G/ql0H7YMEWcTrCKQ7fmArKs=; b=Mzhv5yV/+VfWkdtl/UpeZCu4UYwiH5SQjzaDO/ZhfUuZ8Gwnem2Hz33JkwcdRSlalP ucVBxJpGEseKU7Bt59vmUHbPuCAvppj/K8OUJbFBPN6T1p7ur7LI+WEjYcHzOaQne2Tv R3wtHWy5eJxROQOX9IfjqqM+GBerOelDdldKj0AcmG6twLlWwTPmHPSrVmjQSqTKke9S K75fptLxSt/4s3P6wEVX6lGyQX2tV02stJbueifcVNurV17mMXxGS/Jzgz28CyJ8AxSA PwdOKP6Trgdpvopp+Ups4X3ArdJ0aZtzgTOxbnhRYAk23A45ntJDcRDPptYhgiVp0w94 9Q3A== X-Gm-Message-State: AOJu0YxmZYT/OXarIT3Ba0Dkjcf/qYCjcqkBI6bNGGrAl3IjjRWg8r/l yajWvWqW52xoHOU2pGxY5ZNneAfAAUXaSZTJl5WAVBj8h1uhVA== X-Google-Smtp-Source: AGHT+IGFVkq97h4Uq4VPs7S3+tVQu+cFlK84JEOGBRDZ9+W2Z3Hxq06Ez5sz5mJWY7B3S8mVO1YC2Q== X-Received: by 2002:a62:c106:0:b0:6d9:b385:26f9 with SMTP id i6-20020a62c106000000b006d9b38526f9mr2971007pfg.2.1705357538040; Mon, 15 Jan 2024 14:25:38 -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 v2 01/12] target/riscv: add 'vlenb' field in cpu->cfg Date: Mon, 15 Jan 2024 19:25:17 -0300 Message-ID: <20240115222528.257342-2-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240115222528.257342-1-dbarboza@ventanamicro.com> References: <20240115222528.257342-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::42b; envelope-from=dbarboza@ventanamicro.com; helo=mail-pf1-x42b.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1705357646771100003 Content-Type: text/plain; charset="utf-8" Our usage of 'vlenb' is overwhelming superior than the use of 'vlen'. We're using 'vlenb' most of the time, having to do 'vlen >> 3' or 'vlen / 8' in every instance. In hindsight we would be better if the 'vlenb' property was introduced instead of 'vlen'. That's not what happened, and now we can't easily get rid of it due to user scripts all around. What we can do, however, is to change our internal representation to use 'vlenb'. Add a 'vlenb' field in cpu->cfg. It'll be set via the existing 'vlen' property, i.e. setting 'vlen' will also set 'vlenb'. We'll replace all 'vlen >> 3' code to use 'vlenb' directly. Start with the single instance we have in target/riscv/cpu.c. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Richard Henderson --- target/riscv/cpu.c | 4 +++- target/riscv/cpu_cfg.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 8d3ec74a1c..f4261d2ffc 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -847,7 +847,7 @@ static void riscv_cpu_dump_state(CPUState *cs, FILE *f,= int flags) csr_ops[csrno].name, val); } } - uint16_t vlenb =3D cpu->cfg.vlen >> 3; + uint16_t vlenb =3D cpu->cfg.vlenb; =20 for (i =3D 0; i < 32; i++) { qemu_fprintf(f, " %-8s ", riscv_rvv_regnames[i]); @@ -1314,6 +1314,7 @@ static void riscv_cpu_init(Object *obj) /* Default values for non-bool cpu properties */ cpu->cfg.pmu_mask =3D MAKE_64BIT_MASK(3, 16); cpu->cfg.vlen =3D 128; + cpu->cfg.vlenb =3D 128 >> 3; cpu->cfg.elen =3D 64; cpu->env.vext_ver =3D VEXT_VERSION_1_00_0; } @@ -1810,6 +1811,7 @@ static void prop_vlen_set(Object *obj, Visitor *v, co= nst char *name, =20 cpu_option_add_user_setting(name, value); cpu->cfg.vlen =3D value; + cpu->cfg.vlenb =3D value >> 3; } =20 static void prop_vlen_get(Object *obj, Visitor *v, const char *name, diff --git a/target/riscv/cpu_cfg.h b/target/riscv/cpu_cfg.h index fea14c275f..50479dd72f 100644 --- a/target/riscv/cpu_cfg.h +++ b/target/riscv/cpu_cfg.h @@ -140,6 +140,7 @@ struct RISCVCPUConfig { =20 uint32_t pmu_mask; uint16_t vlen; + uint16_t vlenb; uint16_t elen; uint16_t cbom_blocksize; uint16_t cbop_blocksize; --=20 2.43.0 From nobody Tue Nov 26 18:47:10 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=1705357660; cv=none; d=zohomail.com; s=zohoarc; b=guN+T/TkeLvToKYZmZIAs7RvIq7qvK/NzW+s9WQcvM7Lrxw7VmtvooeCofNE9UjHHHhymnDHaw3Pzv7ndFFx6PKO/rWTegNWvgFDt13UJI7uPkN/lRmBi8JnUyotjWVSFMzuZLdxLIPY0XXlx0EFfq1kWTSVVp+O/jt9wzB9E5s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705357660; 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=UUTQ4hAGbR/U7aTocUntatBO3/zQ0lq0rhjwH747sgA=; b=WGHuYee/ygXFgioS9I6PkTbpZVLjI6NJuQWImAKgGr60fZBG5QY+GbIc/VZ32rIXCbODe58/mL0byc775vJ/cg/HQT1Qo+o/rw/afinZ2Zoj1zF4M0eqspevUFFs2y74V0KYLtCjomJq2wk9/+d4xTK21At+Bij4XgYaNI/Q+oQ= 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 1705357660085341.965483569885; Mon, 15 Jan 2024 14:27:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rPVOr-0000WW-IF; Mon, 15 Jan 2024 17:25:45 -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 1rPVOq-0000WE-5j for qemu-devel@nongnu.org; Mon, 15 Jan 2024 17:25:44 -0500 Received: from mail-ot1-x329.google.com ([2607:f8b0:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rPVOo-00062L-Mc for qemu-devel@nongnu.org; Mon, 15 Jan 2024 17:25:43 -0500 Received: by mail-ot1-x329.google.com with SMTP id 46e09a7af769-6dc20b4595bso6315116a34.0 for ; Mon, 15 Jan 2024 14:25:42 -0800 (PST) Received: from grind.. ([152.234.123.64]) by smtp.gmail.com with ESMTPSA id ks19-20020a056a004b9300b006d977f70cd5sm8125940pfb.23.2024.01.15.14.25.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 14:25:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1705357541; x=1705962341; 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=UUTQ4hAGbR/U7aTocUntatBO3/zQ0lq0rhjwH747sgA=; b=f6AahW0wUQhPT2VHMmsglHYA2w1bOVqn7Nh3iPnqYdU+tZBMHZLGjazGeygkeOLI7t KPr7mgDA7aHVPy/aF7hpC5y2YiI0VTycn4zLaAuwpq4DV+a927Ux3JvxBSJY1av36j9z aL/PI8KB0QrSAEbjVV7TRA95B7p/J7fe0aE2Il90tdHAgymE9J0OMMW/Fhc/0Tazr+3E 4gB7hC3HjFjPc1RaG0zYnmILgFqN6U5/tS730SaDL+Eq5AJQQTy4S2el9yxYnfR5F+nr BBH8Z+YY2bvk/4DQlP9q/QWs1TqNmEidIIZgnOfL9Pwv+5z3DqYJNbWqWAqIqUUZO3+P U/OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705357541; x=1705962341; 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=UUTQ4hAGbR/U7aTocUntatBO3/zQ0lq0rhjwH747sgA=; b=KV4TtP+hQosyciWUjNlBxc+nnEjuZcmG7vJsTK2M1MALnPiXQKX/ANDW+SuWp1vopc BMwXQNBsD6FC55zq2+UX/NJqfvHxNstlSvgQleaPVN0ecMvC3OOP8OMk2i0rMh17hW3N Yle8nCdom5NZWL5IWsX9LxLzaEMWuRrQ2u+luNNeoHqx83ItLlv3Di905J6XzUJeDqJ5 607FCM3xDCTtlpNFiSTtuHsO6hD/ZSZu1l/btOnCm/Tv0L5Yy8uLmRVOv1nGUqgXyEiE upaHu4OIcyM6GVJJnop1Y5vllUk8rrUQ/9PXoXvV4DznhdlgFAfsBqNDWZ4VE/Fj+zd6 MgPQ== X-Gm-Message-State: AOJu0Yzk6DoTnoKUbB/e57eMe+W0k2X887pQUzo66RpVxufso3uWgFia EVsrrf/H0Llowopa2J5IcXMdj2eQE2MSQ6piZJwwzjxWNRw1/g== X-Google-Smtp-Source: AGHT+IHLSkXeGGHPTJ9mZYJAQrNvnSYEU1g5MnmGpN1tzp7afZew/vTaWaW8onLyTXZDB/TMpQoP6w== X-Received: by 2002:a9d:7350:0:b0:6dc:379:b3f with SMTP id l16-20020a9d7350000000b006dc03790b3fmr7418994otk.46.1705357541202; Mon, 15 Jan 2024 14:25:41 -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 v2 02/12] target/riscv/csr.c: use 'vlenb' instead of 'vlen' Date: Mon, 15 Jan 2024 19:25:18 -0300 Message-ID: <20240115222528.257342-3-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240115222528.257342-1-dbarboza@ventanamicro.com> References: <20240115222528.257342-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::329; envelope-from=dbarboza@ventanamicro.com; helo=mail-ot1-x329.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1705357660848100001 Content-Type: text/plain; charset="utf-8" As a bonus, we're being more idiomatic using cpu->cfg.vlenb when reading CSR_VLENB. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Richard Henderson --- target/riscv/csr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 674ea075a4..5c8d22452b 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -683,7 +683,7 @@ static RISCVException read_vl(CPURISCVState *env, int c= srno, =20 static int read_vlenb(CPURISCVState *env, int csrno, target_ulong *val) { - *val =3D riscv_cpu_cfg(env)->vlen >> 3; + *val =3D riscv_cpu_cfg(env)->vlenb; return RISCV_EXCP_NONE; } =20 @@ -738,7 +738,7 @@ static RISCVException write_vstart(CPURISCVState *env, = int csrno, * The vstart CSR is defined to have only enough writable bits * to hold the largest element index, i.e. lg2(VLEN) bits. */ - env->vstart =3D val & ~(~0ULL << ctzl(riscv_cpu_cfg(env)->vlen)); + env->vstart =3D val & ~(~0ULL << ctzl(riscv_cpu_cfg(env)->vlenb << 3)); return RISCV_EXCP_NONE; } =20 --=20 2.43.0 From nobody Tue Nov 26 18:47:10 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=1705357602; cv=none; d=zohomail.com; s=zohoarc; b=IhjJnyWWgTSZQ4AL1MWNwtyVgbsa5+bBW1x/sDU8QfSLg4oNyKWFyCPE+uYwqCA2nxlpYFxO9b2W/MotPLlTkrR45lxwWl07BdPfurh+pKQ84EjqZl2EGt/XqGfCiS9AnR1OaJy0vJsmWeetjVBL9WlHU88uceFlJAy2QIUT3M0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705357602; 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=U9YxTyhvBJBHZnpiGwupT/MZk+RpUH5/F7uqSrQEr/Q=; b=LlSxJhHRM4Q49+WmAz3iri54HhyrIw0l1evjmIWGb5V7j4HU5gW3SAC+9xWea1ngyrjL1Fvsi43ZRqSVtsaav19+RyJQm3iPqVysALHBSBYqFIqWhGX2mf4+apJK/AgWmsWB8LykbczNjs6VCtbdhCJSFJDfcm3TIv/8WI4viiU= 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 1705357602273833.8562538551108; Mon, 15 Jan 2024 14:26:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rPVOu-0000XV-Cs; Mon, 15 Jan 2024 17:25:48 -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 1rPVOt-0000XF-JC for qemu-devel@nongnu.org; Mon, 15 Jan 2024 17:25:47 -0500 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rPVOs-000633-6R for qemu-devel@nongnu.org; Mon, 15 Jan 2024 17:25:47 -0500 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-6db79e11596so1061921b3a.0 for ; Mon, 15 Jan 2024 14:25:45 -0800 (PST) Received: from grind.. ([152.234.123.64]) by smtp.gmail.com with ESMTPSA id ks19-20020a056a004b9300b006d977f70cd5sm8125940pfb.23.2024.01.15.14.25.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 14:25:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1705357544; x=1705962344; 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=U9YxTyhvBJBHZnpiGwupT/MZk+RpUH5/F7uqSrQEr/Q=; b=lUu5tDHAc+zNN9dmqToM8/bg6PyOBlWULMM7lDh4nIbh+x1LLDc1ydx7Fx/zFwPrj1 hzg+7nLBsahGkC4eQvk+A9ESZX3EN4bWBaBQSeiJBzTabHPrYmMBhAZlP+pJ6vh0m18y ETDOTIC3gxy/OARIDN5quAtjQRpceHAXQHbbge1cEhdu1PHa7F5Beo2wqvhvMJj28lB3 YSEHEQmnwJKL0TVu6kTeuLQUlUEPykAsgbssPNW/OWlsEGo06rIXPRhKbrG9TCKK7//s RR9gXd3J2bmlxbssDjWItJmdf9+HqLRWafr6SCPPl9cKAFXSeE0BOeAoaCMuUadmiicE BbHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705357544; x=1705962344; 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=U9YxTyhvBJBHZnpiGwupT/MZk+RpUH5/F7uqSrQEr/Q=; b=RgAF2SYxW7fINxNEPgZpUG4fUGhkN34rKastn2LoZCkunv4wCTSAMqEfS0uePgqJtE unAU/z+Ncyykh4QyW16Jkyl3oNbM/b4bvvvNN8uZsC1oa0oHjxCjbiBcTynnpgtxu5Nm YV2K1FTpipWYNlhHQ2ImB6A+PHAzReTSQTs/SD934T/at7lpWsYUP+tdvV8WGFd2gRKy 8rgyCJBtBmni1pOwy0p4OKB2yhwjspVO4TuhZSWNrTml/xEXIor7H11f2D6fbuJDJWVU y4isIvEI9fI9slA+jxEhpC0h7mcByIFZU22TC7S75Dl3KjCiMkL/uY9Qd2K8KYSbF7Ws 2V9g== X-Gm-Message-State: AOJu0YyUbc9+XsPYVjVgUXdqP1WFVkDH5yYGn4LGch/9SMafBZzD1M+s +oziSDkm+CZBRm72V9jU+KHaxYGHAprGk/snkN1x2vkc1yLShQ== X-Google-Smtp-Source: AGHT+IEr3GW5oUNZIstQmBwZKZmNCuvBnfjIEwveaICKgZyJfSwg7RZoqMBoPTV9thgA71yX422puA== X-Received: by 2002:aa7:9e49:0:b0:6da:1d19:db46 with SMTP id z9-20020aa79e49000000b006da1d19db46mr6333515pfq.34.1705357544409; Mon, 15 Jan 2024 14:25:44 -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 v2 03/12] target/riscv/gdbstub.c: use 'vlenb' instead of shifting 'vlen' Date: Mon, 15 Jan 2024 19:25:19 -0300 Message-ID: <20240115222528.257342-4-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240115222528.257342-1-dbarboza@ventanamicro.com> References: <20240115222528.257342-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::433; envelope-from=dbarboza@ventanamicro.com; helo=mail-pf1-x433.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1705357602707100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Daniel Henrique Barboza Reviewed-by: Richard Henderson --- target/riscv/gdbstub.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/riscv/gdbstub.c b/target/riscv/gdbstub.c index 58b3ace0fe..5ab0abda19 100644 --- a/target/riscv/gdbstub.c +++ b/target/riscv/gdbstub.c @@ -130,7 +130,7 @@ static int riscv_gdb_set_fpu(CPURISCVState *env, uint8_= t *mem_buf, int n) =20 static int riscv_gdb_get_vector(CPURISCVState *env, GByteArray *buf, int n) { - uint16_t vlenb =3D riscv_cpu_cfg(env)->vlen >> 3; + uint16_t vlenb =3D riscv_cpu_cfg(env)->vlenb; if (n < 32) { int i; int cnt =3D 0; @@ -146,7 +146,7 @@ static int riscv_gdb_get_vector(CPURISCVState *env, GBy= teArray *buf, int n) =20 static int riscv_gdb_set_vector(CPURISCVState *env, uint8_t *mem_buf, int = n) { - uint16_t vlenb =3D riscv_cpu_cfg(env)->vlen >> 3; + uint16_t vlenb =3D riscv_cpu_cfg(env)->vlenb; if (n < 32) { int i; for (i =3D 0; i < vlenb; i +=3D 8) { @@ -266,7 +266,7 @@ static int ricsv_gen_dynamic_vector_xml(CPUState *cs, i= nt base_reg) RISCVCPU *cpu =3D RISCV_CPU(cs); GString *s =3D g_string_new(NULL); g_autoptr(GString) ts =3D g_string_new(""); - int reg_width =3D cpu->cfg.vlen; + int reg_width =3D cpu->cfg.vlenb << 3; int num_regs =3D 0; int i; =20 --=20 2.43.0 From nobody Tue Nov 26 18:47:10 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=1705357662; cv=none; d=zohomail.com; s=zohoarc; b=djh1C0uXilfE9gg+54BvCOjotcMm96BZasI7T004elgi4i33uE/1aJ95mjDji6hWsPz+XE3ivvY+eSYMEocdoykZ7J0GiYYobsiS54Xa67skcGgW3PrrFlm8P63Uj8Bss1CjShzmKaU+6G5o4WwvmigfQMrrEPep1UI2eEh0h6M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705357662; 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=qF5+PX0nZWOHyWfrTo8zcaVTywr+EXD7qxo9/Mep7fY=; b=jvi2NMNqk97rjxco8yI0B+GoADm/Aaqdr2qrlF8J9ZD04nndbY7VuMTz2WUNPwxvFcGllbSTy4G+j8RCUfdlkfDoJ1sf5Ok6UK2IMBjyy/wBYI7w+Bru3HhMQtJl2wtMS/jrXxDJWZzdAw13uu9h051wmJMciP1KXNrSnSXLns8= 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 1705357662726150.78442049824775; Mon, 15 Jan 2024 14:27:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rPVOz-0000Z4-3N; Mon, 15 Jan 2024 17:25:53 -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 1rPVOx-0000YC-Bt for qemu-devel@nongnu.org; Mon, 15 Jan 2024 17:25:51 -0500 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rPVOv-00063k-R6 for qemu-devel@nongnu.org; Mon, 15 Jan 2024 17:25:51 -0500 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6d9bbf71bc8so4584635b3a.1 for ; Mon, 15 Jan 2024 14:25:49 -0800 (PST) Received: from grind.. ([152.234.123.64]) by smtp.gmail.com with ESMTPSA id ks19-20020a056a004b9300b006d977f70cd5sm8125940pfb.23.2024.01.15.14.25.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 14:25:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1705357547; x=1705962347; 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=qF5+PX0nZWOHyWfrTo8zcaVTywr+EXD7qxo9/Mep7fY=; b=B+++nKOj+18qjxALVlb0SvJRkz54l8ee+8mvbCOCw/0mCR7pns7R2eA7gMB/oa+vxi +RfhxlGaeHn+yofvHoR77qg4qHeaaW5rqJvo9puh69IS1WZqmAzWZvxMfBvRILFIp+yE Ge0eB0KIZqrnP6/i+PLhEKSYoJ6rCeqPmSQzKTFdS08EZ+1fQxgvM+1OMYYlccOgKpv7 TB2v9+TTCvAPdujzIawIh2X3TWI6UEwbD9gML2vwaecKz+j4PYekizMQifHMahRIY5+/ 0tafatip3jz3L4YryzWeajABSUPPesDrQIPd96cFdArUDGq7/XSRgj2Pp0n7aVEOlWfH E89Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705357547; x=1705962347; 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=qF5+PX0nZWOHyWfrTo8zcaVTywr+EXD7qxo9/Mep7fY=; b=LMETQg+TdembK506Li6Q1sgHFBjb4oN8ZQuIHecnC+/eoYBn0ymxx7xddWoZUfzOly SzYP4vDwAJegNgtjOmxfuYh83N4xgRs3+WhH5omkMmsrQovkgNgKWFcF3FIBYb5KsAyj SsJkiYL7fXgczmZ/zZkU483+DyxRy2mqPhRNCDYvYpfCCey2mMXYUHmjRdi8Z0qHVbXD ykC6VxaPjUxnsDMOHPUXeKgz/3NKvnUgmgtASl+YeE0TMSX2DLcn2pfrEpmAnoC2RUd6 lTyU20M4mLMV+K4I//YKflKEE6d1vJ8ACTmJSTlIMXWAALTz3dI4ZnMLocGQ22yx99VH YYFg== X-Gm-Message-State: AOJu0Yzo5mMbm0X0xXKRqbA9yqmeOSt0uiRlML3bjaSimcklx0qZXeyr ZxIVLNyV6wJ316/p2gL5/ab13QTJsRNZzVAbKiUYAV0uu9l1qw== X-Google-Smtp-Source: AGHT+IGErSJHA9TQ3bzhyNHyWRWP5ngid3reGeNgPC5m9tQtux8OQQQNDlGS2kjKiGwBWvkNoqGIEQ== X-Received: by 2002:a05:6a00:3d44:b0:6da:63a5:3f32 with SMTP id lp4-20020a056a003d4400b006da63a53f32mr3929074pfb.66.1705357547630; Mon, 15 Jan 2024 14:25:47 -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 v2 04/12] target/riscv/insn_trans/trans_rvbf16.c.inc: use cpu->cfg.vlenb Date: Mon, 15 Jan 2024 19:25:20 -0300 Message-ID: <20240115222528.257342-5-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240115222528.257342-1-dbarboza@ventanamicro.com> References: <20240115222528.257342-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::42b; envelope-from=dbarboza@ventanamicro.com; helo=mail-pf1-x42b.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1705357664800100009 Content-Type: text/plain; charset="utf-8" Use ctx->cfg_ptr->vlenb instead of ctx->cfg_ptr->vlen / 8. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Richard Henderson --- target/riscv/insn_trans/trans_rvbf16.c.inc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/target/riscv/insn_trans/trans_rvbf16.c.inc b/target/riscv/insn= _trans/trans_rvbf16.c.inc index 4e39c00884..8ee99df3f3 100644 --- a/target/riscv/insn_trans/trans_rvbf16.c.inc +++ b/target/riscv/insn_trans/trans_rvbf16.c.inc @@ -83,8 +83,8 @@ static bool trans_vfncvtbf16_f_f_w(DisasContext *ctx, arg= _vfncvtbf16_f_f_w *a) data =3D FIELD_DP32(data, VDATA, VMA, ctx->vma); tcg_gen_gvec_3_ptr(vreg_ofs(ctx, a->rd), vreg_ofs(ctx, 0), vreg_ofs(ctx, a->rs2), tcg_env, - ctx->cfg_ptr->vlen / 8, - ctx->cfg_ptr->vlen / 8, data, + ctx->cfg_ptr->vlenb, + ctx->cfg_ptr->vlenb, data, gen_helper_vfncvtbf16_f_f_w); mark_vs_dirty(ctx); gen_set_label(over); @@ -112,8 +112,8 @@ static bool trans_vfwcvtbf16_f_f_v(DisasContext *ctx, a= rg_vfwcvtbf16_f_f_v *a) data =3D FIELD_DP32(data, VDATA, VMA, ctx->vma); tcg_gen_gvec_3_ptr(vreg_ofs(ctx, a->rd), vreg_ofs(ctx, 0), vreg_ofs(ctx, a->rs2), tcg_env, - ctx->cfg_ptr->vlen / 8, - ctx->cfg_ptr->vlen / 8, data, + ctx->cfg_ptr->vlenb, + ctx->cfg_ptr->vlenb, data, gen_helper_vfwcvtbf16_f_f_v); mark_vs_dirty(ctx); gen_set_label(over); @@ -143,8 +143,8 @@ static bool trans_vfwmaccbf16_vv(DisasContext *ctx, arg= _vfwmaccbf16_vv *a) tcg_gen_gvec_4_ptr(vreg_ofs(ctx, a->rd), vreg_ofs(ctx, 0), vreg_ofs(ctx, a->rs1), vreg_ofs(ctx, a->rs2), tcg_env, - ctx->cfg_ptr->vlen / 8, - ctx->cfg_ptr->vlen / 8, data, + ctx->cfg_ptr->vlenb, + ctx->cfg_ptr->vlenb, data, gen_helper_vfwmaccbf16_vv); mark_vs_dirty(ctx); gen_set_label(over); --=20 2.43.0 From nobody Tue Nov 26 18:47:10 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=1705357662; cv=none; d=zohomail.com; s=zohoarc; b=YOSrdxRoWkQE2Y+BjmxRLE99ihky7oApXAtFsjyYui/1UdCytjB9Q6W5pK17UnkOEmPby8epxzeU5WZmaoGxBbAipv6++doRT/c6XZDzsYE1IUmQAiuAzLsF38AM5LX9UFfLCqzljF5uk1RJA3uB2kYNQdneOVpsejPUDBu6+i4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705357662; 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=oG+n+hpiuw9eVHt2qVKYZPz8/VozWa7gXIVGPPyLFog=; b=NJ6juDx11KhoDaj475ysCEmfaQQU3sPNkJxh5JATuRYphsM3cNpz2IBjO9hUrdO5hZreLwXEOTsp+1ZFCvup1bU8sZ6ax1WnR433cTZNSWMXTHMMubU7L1iSIfJiw42hsJ3IH7Wy+fma0d9WoPtPQ6ypmd2eRmX52a4F4kBzaYw= 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 17053576628561002.3810929373374; Mon, 15 Jan 2024 14:27:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rPVP3-0000Zr-NU; Mon, 15 Jan 2024 17:25: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 1rPVP1-0000ZR-R2 for qemu-devel@nongnu.org; Mon, 15 Jan 2024 17:25:55 -0500 Received: from mail-ot1-x32c.google.com ([2607:f8b0:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rPVOy-00064J-OM for qemu-devel@nongnu.org; Mon, 15 Jan 2024 17:25:55 -0500 Received: by mail-ot1-x32c.google.com with SMTP id 46e09a7af769-6ddef319fabso4021402a34.1 for ; Mon, 15 Jan 2024 14:25:52 -0800 (PST) Received: from grind.. ([152.234.123.64]) by smtp.gmail.com with ESMTPSA id ks19-20020a056a004b9300b006d977f70cd5sm8125940pfb.23.2024.01.15.14.25.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 14:25:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1705357551; x=1705962351; 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=oG+n+hpiuw9eVHt2qVKYZPz8/VozWa7gXIVGPPyLFog=; b=L3tresyQM2bqqokNJIyKQa5CUhhCMcgcDs7J9MuXT7TzWGXyapIjvPSWLJDGegZE9d PXmv/ZKSqQUcBUY4vN4NURrY5ffCCGrR1uEwcCVwkJeUHoGvCi796A4w7UJg3SD9vlhe WXius2euqsMHdnN+huDRJpswU0VMUxb6HLFXFy/YEMVaOv/n1w5za6WFTr2ncSJSXFWS 8VjV95NpS378TwmfMF0st4/weSel22hMUZR52eJfhXYACbazt0buprzZuFrAqixKoT/I cLwIknRjqEPGyw+H6Ot0AJaabyz9XQ28BsJ4DJ89e0jySfoDBxpLsSMKOjhzguV22A8c 79+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705357551; x=1705962351; 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=oG+n+hpiuw9eVHt2qVKYZPz8/VozWa7gXIVGPPyLFog=; b=EgS4bW9iz6DLx9d2T2jc9vFoVfgVmeTG1oDjHMMN9HvQX6275yEsFSzMrmQryXgBtI xCpv3uqBku1gyIY5RD/kJfoIvoMKMBjPrWcAonRob16pXBL8MaN5yS6tV6drlTpKSzdY PzTitEe6NOGpNzn8VXvevuFljMHfRJUizqdinCRsSKCeIKwM23/pcW/UEu41g7x+mj7B Nxmi74gA+rJB9aPqE+FiMmCqkKU5So6oEhCzRPN+ecHI2C152UjK/dZ6RcB0C3srAKWm QQxtgUCWK+sk7hslGtMtKYeYPHX1pRh39Eop1KBlCOEhNma246KcRCtNvZAn4G+JdO6J viiw== X-Gm-Message-State: AOJu0Yy2Vx2MfWj96hpYq0C98hNm8nVG7DuNVWmPcR3iXSZs1cSaPkGP J1TMNk4DqlA2x9HRfz4H0wXrSWxBQRc8XU0RyCvQXGw1IWu6nA== X-Google-Smtp-Source: AGHT+IE0bzu1DBOvD1TK4ECy3dbDU7GylbVVtrmG/2pHaMnwk/pycT24Jxbf2BNRFolju1lI+iTZ4A== X-Received: by 2002:a9d:4d15:0:b0:6de:6e8a:cfa8 with SMTP id n21-20020a9d4d15000000b006de6e8acfa8mr6377964otf.2.1705357551086; Mon, 15 Jan 2024 14:25:51 -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 v2 05/12] target/riscv/insn_trans/trans_rvv.c.inc: use 'vlenb' Date: Mon, 15 Jan 2024 19:25:21 -0300 Message-ID: <20240115222528.257342-6-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240115222528.257342-1-dbarboza@ventanamicro.com> References: <20240115222528.257342-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::32c; envelope-from=dbarboza@ventanamicro.com; helo=mail-ot1-x32c.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1705357664867100010 Content-Type: text/plain; charset="utf-8" Use s->cfg_ptr->vlenb instead of "s->cfg_ptr->vlen / 8" and "s->cfg_ptr->vlen >> 3". Signed-off-by: Daniel Henrique Barboza Reviewed-by: Richard Henderson --- target/riscv/insn_trans/trans_rvv.c.inc | 140 ++++++++++++------------ 1 file changed, 70 insertions(+), 70 deletions(-) diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_tr= ans/trans_rvv.c.inc index 3871f0ea73..d743675262 100644 --- a/target/riscv/insn_trans/trans_rvv.c.inc +++ b/target/riscv/insn_trans/trans_rvv.c.inc @@ -217,7 +217,7 @@ static bool trans_vsetivli(DisasContext *s, arg_vsetivl= i *a) /* vector register offset from env */ static uint32_t vreg_ofs(DisasContext *s, int reg) { - return offsetof(CPURISCVState, vreg) + reg * s->cfg_ptr->vlen / 8; + return offsetof(CPURISCVState, vreg) + reg * s->cfg_ptr->vlenb; } =20 /* check functions */ @@ -627,11 +627,11 @@ static bool ldst_us_trans(uint32_t vd, uint32_t rs1, = uint32_t data, * As simd_desc supports at most 2048 bytes, and in this implementatio= n, * the max vector group length is 4096 bytes. So split it into two par= ts. * - * The first part is vlen in bytes, encoded in maxsz of simd_desc. + * The first part is vlen in bytes (vlenb), encoded in maxsz of simd_d= esc. * The second part is lmul, encoded in data of simd_desc. */ - desc =3D tcg_constant_i32(simd_desc(s->cfg_ptr->vlen / 8, - s->cfg_ptr->vlen / 8, data)); + desc =3D tcg_constant_i32(simd_desc(s->cfg_ptr->vlenb, + s->cfg_ptr->vlenb, data)); =20 tcg_gen_addi_ptr(dest, tcg_env, vreg_ofs(s, vd)); tcg_gen_addi_ptr(mask, tcg_env, vreg_ofs(s, 0)); @@ -791,8 +791,8 @@ static bool ldst_stride_trans(uint32_t vd, uint32_t rs1= , uint32_t rs2, mask =3D tcg_temp_new_ptr(); base =3D get_gpr(s, rs1, EXT_NONE); stride =3D get_gpr(s, rs2, EXT_NONE); - desc =3D tcg_constant_i32(simd_desc(s->cfg_ptr->vlen / 8, - s->cfg_ptr->vlen / 8, data)); + desc =3D tcg_constant_i32(simd_desc(s->cfg_ptr->vlenb, + s->cfg_ptr->vlenb, data)); =20 tcg_gen_addi_ptr(dest, tcg_env, vreg_ofs(s, vd)); tcg_gen_addi_ptr(mask, tcg_env, vreg_ofs(s, 0)); @@ -897,8 +897,8 @@ static bool ldst_index_trans(uint32_t vd, uint32_t rs1,= uint32_t vs2, mask =3D tcg_temp_new_ptr(); index =3D tcg_temp_new_ptr(); base =3D get_gpr(s, rs1, EXT_NONE); - desc =3D tcg_constant_i32(simd_desc(s->cfg_ptr->vlen / 8, - s->cfg_ptr->vlen / 8, data)); + desc =3D tcg_constant_i32(simd_desc(s->cfg_ptr->vlenb, + s->cfg_ptr->vlenb, data)); =20 tcg_gen_addi_ptr(dest, tcg_env, vreg_ofs(s, vd)); tcg_gen_addi_ptr(index, tcg_env, vreg_ofs(s, vs2)); @@ -1036,8 +1036,8 @@ static bool ldff_trans(uint32_t vd, uint32_t rs1, uin= t32_t data, dest =3D tcg_temp_new_ptr(); mask =3D tcg_temp_new_ptr(); base =3D get_gpr(s, rs1, EXT_NONE); - desc =3D tcg_constant_i32(simd_desc(s->cfg_ptr->vlen / 8, - s->cfg_ptr->vlen / 8, data)); + desc =3D tcg_constant_i32(simd_desc(s->cfg_ptr->vlenb, + s->cfg_ptr->vlenb, data)); =20 tcg_gen_addi_ptr(dest, tcg_env, vreg_ofs(s, vd)); tcg_gen_addi_ptr(mask, tcg_env, vreg_ofs(s, 0)); @@ -1086,7 +1086,7 @@ static bool ldst_whole_trans(uint32_t vd, uint32_t rs= 1, uint32_t nf, uint32_t width, gen_helper_ldst_whole *fn, DisasContext *s, bool is_store) { - uint32_t evl =3D (s->cfg_ptr->vlen / 8) * nf / width; + uint32_t evl =3D s->cfg_ptr->vlenb * nf / width; TCGLabel *over =3D gen_new_label(); tcg_gen_brcondi_tl(TCG_COND_GEU, cpu_vstart, evl, over); =20 @@ -1096,8 +1096,8 @@ static bool ldst_whole_trans(uint32_t vd, uint32_t rs= 1, uint32_t nf, =20 uint32_t data =3D FIELD_DP32(0, VDATA, NF, nf); dest =3D tcg_temp_new_ptr(); - desc =3D tcg_constant_i32(simd_desc(s->cfg_ptr->vlen / 8, - s->cfg_ptr->vlen / 8, data)); + desc =3D tcg_constant_i32(simd_desc(s->cfg_ptr->vlenb, + s->cfg_ptr->vlenb, data)); =20 base =3D get_gpr(s, rs1, EXT_NONE); tcg_gen_addi_ptr(dest, tcg_env, vreg_ofs(s, vd)); @@ -1199,8 +1199,8 @@ do_opivv_gvec(DisasContext *s, arg_rmrr *a, GVecGen3F= n *gvec_fn, data =3D FIELD_DP32(data, VDATA, VMA, s->vma); tcg_gen_gvec_4_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), vreg_ofs(s, a->rs1), vreg_ofs(s, a->rs2), - tcg_env, s->cfg_ptr->vlen / 8, - s->cfg_ptr->vlen / 8, data, fn); + tcg_env, s->cfg_ptr->vlenb, + s->cfg_ptr->vlenb, data, fn); } mark_vs_dirty(s); gen_set_label(over); @@ -1248,8 +1248,8 @@ static bool opivx_trans(uint32_t vd, uint32_t rs1, ui= nt32_t vs2, uint32_t vm, data =3D FIELD_DP32(data, VDATA, VTA, s->vta); data =3D FIELD_DP32(data, VDATA, VTA_ALL_1S, s->cfg_vta_all_1s); data =3D FIELD_DP32(data, VDATA, VMA, s->vma); - desc =3D tcg_constant_i32(simd_desc(s->cfg_ptr->vlen / 8, - s->cfg_ptr->vlen / 8, data)); + desc =3D tcg_constant_i32(simd_desc(s->cfg_ptr->vlenb, + s->cfg_ptr->vlenb, data)); =20 tcg_gen_addi_ptr(dest, tcg_env, vreg_ofs(s, vd)); tcg_gen_addi_ptr(src2, tcg_env, vreg_ofs(s, vs2)); @@ -1410,8 +1410,8 @@ static bool opivi_trans(uint32_t vd, uint32_t imm, ui= nt32_t vs2, uint32_t vm, data =3D FIELD_DP32(data, VDATA, VTA, s->vta); data =3D FIELD_DP32(data, VDATA, VTA_ALL_1S, s->cfg_vta_all_1s); data =3D FIELD_DP32(data, VDATA, VMA, s->vma); - desc =3D tcg_constant_i32(simd_desc(s->cfg_ptr->vlen / 8, - s->cfg_ptr->vlen / 8, data)); + desc =3D tcg_constant_i32(simd_desc(s->cfg_ptr->vlenb, + s->cfg_ptr->vlenb, data)); =20 tcg_gen_addi_ptr(dest, tcg_env, vreg_ofs(s, vd)); tcg_gen_addi_ptr(src2, tcg_env, vreg_ofs(s, vs2)); @@ -1492,8 +1492,8 @@ static bool do_opivv_widen(DisasContext *s, arg_rmrr = *a, tcg_gen_gvec_4_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), vreg_ofs(s, a->rs1), vreg_ofs(s, a->rs2), - tcg_env, s->cfg_ptr->vlen / 8, - s->cfg_ptr->vlen / 8, + tcg_env, s->cfg_ptr->vlenb, + s->cfg_ptr->vlenb, data, fn); mark_vs_dirty(s); gen_set_label(over); @@ -1568,8 +1568,8 @@ static bool do_opiwv_widen(DisasContext *s, arg_rmrr = *a, tcg_gen_gvec_4_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), vreg_ofs(s, a->rs1), vreg_ofs(s, a->rs2), - tcg_env, s->cfg_ptr->vlen / 8, - s->cfg_ptr->vlen / 8, data, fn); + tcg_env, s->cfg_ptr->vlenb, + s->cfg_ptr->vlenb, data, fn); mark_vs_dirty(s); gen_set_label(over); return true; @@ -1639,8 +1639,8 @@ static bool opivv_trans(uint32_t vd, uint32_t vs1, ui= nt32_t vs2, uint32_t vm, data =3D FIELD_DP32(data, VDATA, VTA_ALL_1S, s->cfg_vta_all_1s); data =3D FIELD_DP32(data, VDATA, VMA, s->vma); tcg_gen_gvec_4_ptr(vreg_ofs(s, vd), vreg_ofs(s, 0), vreg_ofs(s, vs1), - vreg_ofs(s, vs2), tcg_env, s->cfg_ptr->vlen / 8, - s->cfg_ptr->vlen / 8, data, fn); + vreg_ofs(s, vs2), tcg_env, s->cfg_ptr->vlenb, + s->cfg_ptr->vlenb, data, fn); mark_vs_dirty(s); gen_set_label(over); return true; @@ -1831,8 +1831,8 @@ static bool trans_##NAME(DisasContext *s, arg_rmrr *a= ) \ tcg_gen_gvec_4_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), \ vreg_ofs(s, a->rs1), \ vreg_ofs(s, a->rs2), tcg_env, \ - s->cfg_ptr->vlen / 8, \ - s->cfg_ptr->vlen / 8, data, \ + s->cfg_ptr->vlenb, \ + s->cfg_ptr->vlenb, data, \ fns[s->sew]); \ mark_vs_dirty(s); \ gen_set_label(over); \ @@ -2036,8 +2036,8 @@ static bool trans_vmv_v_v(DisasContext *s, arg_vmv_v_= v *a) tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over); =20 tcg_gen_gvec_2_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, a->rs1), - tcg_env, s->cfg_ptr->vlen / 8, - s->cfg_ptr->vlen / 8, data, + tcg_env, s->cfg_ptr->vlenb, + s->cfg_ptr->vlenb, data, fns[s->sew]); gen_set_label(over); } @@ -2082,8 +2082,8 @@ static bool trans_vmv_v_x(DisasContext *s, arg_vmv_v_= x *a) }; =20 tcg_gen_ext_tl_i64(s1_i64, s1); - desc =3D tcg_constant_i32(simd_desc(s->cfg_ptr->vlen / 8, - s->cfg_ptr->vlen / 8, data)); + desc =3D tcg_constant_i32(simd_desc(s->cfg_ptr->vlenb, + s->cfg_ptr->vlenb, data)); tcg_gen_addi_ptr(dest, tcg_env, vreg_ofs(s, a->rd)); fns[s->sew](dest, s1_i64, tcg_env, desc); } @@ -2121,8 +2121,8 @@ static bool trans_vmv_v_i(DisasContext *s, arg_vmv_v_= i *a) =20 s1 =3D tcg_constant_i64(simm); dest =3D tcg_temp_new_ptr(); - desc =3D tcg_constant_i32(simd_desc(s->cfg_ptr->vlen / 8, - s->cfg_ptr->vlen / 8, data)); + desc =3D tcg_constant_i32(simd_desc(s->cfg_ptr->vlenb, + s->cfg_ptr->vlenb, data)); tcg_gen_addi_ptr(dest, tcg_env, vreg_ofs(s, a->rd)); fns[s->sew](dest, s1, tcg_env, desc); =20 @@ -2275,8 +2275,8 @@ static bool trans_##NAME(DisasContext *s, arg_rmrr *a= ) \ tcg_gen_gvec_4_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), \ vreg_ofs(s, a->rs1), \ vreg_ofs(s, a->rs2), tcg_env, \ - s->cfg_ptr->vlen / 8, \ - s->cfg_ptr->vlen / 8, data, \ + s->cfg_ptr->vlenb, \ + s->cfg_ptr->vlenb, data, \ fns[s->sew - 1]); \ mark_vs_dirty(s); \ gen_set_label(over); \ @@ -2303,8 +2303,8 @@ static bool opfvf_trans(uint32_t vd, uint32_t rs1, ui= nt32_t vs2, dest =3D tcg_temp_new_ptr(); mask =3D tcg_temp_new_ptr(); src2 =3D tcg_temp_new_ptr(); - desc =3D tcg_constant_i32(simd_desc(s->cfg_ptr->vlen / 8, - s->cfg_ptr->vlen / 8, data)); + desc =3D tcg_constant_i32(simd_desc(s->cfg_ptr->vlenb, + s->cfg_ptr->vlenb, data)); =20 tcg_gen_addi_ptr(dest, tcg_env, vreg_ofs(s, vd)); tcg_gen_addi_ptr(src2, tcg_env, vreg_ofs(s, vs2)); @@ -2391,8 +2391,8 @@ static bool trans_##NAME(DisasContext *s, arg_rmrr *a= ) \ tcg_gen_gvec_4_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), \ vreg_ofs(s, a->rs1), \ vreg_ofs(s, a->rs2), tcg_env, \ - s->cfg_ptr->vlen / 8, \ - s->cfg_ptr->vlen / 8, data, \ + s->cfg_ptr->vlenb, \ + s->cfg_ptr->vlenb, data, \ fns[s->sew - 1]); \ mark_vs_dirty(s); \ gen_set_label(over); \ @@ -2465,8 +2465,8 @@ static bool trans_##NAME(DisasContext *s, arg_rmrr *a= ) \ tcg_gen_gvec_4_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), \ vreg_ofs(s, a->rs1), \ vreg_ofs(s, a->rs2), tcg_env, \ - s->cfg_ptr->vlen / 8, \ - s->cfg_ptr->vlen / 8, data, \ + s->cfg_ptr->vlenb, \ + s->cfg_ptr->vlenb, data, \ fns[s->sew - 1]); \ mark_vs_dirty(s); \ gen_set_label(over); \ @@ -2581,8 +2581,8 @@ static bool do_opfv(DisasContext *s, arg_rmr *a, data =3D FIELD_DP32(data, VDATA, VMA, s->vma); tcg_gen_gvec_3_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), vreg_ofs(s, a->rs2), tcg_env, - s->cfg_ptr->vlen / 8, - s->cfg_ptr->vlen / 8, data, fn); + s->cfg_ptr->vlenb, + s->cfg_ptr->vlenb, data, fn); mark_vs_dirty(s); gen_set_label(over); return true; @@ -2691,8 +2691,8 @@ static bool trans_vfmv_v_f(DisasContext *s, arg_vfmv_= v_f *a) do_nanbox(s, t1, cpu_fpr[a->rs1]); =20 dest =3D tcg_temp_new_ptr(); - desc =3D tcg_constant_i32(simd_desc(s->cfg_ptr->vlen / 8, - s->cfg_ptr->vlen / 8, data)); + desc =3D tcg_constant_i32(simd_desc(s->cfg_ptr->vlenb, + s->cfg_ptr->vlenb, data)); tcg_gen_addi_ptr(dest, tcg_env, vreg_ofs(s, a->rd)); =20 fns[s->sew - 1](dest, t1, tcg_env, desc); @@ -2770,8 +2770,8 @@ static bool trans_##NAME(DisasContext *s, arg_rmr *a)= \ data =3D FIELD_DP32(data, VDATA, VMA, s->vma); \ tcg_gen_gvec_3_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), \ vreg_ofs(s, a->rs2), tcg_env, \ - s->cfg_ptr->vlen / 8, \ - s->cfg_ptr->vlen / 8, data, \ + s->cfg_ptr->vlenb, \ + s->cfg_ptr->vlenb, data, \ fns[s->sew - 1]); \ mark_vs_dirty(s); \ gen_set_label(over); \ @@ -2821,8 +2821,8 @@ static bool trans_##NAME(DisasContext *s, arg_rmr *a)= \ data =3D FIELD_DP32(data, VDATA, VMA, s->vma); \ tcg_gen_gvec_3_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), \ vreg_ofs(s, a->rs2), tcg_env, \ - s->cfg_ptr->vlen / 8, \ - s->cfg_ptr->vlen / 8, data, \ + s->cfg_ptr->vlenb, \ + s->cfg_ptr->vlenb, data, \ fns[s->sew]); \ mark_vs_dirty(s); \ gen_set_label(over); \ @@ -2888,8 +2888,8 @@ static bool trans_##NAME(DisasContext *s, arg_rmr *a)= \ data =3D FIELD_DP32(data, VDATA, VMA, s->vma); \ tcg_gen_gvec_3_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), \ vreg_ofs(s, a->rs2), tcg_env, \ - s->cfg_ptr->vlen / 8, \ - s->cfg_ptr->vlen / 8, data, \ + s->cfg_ptr->vlenb, \ + s->cfg_ptr->vlenb, data, \ fns[s->sew - 1]); \ mark_vs_dirty(s); \ gen_set_label(over); \ @@ -2937,8 +2937,8 @@ static bool trans_##NAME(DisasContext *s, arg_rmr *a)= \ data =3D FIELD_DP32(data, VDATA, VMA, s->vma); \ tcg_gen_gvec_3_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), \ vreg_ofs(s, a->rs2), tcg_env, \ - s->cfg_ptr->vlen / 8, \ - s->cfg_ptr->vlen / 8, data, \ + s->cfg_ptr->vlenb, \ + s->cfg_ptr->vlenb, data, \ fns[s->sew]); \ mark_vs_dirty(s); \ gen_set_label(over); \ @@ -3027,8 +3027,8 @@ static bool trans_##NAME(DisasContext *s, arg_r *a) = \ tcg_gen_gvec_4_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), \ vreg_ofs(s, a->rs1), \ vreg_ofs(s, a->rs2), tcg_env, \ - s->cfg_ptr->vlen / 8, \ - s->cfg_ptr->vlen / 8, data, fn); \ + s->cfg_ptr->vlenb, \ + s->cfg_ptr->vlenb, data, fn); \ mark_vs_dirty(s); \ gen_set_label(over); \ return true; \ @@ -3061,8 +3061,8 @@ static bool trans_vcpop_m(DisasContext *s, arg_rmr *a) mask =3D tcg_temp_new_ptr(); src2 =3D tcg_temp_new_ptr(); dst =3D dest_gpr(s, a->rd); - desc =3D tcg_constant_i32(simd_desc(s->cfg_ptr->vlen / 8, - s->cfg_ptr->vlen / 8, data)); + desc =3D tcg_constant_i32(simd_desc(s->cfg_ptr->vlenb, + s->cfg_ptr->vlenb, data)); =20 tcg_gen_addi_ptr(src2, tcg_env, vreg_ofs(s, a->rs2)); tcg_gen_addi_ptr(mask, tcg_env, vreg_ofs(s, 0)); @@ -3090,8 +3090,8 @@ static bool trans_vfirst_m(DisasContext *s, arg_rmr *= a) mask =3D tcg_temp_new_ptr(); src2 =3D tcg_temp_new_ptr(); dst =3D dest_gpr(s, a->rd); - desc =3D tcg_constant_i32(simd_desc(s->cfg_ptr->vlen / 8, - s->cfg_ptr->vlen / 8, data)); + desc =3D tcg_constant_i32(simd_desc(s->cfg_ptr->vlenb, + s->cfg_ptr->vlenb, data)); =20 tcg_gen_addi_ptr(src2, tcg_env, vreg_ofs(s, a->rs2)); tcg_gen_addi_ptr(mask, tcg_env, vreg_ofs(s, 0)); @@ -3128,8 +3128,8 @@ static bool trans_##NAME(DisasContext *s, arg_rmr *a)= \ data =3D FIELD_DP32(data, VDATA, VMA, s->vma); \ tcg_gen_gvec_3_ptr(vreg_ofs(s, a->rd), \ vreg_ofs(s, 0), vreg_ofs(s, a->rs2), \ - tcg_env, s->cfg_ptr->vlen / 8, \ - s->cfg_ptr->vlen / 8, \ + tcg_env, s->cfg_ptr->vlenb, \ + s->cfg_ptr->vlenb, \ data, fn); \ mark_vs_dirty(s); \ gen_set_label(over); \ @@ -3171,8 +3171,8 @@ static bool trans_viota_m(DisasContext *s, arg_viota_= m *a) }; tcg_gen_gvec_3_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), vreg_ofs(s, a->rs2), tcg_env, - s->cfg_ptr->vlen / 8, - s->cfg_ptr->vlen / 8, data, fns[s->sew]); + s->cfg_ptr->vlenb, + s->cfg_ptr->vlenb, data, fns[s->sew]); mark_vs_dirty(s); gen_set_label(over); return true; @@ -3200,8 +3200,8 @@ static bool trans_vid_v(DisasContext *s, arg_vid_v *a) gen_helper_vid_v_w, gen_helper_vid_v_d, }; tcg_gen_gvec_2_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), - tcg_env, s->cfg_ptr->vlen / 8, - s->cfg_ptr->vlen / 8, + tcg_env, s->cfg_ptr->vlenb, + s->cfg_ptr->vlenb, data, fns[s->sew]); mark_vs_dirty(s); gen_set_label(over); @@ -3620,8 +3620,8 @@ static bool trans_vcompress_vm(DisasContext *s, arg_r= *a) data =3D FIELD_DP32(data, VDATA, VTA, s->vta); tcg_gen_gvec_4_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), vreg_ofs(s, a->rs1), vreg_ofs(s, a->rs2), - tcg_env, s->cfg_ptr->vlen / 8, - s->cfg_ptr->vlen / 8, data, + tcg_env, s->cfg_ptr->vlenb, + s->cfg_ptr->vlenb, data, fns[s->sew]); mark_vs_dirty(s); gen_set_label(over); @@ -3641,7 +3641,7 @@ static bool trans_##NAME(DisasContext *s, arg_##NAME = * a) \ vext_check_isa_ill(s) && \ QEMU_IS_ALIGNED(a->rd, LEN) && \ QEMU_IS_ALIGNED(a->rs2, LEN)) { \ - uint32_t maxsz =3D (s->cfg_ptr->vlen >> 3) * LEN; \ + uint32_t maxsz =3D s->cfg_ptr->vlenb * LEN; \ if (s->vstart_eq_zero) { \ tcg_gen_gvec_mov(s->sew, vreg_ofs(s, a->rd), \ vreg_ofs(s, a->rs2), maxsz, maxsz); \ @@ -3723,8 +3723,8 @@ static bool int_ext_op(DisasContext *s, arg_rmr *a, u= int8_t seq) =20 tcg_gen_gvec_3_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), vreg_ofs(s, a->rs2), tcg_env, - s->cfg_ptr->vlen / 8, - s->cfg_ptr->vlen / 8, data, fn); + s->cfg_ptr->vlenb, + s->cfg_ptr->vlenb, data, fn); =20 mark_vs_dirty(s); gen_set_label(over); --=20 2.43.0 From nobody Tue Nov 26 18:47:10 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=1705357677; cv=none; d=zohomail.com; s=zohoarc; b=Jo2gK+2i6HmSDLRzc0k33BaIOv1oW4L1e+GC/jlaEHo2/nnLO4K9Fb4He4iEVKdgyiMzR7awPULAhvVC7F37tmAA1ommFylrYOrpVdGhHj/kGdmIYWs3w/CyCbgA+qaEk0ULklyUEPatuWeyDp0xD/aM0lTzwGLM/5qZWzL6xbw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705357677; 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=udL8itZxAYolT0n7RG5zjbv51JaVnR8dYZboAfLTPv0=; b=Kzq1lxCT5MLGrRKnCyukOR9RmJ1H+QnUe7VZ28oC4IPJ8/Grb9zrhOmbqIGjDGPVFlF5WM14ezVyLbaGfoLUpll3WJs1LxtoNy8GHzmDjs57naT2yZYzOPgq1FVvfPTbM257mboFshZWg6/g6140rwylyF7gWaVMg1uGAX7cHlQ= 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 1705357677755794.2235689437549; Mon, 15 Jan 2024 14:27:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rPVP5-0000aj-JM; Mon, 15 Jan 2024 17:25:59 -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 1rPVP3-0000Zz-Tj for qemu-devel@nongnu.org; Mon, 15 Jan 2024 17:25:57 -0500 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rPVP2-000652-9G for qemu-devel@nongnu.org; Mon, 15 Jan 2024 17:25:57 -0500 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6da4a923b1bso4602935b3a.2 for ; Mon, 15 Jan 2024 14:25:55 -0800 (PST) Received: from grind.. ([152.234.123.64]) by smtp.gmail.com with ESMTPSA id ks19-20020a056a004b9300b006d977f70cd5sm8125940pfb.23.2024.01.15.14.25.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 14:25:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1705357554; x=1705962354; 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=udL8itZxAYolT0n7RG5zjbv51JaVnR8dYZboAfLTPv0=; b=Wo+LsM00/xH1LuoPtTZ7YsxTskID7epEIuFBM4fJU09KdQHgUJCNSBEJ1AYy+CmzOH cLxM3oSiMjmMoJGP5pEKqsx7Zf+t48MYHIBwffaJgN1WnJOuGrG5VdOAZH/+39epJU+h tA4XYFTqTeA7WZ7V1H2PXS98aL7EX1saAq9zVuwdPknrscjFDXizjvY0iCVk1q/mpgyl gOXBYxIjKcqHEHK19kvNus7/aHQ2DO7gE6lgKHBHNbpIrMXimPMJF36xa+VNdrQnYzm6 i6vvTgXISiVVF8Lcrh2qpFp75MtoPCBgAi7saD+YVLu0/IvSSolq0vmbP9yD+iQ9KXsQ v3Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705357554; x=1705962354; 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=udL8itZxAYolT0n7RG5zjbv51JaVnR8dYZboAfLTPv0=; b=HeF75lwidZrMEDBTD0/dIRJzsyjEgzYnu/b+KViojBe5ksnRmqNwoaMLycYLT6Ko39 lqeKFmbVTlod47LyvwXw+MCMnev9QGr3U8oj78aIXy8jUXqedpWud0EzMiKixUzQUz3+ st+h/socHQWJDV5fuIVEwT62JjwmSxLgYDXnB80pPPH0N33Qt2YTGrujxmZrkLjGLn4j kGDppnrUYs8/6tMiFHyBred2xZhTmxEI4M4+5BXnneD3K4XjObJSdqcjEig+6w3G2dLl sQY50ocXrjK8IPgoTom83QRj6rlFfGfmaiMUB5s/6Kk1omMzdrNCCR8YX3Lro4tiCbuZ Y+bA== X-Gm-Message-State: AOJu0YzdTfdGliyRGMxn/F5f8VVfUi2eL4crFLmruUfk2TfJnTLR3sGX ZCnVbfpnVCd1GmYcd+DO0sZJgPJ5zFNSyWSahAJs0fYyBfm0+Q== X-Google-Smtp-Source: AGHT+IFFtw30H1jJc7aYltZvjhEHlxJMSZiBgu470ioiw/uxOqV5IHH3QoGkkBVPwgCow+f4fNLw0w== X-Received: by 2002:a62:5b83:0:b0:6db:7047:5dff with SMTP id p125-20020a625b83000000b006db70475dffmr1374796pfb.44.1705357554325; Mon, 15 Jan 2024 14:25:54 -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 v2 06/12] target/riscv/insn_trans/trans_rvvk.c.inc: use 'vlenb' Date: Mon, 15 Jan 2024 19:25:22 -0300 Message-ID: <20240115222528.257342-7-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240115222528.257342-1-dbarboza@ventanamicro.com> References: <20240115222528.257342-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::42b; envelope-from=dbarboza@ventanamicro.com; helo=mail-pf1-x42b.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1705357678822100011 Content-Type: text/plain; charset="utf-8" Use s->cfg_ptr->vlenb instead of s->cfg_ptr->vlen / 8. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Richard Henderson --- target/riscv/insn_trans/trans_rvvk.c.inc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/target/riscv/insn_trans/trans_rvvk.c.inc b/target/riscv/insn_t= rans/trans_rvvk.c.inc index 3801c16829..a5cdd1b67f 100644 --- a/target/riscv/insn_trans/trans_rvvk.c.inc +++ b/target/riscv/insn_trans/trans_rvvk.c.inc @@ -174,7 +174,7 @@ GEN_OPIVX_GVEC_TRANS_CHECK(vandn_vx, andcs, zvkb_vx_che= ck) data =3D FIELD_DP32(data, VDATA, VMA, s->vma); = \ tcg_gen_gvec_3_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), = \ vreg_ofs(s, a->rs2), tcg_env, = \ - s->cfg_ptr->vlen / 8, s->cfg_ptr->vlen / 8,= \ + s->cfg_ptr->vlenb, s->cfg_ptr->vlenb, = \ data, fns[s->sew]); = \ mark_vs_dirty(s); = \ gen_set_label(over); = \ @@ -267,7 +267,7 @@ GEN_OPIVI_WIDEN_TRANS(vwsll_vi, IMM_ZX, vwsll_vx, vwsll= _vx_check) rd_v =3D tcg_temp_new_ptr(); = \ rs2_v =3D tcg_temp_new_ptr(); = \ desc =3D tcg_constant_i32( = \ - simd_desc(s->cfg_ptr->vlen / 8, s->cfg_ptr->vlen / 8, data= )); \ + simd_desc(s->cfg_ptr->vlenb, s->cfg_ptr->vlenb, data)); = \ tcg_gen_addi_ptr(rd_v, tcg_env, vreg_ofs(s, a->rd)); = \ tcg_gen_addi_ptr(rs2_v, tcg_env, vreg_ofs(s, a->rs2)); = \ gen_helper_##NAME(rd_v, rs2_v, tcg_env, desc); = \ @@ -345,7 +345,7 @@ GEN_V_UNMASKED_TRANS(vaesem_vs, vaes_check_vs, ZVKNED_E= GS) rs2_v =3D tcg_temp_new_ptr(); = \ uimm_v =3D tcg_constant_i32(a->rs1); = \ desc =3D tcg_constant_i32( = \ - simd_desc(s->cfg_ptr->vlen / 8, s->cfg_ptr->vlen / 8, data= )); \ + simd_desc(s->cfg_ptr->vlenb, s->cfg_ptr->vlenb, data)); = \ tcg_gen_addi_ptr(rd_v, tcg_env, vreg_ofs(s, a->rd)); = \ tcg_gen_addi_ptr(rs2_v, tcg_env, vreg_ofs(s, a->rs2)); = \ gen_helper_##NAME(rd_v, rs2_v, uimm_v, tcg_env, desc); = \ @@ -413,7 +413,7 @@ GEN_VI_UNMASKED_TRANS(vaeskf2_vi, vaeskf2_check, ZVKNED= _EGS) = \ tcg_gen_gvec_3_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, a->rs1), = \ vreg_ofs(s, a->rs2), tcg_env, = \ - s->cfg_ptr->vlen / 8, s->cfg_ptr->vlen / 8,= \ + s->cfg_ptr->vlenb, s->cfg_ptr->vlenb, = \ data, gen_helper_##NAME); = \ = \ mark_vs_dirty(s); = \ @@ -466,8 +466,8 @@ static bool trans_vsha2cl_vv(DisasContext *s, arg_rmrr = *a) data =3D FIELD_DP32(data, VDATA, VMA, s->vma); =20 tcg_gen_gvec_3_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, a->rs1), - vreg_ofs(s, a->rs2), tcg_env, s->cfg_ptr->vlen / 8, - s->cfg_ptr->vlen / 8, data, + vreg_ofs(s, a->rs2), tcg_env, s->cfg_ptr->vlenb, + s->cfg_ptr->vlenb, data, s->sew =3D=3D MO_32 ? gen_helper_vsha2cl32_vv : gen_helper_vsha2cl64_vv); =20 @@ -500,8 +500,8 @@ static bool trans_vsha2ch_vv(DisasContext *s, arg_rmrr = *a) data =3D FIELD_DP32(data, VDATA, VMA, s->vma); =20 tcg_gen_gvec_3_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, a->rs1), - vreg_ofs(s, a->rs2), tcg_env, s->cfg_ptr->vlen / 8, - s->cfg_ptr->vlen / 8, data, + vreg_ofs(s, a->rs2), tcg_env, s->cfg_ptr->vlenb, + s->cfg_ptr->vlenb, data, s->sew =3D=3D MO_32 ? gen_helper_vsha2ch32_vv : gen_helper_vsha2ch64_vv); =20 --=20 2.43.0 From nobody Tue Nov 26 18:47:10 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=1705357675; cv=none; d=zohomail.com; s=zohoarc; b=kLVEN0qQsS1/OP5qsQnXZfRhVPBcjeIyQesL4fxMSL2K0GNYUUtqGQWmL/Rzv/UM5mMQAfEXUrFBgtvvMsewM2lJQhoczElk4j5lvf+/uTDzgs4oCIvM6tnqfwQB/2AjPjEACNt0ycTNdcSHXr8uT1flwksYeV9kX+ZL0NA1Lpg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705357675; 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=c/bYy377eBAB8ujfxwt+DVHep63OPHeK0P6n1e/iX68=; b=OHv83FubY1JAXYkT8nV69VXcMihiYERjf9I9E2UlEzFlCyyoHoZ+SDyCCFRLHCSxAOcL1WNdvdr7hzJRAgY7q9myt+/t3P5kFWRUgZ++BA1EZZEh33euUKSM91UAgNYQ78dL42RDVFMjdpe4fZQBWPHGRF8XWAQCHHqlSzTCxo4= 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 1705357675188748.5598479223819; Mon, 15 Jan 2024 14:27:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rPVP8-0000cQ-HK; Mon, 15 Jan 2024 17:26:02 -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 1rPVP6-0000bD-Nz for qemu-devel@nongnu.org; Mon, 15 Jan 2024 17:26:00 -0500 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rPVP5-00065q-3c for qemu-devel@nongnu.org; Mon, 15 Jan 2024 17:26:00 -0500 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6d9af1f12d5so8001545b3a.3 for ; Mon, 15 Jan 2024 14:25:58 -0800 (PST) Received: from grind.. ([152.234.123.64]) by smtp.gmail.com with ESMTPSA id ks19-20020a056a004b9300b006d977f70cd5sm8125940pfb.23.2024.01.15.14.25.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 14:25:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1705357557; x=1705962357; 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=c/bYy377eBAB8ujfxwt+DVHep63OPHeK0P6n1e/iX68=; b=Vav3GmjRgkXJwSaWLudvPqAKXJjdFE/fIOl/nJyKNFwEnDycuOnmlgA/SbOJtu/Xsm UzIfJiL4YX0cbF1VSPIT07QoAzZHtaPKMpTjGF3KPr59rW2VPiBLywCgUIsIY6piAfFh ZsIhmNQBU7y/aNAc+r0Q7CncEy5en8Y/gC99icdczitJN7r7bmJtMSVMzxdlhoQKB5HI /Much42Um4A3aiC7vPWmDVzQgDdHqCZ4uSF4+csPfQpNe5abtDd/7j9v9Wl1gZwm8Y/F +QhQBdSqozPGwag9gF0ItV/RzH88qSVHgTgrCoooS+XwxLtS4XBImnVEAkQ1mMyKuE0a NXeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705357557; x=1705962357; 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=c/bYy377eBAB8ujfxwt+DVHep63OPHeK0P6n1e/iX68=; b=X0QnDjhDWysbV+A6GpXgevObdmkMDXwE4GlrSqP8H3td50XJcBIwCDEiR/PdOFLI7g uWbx/T1B0LXdnf4Dn8xXoVrG+x+nRxbGAek38RpwTHNKx+MLfbKstP8EUE16qtZr5gQQ AGCEaeiotKTER4ZsOW3gEOd8maZpUFCKkenoLRSfKkG8doduATjX8k6KOQFnemdsP865 hwcCR2dfFuy8/bs10zdtyq/Yr23Hs4TmGfH7BQD2BNNDyBhkmFSvyiTOYZDD5Aw9r3/J BXHwleVctsC/TeWrQG6gA0bAJ/p1em3baNC6aN/2xsi3pf7uQDVYLO73ynZMJFyUWfiK fm8A== X-Gm-Message-State: AOJu0YyKPR8JgrGASgyo8UtOcQLSXudlVlsSiGjifyKt9ddGcvqEXA3T SvFK0zINxwpMr8UFHJt17Mmd2VW2Y8rW7NiB+0CBfYNfvz3I7g== X-Google-Smtp-Source: AGHT+IHWwmlI0tVD1ma1PegEUkdASS4ig7dU46xONvvsVTHZGy4SJo3N6Os3aT26BjiJ+aBw+8qOwg== X-Received: by 2002:a05:6a21:9207:b0:19a:fb32:2009 with SMTP id tl7-20020a056a21920700b0019afb322009mr3069499pzb.89.1705357557515; Mon, 15 Jan 2024 14:25:57 -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 v2 07/12] target/riscv/vector_helper.c: use 'vlenb' Date: Mon, 15 Jan 2024 19:25:23 -0300 Message-ID: <20240115222528.257342-8-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240115222528.257342-1-dbarboza@ventanamicro.com> References: <20240115222528.257342-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::429; envelope-from=dbarboza@ventanamicro.com; helo=mail-pf1-x429.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1705357676818100007 Content-Type: text/plain; charset="utf-8" Use 'cpu->cfg.vlenb' instead of 'cpu->cfg.vlen >> 3'. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Richard Henderson --- target/riscv/vector_helper.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c index c1c3a4d1ea..cb944229b0 100644 --- a/target/riscv/vector_helper.c +++ b/target/riscv/vector_helper.c @@ -558,7 +558,7 @@ vext_ldst_whole(void *vd, target_ulong base, CPURISCVSt= ate *env, uint32_t desc, { uint32_t i, k, off, pos; uint32_t nf =3D vext_nf(desc); - uint32_t vlenb =3D riscv_cpu_cfg(env)->vlen >> 3; + uint32_t vlenb =3D riscv_cpu_cfg(env)->vlenb; uint32_t max_elems =3D vlenb >> log2_esz; =20 k =3D env->vstart / max_elems; @@ -929,7 +929,7 @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, void *= vs2, \ { \ uint32_t vl =3D env->vl; \ uint32_t vm =3D vext_vm(desc); \ - uint32_t total_elems =3D riscv_cpu_cfg(env)->vlen; \ + uint32_t total_elems =3D riscv_cpu_cfg(env)->vlenb << 3; \ uint32_t vta_all_1s =3D vext_vta_all_1s(desc); \ uint32_t i; \ \ @@ -967,7 +967,7 @@ void HELPER(NAME)(void *vd, void *v0, target_ulong s1, = \ { \ uint32_t vl =3D env->vl; \ uint32_t vm =3D vext_vm(desc); \ - uint32_t total_elems =3D riscv_cpu_cfg(env)->vlen; \ + uint32_t total_elems =3D riscv_cpu_cfg(env)->vlenb << 3; \ uint32_t vta_all_1s =3D vext_vta_all_1s(desc); \ uint32_t i; \ \ @@ -1171,7 +1171,7 @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, void= *vs2, \ { \ uint32_t vm =3D vext_vm(desc); \ uint32_t vl =3D env->vl; \ - uint32_t total_elems =3D riscv_cpu_cfg(env)->vlen; \ + uint32_t total_elems =3D riscv_cpu_cfg(env)->vlenb << 3; \ uint32_t vta_all_1s =3D vext_vta_all_1s(desc); \ uint32_t vma =3D vext_vma(desc); \ uint32_t i; \ @@ -1236,7 +1236,7 @@ void HELPER(NAME)(void *vd, void *v0, target_ulong s1= , void *vs2, \ { \ uint32_t vm =3D vext_vm(desc); \ uint32_t vl =3D env->vl; \ - uint32_t total_elems =3D riscv_cpu_cfg(env)->vlen; \ + uint32_t total_elems =3D riscv_cpu_cfg(env)->vlenb << 3; \ uint32_t vta_all_1s =3D vext_vta_all_1s(desc); \ uint32_t vma =3D vext_vma(desc); \ uint32_t i; \ @@ -3971,7 +3971,7 @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, void= *vs2, \ { \ uint32_t vm =3D vext_vm(desc); \ uint32_t vl =3D env->vl; \ - uint32_t total_elems =3D riscv_cpu_cfg(env)->vlen; \ + uint32_t total_elems =3D riscv_cpu_cfg(env)->vlenb << 3; \ uint32_t vta_all_1s =3D vext_vta_all_1s(desc); \ uint32_t vma =3D vext_vma(desc); \ uint32_t i; \ @@ -4011,7 +4011,7 @@ void HELPER(NAME)(void *vd, void *v0, uint64_t s1, vo= id *vs2, \ { \ uint32_t vm =3D vext_vm(desc); \ uint32_t vl =3D env->vl; \ - uint32_t total_elems =3D riscv_cpu_cfg(env)->vlen; \ + uint32_t total_elems =3D riscv_cpu_cfg(env)->vlenb << 3; \ uint32_t vta_all_1s =3D vext_vta_all_1s(desc); \ uint32_t vma =3D vext_vma(desc); \ uint32_t i; \ @@ -4528,7 +4528,7 @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, = \ uint32_t desc) \ { \ uint32_t vl =3D env->vl; \ - uint32_t total_elems =3D riscv_cpu_cfg(env)->vlen; \ + uint32_t total_elems =3D riscv_cpu_cfg(env)->vlenb << 3;\ uint32_t vta_all_1s =3D vext_vta_all_1s(desc); \ uint32_t i; \ int a, b; \ @@ -4615,7 +4615,7 @@ static void vmsetm(void *vd, void *v0, void *vs2, CPU= RISCVState *env, { uint32_t vm =3D vext_vm(desc); uint32_t vl =3D env->vl; - uint32_t total_elems =3D riscv_cpu_cfg(env)->vlen; + uint32_t total_elems =3D riscv_cpu_cfg(env)->vlenb << 3; uint32_t vta_all_1s =3D vext_vta_all_1s(desc); uint32_t vma =3D vext_vma(desc); int i; --=20 2.43.0 From nobody Tue Nov 26 18:47:10 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=1705357673; cv=none; d=zohomail.com; s=zohoarc; b=MUiJSU7DjpXbHCB4/KILbKJcB+u0LxqQizr6zhWxSNgrOKqYfSinzIirk58faKPU1P9+U5qHLb9aSOM07wE9JelPvJI7ivKfz+gjSfU4mhN7Q/MYPhESYIcI7MVKga8de8G5VM+/UqqeBgQXKI55gLtV1sQLtzPVD9qGfHZrW7Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705357673; 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=rX044LrlQrH26fjBGEvI/gb8sPqL+hsQy6kx82uHSvw=; b=EYUWVt2PLb9d5Dew9viZ22UmKbM/Lw1115ouf+HhvqCHjhZmgTzRZmxPa3I8iQnZOOqe2hQXgxzd8iKu7puu7uKKexO9OuGVQx24AW+6V+6pNeYbN1pE9ubaw/nLtk7HfiMXW3HmJ8GDJcyDb4M4Y04JtHmOHsjzzThux78IjBU= 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 1705357673971712.8679987053329; Mon, 15 Jan 2024 14:27:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rPVPA-0000dC-MU; Mon, 15 Jan 2024 17:26:04 -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 1rPVP9-0000cg-N5 for qemu-devel@nongnu.org; Mon, 15 Jan 2024 17:26:03 -0500 Received: from mail-oi1-x233.google.com ([2607:f8b0:4864:20::233]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rPVP8-00066T-82 for qemu-devel@nongnu.org; Mon, 15 Jan 2024 17:26:03 -0500 Received: by mail-oi1-x233.google.com with SMTP id 5614622812f47-3bd6581bca0so1707031b6e.0 for ; Mon, 15 Jan 2024 14:26:01 -0800 (PST) Received: from grind.. ([152.234.123.64]) by smtp.gmail.com with ESMTPSA id ks19-20020a056a004b9300b006d977f70cd5sm8125940pfb.23.2024.01.15.14.25.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 14:26:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1705357560; x=1705962360; 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=rX044LrlQrH26fjBGEvI/gb8sPqL+hsQy6kx82uHSvw=; b=LbDLmuzer0p7jGUQvzlO6GIcFjMuZxwydItO0Ecw1iiIWK8fge4RNSegf0Kcl+DDfe W+ZPWuy+r3tjUmSTP0GQjs/fXA8umyxnmxNumXf1QUn45LmMWKISSSSkNUq+OXxpR80p UycX/1wiDoIgOKjaxVDW+shcjqvUDISFn7fm8hlIF4t5+6G5X+kn78yMs1tXLdzg4Yvn 1zNaIK6LRZYBEwIPB5eZDNg3a5pGleNXHaHkmkrDiGqvLgwUZ9v9noS3kfshiRQ8RzfB 6bdjI/oSIpL8mn4tnhZcn4CPUoqP9FrDIcI7ImYBIO/JwRM02ns9gwKaVEhWTCVJrPRZ F2BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705357560; x=1705962360; 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=rX044LrlQrH26fjBGEvI/gb8sPqL+hsQy6kx82uHSvw=; b=l6/zRyKnH3QRJDT0HR1ApcV3Nn+n0gV8Mfm4Ifp8WrxUIyfh9OXmVz1+jac8usDzYT Rbn8zXd6HeUrSYt4dYLDSMj4MwqBAGAH00lHbn77JZLFuvzD4QA/Lkdk5Gw9p8snhcBx C4166PJdrFLQJ2aORaNM2l1zLhmjupJTfx8aW2C+8nt4i1nHMPgN2Or6IAr7vCMmRbnJ levm/BvLvp15Ake6V3+ho3kqWhLqOOjYzb8iYAjOwC/uwVmB/7KiOC4gu+OBs+oplnUo eFTocAg78AX4vgH/giNiSmXjMK2BDQO+MNfxx/ub0Zhq8Vic9HATH3WhmyOzJGPfWcPx 811Q== X-Gm-Message-State: AOJu0YxEcbaiaUBhau6bwN+6TmzcxSCEPRreTBjfsFchQ10ZMd+mozQE P8uk5t+tEWW/0d4hYKqNr5yZt0KLESEwK8eecT/sWNjwOzJfDA== X-Google-Smtp-Source: AGHT+IELmtx4XXKQw7Vi5ZbQuHagT5cBG9u+Fcyidou4860BGqW6Un/rJhQPDwaTv+LmMufy7kTPTQ== X-Received: by 2002:a05:6808:179f:b0:3bd:3e96:a8ab with SMTP id bg31-20020a056808179f00b003bd3e96a8abmr6803852oib.53.1705357560749; Mon, 15 Jan 2024 14:26:00 -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 v2 08/12] target/riscv/vector_helper.c: use vlenb in HELPER(vsetvl) Date: Mon, 15 Jan 2024 19:25:24 -0300 Message-ID: <20240115222528.257342-9-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240115222528.257342-1-dbarboza@ventanamicro.com> References: <20240115222528.257342-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::233; envelope-from=dbarboza@ventanamicro.com; helo=mail-oi1-x233.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1705357674846100001 Content-Type: text/plain; charset="utf-8" Use the new 'vlenb' CPU config to validate fractional LMUL. The original comparison is done with 'vlen' and 'sew', both in bits. Adjust the shift to use vlenb. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Richard Henderson --- target/riscv/vector_helper.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c index cb944229b0..9e3ae4b5d3 100644 --- a/target/riscv/vector_helper.c +++ b/target/riscv/vector_helper.c @@ -45,9 +45,13 @@ target_ulong HELPER(vsetvl)(CPURISCVState *env, target_u= long s1, xlen - 1 - R_VTYPE_RESERVED_SH= IFT); =20 if (lmul & 4) { - /* Fractional LMUL - check LMUL * VLEN >=3D SEW */ + /* + * Fractional LMUL: check VLEN * LMUL >=3D SEW, + * or VLEN * (8 - lmul) >=3D SEW. Using VLENB we + * need 3 less shifts rights. + */ if (lmul =3D=3D 4 || - cpu->cfg.vlen >> (8 - lmul) < sew) { + cpu->cfg.vlenb >> (8 - 3 - lmul) < sew) { vill =3D true; } } --=20 2.43.0 From nobody Tue Nov 26 18:47:10 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=1705357724; cv=none; d=zohomail.com; s=zohoarc; b=lx+G3y7YmuMCt2haW/EaJrwgf1hntFTQMxUj3q3Y06kO74FpeSvrJ/8xtRrSgZy/UT48sGRZUy9tl0znh45aTlwbb5nSBBE3sRCbgfWLuDs98xeM4jIunxIwXm8w6uxGDRMw+tf0xbYmGPAPgXhYhjeEBK6a7xuois419Uwee7Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705357724; 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=MWHeHV4OEo1q9eMddE57J21tzGp1rowPk1kJmzHf7hA=; b=XpXh1OdAHm87ePreCq/QWtAHuWtJ4CnX9VMi1zQvV5BlQe7HrzIiFw0xJLOCUlj9jDZvJo5rvxYjFbh+zrDK8kWjbgNtSdGsyQaDQ0d7kWxFNApAcmUjtx79rnLB12N2+oJJFPtIbRqZGgAGE1Ep6/wcbOxzg6Bv2w8BoTYT9Es= 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 1705357724320421.85829187453487; Mon, 15 Jan 2024 14:28:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rPVPE-0000j7-Gy; Mon, 15 Jan 2024 17:26:08 -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 1rPVPD-0000h1-OZ for qemu-devel@nongnu.org; Mon, 15 Jan 2024 17:26:07 -0500 Received: from mail-oi1-x22e.google.com ([2607:f8b0:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rPVPB-000676-NJ for qemu-devel@nongnu.org; Mon, 15 Jan 2024 17:26:07 -0500 Received: by mail-oi1-x22e.google.com with SMTP id 5614622812f47-3bd7c15a745so927979b6e.2 for ; Mon, 15 Jan 2024 14:26:05 -0800 (PST) Received: from grind.. ([152.234.123.64]) by smtp.gmail.com with ESMTPSA id ks19-20020a056a004b9300b006d977f70cd5sm8125940pfb.23.2024.01.15.14.26.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 14:26:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1705357564; x=1705962364; 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=MWHeHV4OEo1q9eMddE57J21tzGp1rowPk1kJmzHf7hA=; b=MY6hUzKy9+VxM7KrQuRWWCCJXH+8lMlNj3mE2lydrqikejPL0vtTKLEU5ufCpSIEvp nUMfsmlPzHiTuS7Y/Q/YEmJByg5NoECgt8R6qekuQAWNePOuJ9x3SyAsZhECnCe+TurY vBsxhcpwhs5nD3V6jx2GDnNefN9WwJihs0KLM4vRtVvZNaPGl4hrEmcX1ialSYCx4MYL 6ZpqrztIpF+rNVsbo6WbO9S+tIT4+uPhI5YcNJXoNB/FPzo0f+xwoG6WXK2uZ07TjVGk iUQDstPc8IfvksLX+1Pn+5Nwt2Vw6rqleBqumtLYYzr/beSS96MbQP1E9J1hUL5ggXiL vYMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705357564; x=1705962364; 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=MWHeHV4OEo1q9eMddE57J21tzGp1rowPk1kJmzHf7hA=; b=dfEu9+gEtj3Dsr+EJ2VHLLxJX5XoAEXsNvxY2XvjbIwWEucNjRx9eCuaIw9a6pYP5Q N73lk/djfTL6toE3vi5315AYSYp53rbUyHqIW22MifpvwTDBFbxurx29gLZUKTJFY2FF xE7L+btrMxWaM67Hm7pfcNwBjFs/FwOJ3dq348rqQmbup8Op4eySsmaw5q07SAMRPphV bDrIeXPGv3MANVtSzAKp0UPQ1AAC+OPocbW08FTQCYB3UHYStHlzbbGnR+BevUYo8RGw tOdxONUth0m+52izHS93vXI/7Y56PEjPmS97v4TDKoflghbTVZJM+K5MxR4UDgtguaA6 krAQ== X-Gm-Message-State: AOJu0YwuFvXZVnat93xdwnf8MZ+WeFS6tTwLFa7tEDUQsBqOnPVB+Bo2 fD/T8bLJIHBH7AiZUoyloruu1fKj/aqqmgHlrhlE0ATbghe9Cg== X-Google-Smtp-Source: AGHT+IEGdJgc9ja1YZyF5ojj0Trd8JIRYj/XLhDl5SjeUXNIS6UWh2Vg/2yB2dLImkdaBg+dLr5l3w== X-Received: by 2002:a05:6808:1a09:b0:3bd:5fb3:7f5c with SMTP id bk9-20020a0568081a0900b003bd5fb37f5cmr7882913oib.89.1705357563938; Mon, 15 Jan 2024 14:26:03 -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 v2 09/12] target/riscv/cpu.h: use 'vlenb' in vext_get_vlmax() Date: Mon, 15 Jan 2024 19:25:25 -0300 Message-ID: <20240115222528.257342-10-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240115222528.257342-1-dbarboza@ventanamicro.com> References: <20240115222528.257342-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::22e; envelope-from=dbarboza@ventanamicro.com; helo=mail-oi1-x22e.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1705357725077100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Daniel Henrique Barboza Reviewed-by: Richard Henderson --- target/riscv/cpu.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 11df226a00..7304e478c2 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -692,7 +692,11 @@ static inline uint32_t vext_get_vlmax(RISCVCPU *cpu, t= arget_ulong vtype) { uint8_t sew =3D FIELD_EX64(vtype, VTYPE, VSEW); int8_t lmul =3D sextract32(FIELD_EX64(vtype, VTYPE, VLMUL), 0, 3); - return cpu->cfg.vlen >> (sew + 3 - lmul); + /* + * vlmax =3D vlen >> (sew + 3 - lmul). With vlenb, + * 3 less shifts: vlenb >> (sew + 3 - 3 - lmul) + */ + return cpu->cfg.vlenb >> (sew - lmul); } =20 void cpu_get_tb_cpu_state(CPURISCVState *env, vaddr *pc, --=20 2.43.0 From nobody Tue Nov 26 18:47:10 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=1705357749; cv=none; d=zohomail.com; s=zohoarc; b=StTP+jqoDjy0rCPs/kni933V/j6y6rY1fFI8quEb0V9QgOzW/cncSb1yT9Dh4lAM+UPgOGWcTwH21OL61ked1NG4EEeirD+8r1a059kTLk5X0R/CYfrIXNmEEZi5gEMUZFkwk/AIKqMtNwbVgt0yJ5C0e2EIlYXcubCXaiIXMBo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705357749; 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=jgocnB++hOS9pjEL1cmxh6V/YOdSt8orkQh5dhnvCxw=; b=KtJzCcpo3LHVpqbCQQ92NYNuuF8k+aj7FBMTEZEvYYb9d/jZudNwQQofijlZhcc6Nz1gngIITryHyIHGinIHSzlhALtBG3w8VEfahKXhu6DABVSpop1t3LQnYJIcuT+1/hagyqFWyTnIzT9CcFvyaL1UvuiQWhfkurHa2+hvNyo= 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 1705357749068780.1183270214676; Mon, 15 Jan 2024 14:29:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rPVPI-0000pm-B0; Mon, 15 Jan 2024 17:26:12 -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 1rPVPG-0000ob-Lv for qemu-devel@nongnu.org; Mon, 15 Jan 2024 17:26:10 -0500 Received: from mail-oi1-x236.google.com ([2607:f8b0:4864:20::236]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rPVPF-00067p-5p for qemu-devel@nongnu.org; Mon, 15 Jan 2024 17:26:10 -0500 Received: by mail-oi1-x236.google.com with SMTP id 5614622812f47-3bd6581bca0so1707079b6e.0 for ; Mon, 15 Jan 2024 14:26:08 -0800 (PST) Received: from grind.. ([152.234.123.64]) by smtp.gmail.com with ESMTPSA id ks19-20020a056a004b9300b006d977f70cd5sm8125940pfb.23.2024.01.15.14.26.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 14:26:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1705357567; x=1705962367; 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=jgocnB++hOS9pjEL1cmxh6V/YOdSt8orkQh5dhnvCxw=; b=FCzAMwffgpWf4Ym1wre+TiRkIenpe1qWvPAov5U3IbTzY9u+uc6ZKZ2Fv8Va3hp6/C RxghgmvH3B2+tT0hgIAtd1J2ybLnAEbWQSFev1RDg+HuRVjsRyzQ38+EJ2zPATmy6QNw 7ZelnVe2YtOAMezWQXkO6A8TuyZaavfrJ/epNo77huSFuHz7qR7Fnhp6bZdvddxZQebZ OZ9AIPN6/tkDFCOr3Yxcq1c5IfXC3PcpJyXmGEZw35PGmGnxOkxrpsRvOM6cBRTMiDlB +C1uc3E+g5xaVO080nSeTelqc/+OHpdercJEAAO5TDllmSSlvmv/YpJA5dFIvtJsZt47 LOXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705357567; x=1705962367; 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=jgocnB++hOS9pjEL1cmxh6V/YOdSt8orkQh5dhnvCxw=; b=GgZS4dfky9y7AtxeCC0Z5EcIHfsKlJsCN2ZxS6AzogZzhrJ0RB+5/EgOZbwQ31ptpF GUh9dpjUDPtNWVkpNi8QviTCGkeZzdVoX9UvvXCD6Liu7dFZnDTpMkaPhEgBqD8S0Ura 1jA/maWcdkjuer4B2jazTV6atfXIUznHeGFK8mWH3vyTgEktXCcrJvmB+24wJA2tIos0 b+FkhjVyyKSKHRld7twAwA3hhWwAQr7efdd+80xxFWWIy0fpxxRMzXfIAWHkLHJp08s2 z56sH8yWdHiXTkdHe3suww/CiTKt5MxYZ16Nrtto8Y02y+B+WcD+fsBIMEEjKtMDliI9 4jng== X-Gm-Message-State: AOJu0YxXLgoNfgPjVKXrgzKbPBevRGKIr9YAUNKQ0hDt3xTU90O/Ll12 sXUwwG6gyvfBAibRvJBj7IYWWGFBkVuAqAaVbtrGxaOIYSqcTg== X-Google-Smtp-Source: AGHT+IHN4uXcoOeeX6dmDXK1c299Z9B3xOVmCeXOi343wRJ2tXjmE965lVNO+tF8Fm13UkOaw1Sdkw== X-Received: by 2002:a05:6808:3848:b0:3bd:6eaf:6f67 with SMTP id ej8-20020a056808384800b003bd6eaf6f67mr6359464oib.113.1705357567308; Mon, 15 Jan 2024 14:26:07 -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 v2 10/12] target/riscv/insn_trans/trans_rvv.c.inc: use 'vlenb' in MAXSZ() Date: Mon, 15 Jan 2024 19:25:26 -0300 Message-ID: <20240115222528.257342-11-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240115222528.257342-1-dbarboza@ventanamicro.com> References: <20240115222528.257342-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::236; envelope-from=dbarboza@ventanamicro.com; helo=mail-oi1-x236.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1705357751167100003 Content-Type: text/plain; charset="utf-8" Calculate the maximum vector size possible, 'max_sz', which is the size in bytes 'vlenb' multiplied by the max value of LMUL (LMUL =3D 8, when s->lmul =3D 3). 'max_sz' is then shifted right by 'scale', expressed as '3 - s->lmul', which is clearer than doing 'scale =3D lmul - 3' and then using '-scale' in the shift right. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Richard Henderson --- target/riscv/insn_trans/trans_rvv.c.inc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_tr= ans/trans_rvv.c.inc index d743675262..b4663b6e1f 100644 --- a/target/riscv/insn_trans/trans_rvv.c.inc +++ b/target/riscv/insn_trans/trans_rvv.c.inc @@ -1160,12 +1160,12 @@ GEN_LDST_WHOLE_TRANS(vs8r_v, 8, 1, true) /* * MAXSZ returns the maximum vector size can be operated in bytes, * which is used in GVEC IR when vl_eq_vlmax flag is set to true - * to accerlate vector operation. + * to accelerate vector operation. */ static inline uint32_t MAXSZ(DisasContext *s) { - int scale =3D s->lmul - 3; - return s->cfg_ptr->vlen >> -scale; + int max_sz =3D s->cfg_ptr->vlenb * 8; + return max_sz >> (3 - s->lmul); } =20 static bool opivv_check(DisasContext *s, arg_rmrr *a) --=20 2.43.0 From nobody Tue Nov 26 18:47:10 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=1705357723; cv=none; d=zohomail.com; s=zohoarc; b=G5EaRv0RlwGzeCHuPgNag5I5FQy+VB9+f3OwNMXPWTc4+IuERkwGdOhwr7xSMv2wSoHIovps0Pv1GyrWzHJy7DFYaAxGQ3YSDaPBPYDQboj7zkRQb0rGauOhilg/A1EEjTaliQlU170WrfSGfhDyxXFVeQ/6RSEVBT4sDDaGTpw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705357723; 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=G3zwnL2bepqEdgfhLqXrSi6UxcmFJJl1qTGSWX8FZUg=; b=V2ZyRrmF6Qykus2YG85m8AnMcaC0g9v7oxtYgBM7+F8P8LJGLsOZc8kRCe2SAD+cRnlepgUYk+88abtbN5z1O1iQlxDmAtrFVMBpdj3QWDntH0z0kdGzphpOAT5RCALO7sVydiUEwf9TTYqdg4rsQJamr57cwLJfaupQ84z/ziI= 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 1705357723964536.9301046750946; Mon, 15 Jan 2024 14:28:43 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rPVPL-0000qu-2Z; Mon, 15 Jan 2024 17:26:15 -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 1rPVPK-0000qQ-1a for qemu-devel@nongnu.org; Mon, 15 Jan 2024 17:26:14 -0500 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rPVPI-00068O-Hj for qemu-devel@nongnu.org; Mon, 15 Jan 2024 17:26:13 -0500 Received: by mail-ot1-x331.google.com with SMTP id 46e09a7af769-6dddba43d70so4525261a34.1 for ; Mon, 15 Jan 2024 14:26:12 -0800 (PST) Received: from grind.. ([152.234.123.64]) by smtp.gmail.com with ESMTPSA id ks19-20020a056a004b9300b006d977f70cd5sm8125940pfb.23.2024.01.15.14.26.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 14:26:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1705357570; x=1705962370; 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=G3zwnL2bepqEdgfhLqXrSi6UxcmFJJl1qTGSWX8FZUg=; b=KIQo/qqvwsoT3h8GBiUZv/IMcygDTapZbsbnhDIzBHP7KXWL0N7c/4kKHLrNabRKhJ HLw4u163Ms4bnw68n9/LpbmLYnHZn68oLE7Y0QY+3jQMzJVdKxHh7d4V4QwXpuzviuT7 GUyEhWCURmO2O6FogS43qlO5LuYifoilmKx+TXu2t3m3KG+XZsB4FAhr72KUSxsR2Nxd W32nvs2gmsk8VLJfhrLe8/5mm+RwjI8TLOS0OfDmbwWAtlY68YOziXAZYUh+r6OGCyk6 yQC13tgZDVAHMuv+yffujySDh5bJl4QQKvYmxg3BVhLiPW17csNrE/+T/l5icwsJgsph SSig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705357570; x=1705962370; 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=G3zwnL2bepqEdgfhLqXrSi6UxcmFJJl1qTGSWX8FZUg=; b=CNJ0C875Upo6uKJgYohsi6OeeBQ0364iw+lJ6OtoUEDzagxV1Y+L9wLmcYmGXwm/ch oa8Utkt2vEiEc3wsEn4Qeq2eaujY/VRdTS8MIuEc5sdFIiYwzvV5ehQb3WZn7irF4dxc uvk7G0fU1wmM2P7NPAnpDgsNj3AeWN2SNnybBF2UHO2P5lQs1ZDf/hjVvwuXmkzW3lc9 vSeS5sBH4KqjjyU1IOh9xYVqih4o4SCdXgaONAjSqTLyBDyD//CgounmGoMsETfgYOrv y3A70MX+f43PMX6R0R5fhBrm/JDIJQISSqtZ72cwtRBYKX4aZes0ra8iXUaOQuTmryEy mqmQ== X-Gm-Message-State: AOJu0YzYPdQAszTovR+CJl251Cfge3RoUVAnESUJZslkh/qjl+3UN/z8 FdNfr1t3hpkWrZ3Zqbp5tH1j4IueM9tGNOk7tPManW7tPTkGwQ== X-Google-Smtp-Source: AGHT+IFuSZSVNc2r+5PefA423niwJsKXk+7c9yBTIF0X6Zk7/9Xzc9vuk10x5kN1Mws+QT8GsPRm1g== X-Received: by 2002:a05:6808:1306:b0:3bd:3a29:63e9 with SMTP id y6-20020a056808130600b003bd3a2963e9mr8293781oiv.27.1705357570733; Mon, 15 Jan 2024 14:26:10 -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 v2 11/12] trans_rvv.c.inc: use 'vlenb' to calc vlmax in trans_vrgather_v*() Date: Mon, 15 Jan 2024 19:25:27 -0300 Message-ID: <20240115222528.257342-12-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240115222528.257342-1-dbarboza@ventanamicro.com> References: <20240115222528.257342-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::331; envelope-from=dbarboza@ventanamicro.com; helo=mail-ot1-x331.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1705357725099100004 Content-Type: text/plain; charset="utf-8" Use the same vext_get_vlmax() logic to retrieve 'vlmax' in trans_vrgather_vi() and trans_vrgather_vx(). Signed-off-by: Daniel Henrique Barboza --- target/riscv/insn_trans/trans_rvv.c.inc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_tr= ans/trans_rvv.c.inc index b4663b6e1f..05c243186d 100644 --- a/target/riscv/insn_trans/trans_rvv.c.inc +++ b/target/riscv/insn_trans/trans_rvv.c.inc @@ -3535,8 +3535,7 @@ static bool trans_vrgather_vx(DisasContext *s, arg_rm= rr *a) } =20 if (a->vm && s->vl_eq_vlmax && !(s->vta && s->lmul < 0)) { - int scale =3D s->lmul - (s->sew + 3); - int vlmax =3D s->cfg_ptr->vlen >> -scale; + int vlmax =3D s->cfg_ptr->vlenb >> (s->sew - s->lmul); TCGv_i64 dest =3D tcg_temp_new_i64(); =20 if (a->rs1 =3D=3D 0) { @@ -3566,8 +3565,7 @@ static bool trans_vrgather_vi(DisasContext *s, arg_rm= rr *a) } =20 if (a->vm && s->vl_eq_vlmax && !(s->vta && s->lmul < 0)) { - int scale =3D s->lmul - (s->sew + 3); - int vlmax =3D s->cfg_ptr->vlen >> -scale; + int vlmax =3D s->cfg_ptr->vlenb >> (s->sew - s->lmul); if (a->rs1 >=3D vlmax) { tcg_gen_gvec_dup_imm(MO_64, vreg_ofs(s, a->rd), MAXSZ(s), MAXSZ(s), 0); --=20 2.43.0 From nobody Tue Nov 26 18:47:10 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=1705357635; cv=none; d=zohomail.com; s=zohoarc; b=CvLl6lrj5T9+p0S/CuA3iamXQ7MPPt4R1BmXdMes5TwR/Uo+vLO4KlNrslZZTlOc6dRrkLP67V3jVQV6PzEChOQDrq3Hw+wQ5+8yff90MNqqNiJ7YMvfIp5BHLADSKAZP23S8AFobDOWxMNRbIIE9SKbgs94bWBpXTK9DkS0cy0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705357635; 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=uTZ9DvaXYMznw+pv5Glto07Sg3ttKbbiQQL6C8QSH3A=; b=DTJZ9lREgKkBeO1dGvm0OYo2EL+C6bfgbiPVkWqck5MbxZbN7GdgctCGUz0vRQ0wjetcJOpnHa+7BkMkGm96+gja9NyvFlizidnqSFd2YEbOtJQ8dIplf4Jg6Xq4wgzdvO6toV4ZStwsyCBVlkV1UNE/1EMK975CS3HvxtpF5Ss= 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 1705357635968711.1840021216539; Mon, 15 Jan 2024 14:27:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rPVPO-0000su-T2; Mon, 15 Jan 2024 17:26:18 -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 1rPVPN-0000rl-EI for qemu-devel@nongnu.org; Mon, 15 Jan 2024 17:26:17 -0500 Received: from mail-oi1-x232.google.com ([2607:f8b0:4864:20::232]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rPVPL-000690-NV for qemu-devel@nongnu.org; Mon, 15 Jan 2024 17:26:17 -0500 Received: by mail-oi1-x232.google.com with SMTP id 5614622812f47-3bd5c4cffefso3491410b6e.1 for ; Mon, 15 Jan 2024 14:26:15 -0800 (PST) Received: from grind.. ([152.234.123.64]) by smtp.gmail.com with ESMTPSA id ks19-20020a056a004b9300b006d977f70cd5sm8125940pfb.23.2024.01.15.14.26.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 14:26:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1705357574; x=1705962374; 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=uTZ9DvaXYMznw+pv5Glto07Sg3ttKbbiQQL6C8QSH3A=; b=oHjUMxhkfW8Xt/Cx4E/5jQSrSZaeULryKOe+eTp7fiamoJ/Sls1ZY5/yCuzQUCGwQm bmapn32IDsmQLdi7zH2TFdPT60yzwQzIJO80ALTqPdh2DlLcE7JaP8E9JAT/7Y2Fh5mT oPLz62JvVOWMUnpkW+1aMUeSWml4ijTDorVZh5qyleqYg5u/AE1CUHtEd6LlU2QVZ3IO s13e6WpF1mV4L8iSRh8zdNCGF7ySlw/NVY8JByGVlzEVkT+BkcsyfSiuajDpFvF5aGAT 5whj+WCPiDI/4RyjSgC18fu6vP3JvqpoHpIttPPdAGJvufJ+9eLnpwEHFg9yAQle68kc 0pvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705357574; x=1705962374; 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=uTZ9DvaXYMznw+pv5Glto07Sg3ttKbbiQQL6C8QSH3A=; b=oskm47j8/ukweE7cyHNHLpcOrYm6V+h5E+OLTJq48+Dw/Go01XBdvhrj1qB9uI2Mx8 FWUNaOYFt6dvIpITNZTHUntY8bKUc+RZUP8E6Ub8mNwCGvUGaw02z79zpknRUcBIO7X9 z93eABJlf48L4eda9wThbWxbGMaSyBHZc5xeT0kBKPTzmuYSiljXEAB5KeeZwbu7d81Q kIP0lP4ey1vyscDATngKV45KpZ6g0GfHJFniv3rnJdANqZ03uJEs2oYLPwvo8BlzGLXS BhI756EXFreRZRc+WLKfqnPct5t4BD5eiSJ0jqOCil97EnlXbc9JJy5OUUh8z42Lylsv dC4w== X-Gm-Message-State: AOJu0Yxp5rPhg3cEvvqM3SVMD2ov20MB2pVuXlD9DAkUdRXqlOk4NRPW 7TsfLTQWsvkfDbN7SC0QC4HfFBqiV9p6kIg7859iTFPjtr2n3w== X-Google-Smtp-Source: AGHT+IGUtjboszdQF0aat3DMfutwYY15LU+v0xEgM/mWVV6nXvY04XWOKuN/qhKu6Ub7/13Enf5xiQ== X-Received: by 2002:a05:6808:188c:b0:3bd:6df0:ee81 with SMTP id bi12-20020a056808188c00b003bd6df0ee81mr4973762oib.63.1705357573910; Mon, 15 Jan 2024 14:26:13 -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 v2 12/12] target/riscv/cpu.c: remove cpu->cfg.vlen Date: Mon, 15 Jan 2024 19:25:28 -0300 Message-ID: <20240115222528.257342-13-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240115222528.257342-1-dbarboza@ventanamicro.com> References: <20240115222528.257342-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::232; envelope-from=dbarboza@ventanamicro.com; helo=mail-oi1-x232.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1705357636765100001 Content-Type: text/plain; charset="utf-8" There is no need to keep both 'vlen' and 'vlenb'. All existing code that requires 'vlen' is retrieving it via 'vlenb << 3'. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Richard Henderson --- target/riscv/cpu.c | 8 +++----- target/riscv/cpu_cfg.h | 1 - target/riscv/tcg/tcg-cpu.c | 4 +++- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index f4261d2ffc..7b3f69d3fb 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1313,7 +1313,6 @@ static void riscv_cpu_init(Object *obj) =20 /* Default values for non-bool cpu properties */ cpu->cfg.pmu_mask =3D MAKE_64BIT_MASK(3, 16); - cpu->cfg.vlen =3D 128; cpu->cfg.vlenb =3D 128 >> 3; cpu->cfg.elen =3D 64; cpu->env.vext_ver =3D VEXT_VERSION_1_00_0; @@ -1802,22 +1801,21 @@ static void prop_vlen_set(Object *obj, Visitor *v, = const char *name, return; } =20 - if (value !=3D cpu->cfg.vlen && riscv_cpu_is_vendor(obj)) { + if (value !=3D cpu->cfg.vlenb && riscv_cpu_is_vendor(obj)) { cpu_set_prop_err(cpu, name, errp); error_append_hint(errp, "Current '%s' val: %u\n", - name, cpu->cfg.vlen); + name, cpu->cfg.vlenb << 3); return; } =20 cpu_option_add_user_setting(name, value); - cpu->cfg.vlen =3D value; cpu->cfg.vlenb =3D value >> 3; } =20 static void prop_vlen_get(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - uint16_t value =3D RISCV_CPU(obj)->cfg.vlen; + uint16_t value =3D RISCV_CPU(obj)->cfg.vlenb << 3; =20 visit_type_uint16(v, name, &value, errp); } diff --git a/target/riscv/cpu_cfg.h b/target/riscv/cpu_cfg.h index 50479dd72f..e241922f89 100644 --- a/target/riscv/cpu_cfg.h +++ b/target/riscv/cpu_cfg.h @@ -139,7 +139,6 @@ struct RISCVCPUConfig { bool ext_XVentanaCondOps; =20 uint32_t pmu_mask; - uint16_t vlen; uint16_t vlenb; uint16_t elen; uint16_t cbom_blocksize; diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index daff0b8f60..667421b0b7 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -298,7 +298,9 @@ static void riscv_cpu_validate_misa_mxl(RISCVCPU *cpu, = Error **errp) static void riscv_cpu_validate_v(CPURISCVState *env, RISCVCPUConfig *cfg, Error **errp) { - if (cfg->vlen > RV_VLEN_MAX || cfg->vlen < 128) { + uint32_t vlen =3D cfg->vlenb << 3; + + if (vlen > RV_VLEN_MAX || vlen < 128) { error_setg(errp, "Vector extension implementation only supports VLEN " "in the range [128, %d]", RV_VLEN_MAX); --=20 2.43.0