From nobody Tue Nov 26 17:43:05 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=1705940019; cv=none; d=zohomail.com; s=zohoarc; b=f80mJQKLq57Qq+HXMieb2ftAN3a5IuBbDhwSnVPdhsWUKlWpcobRRt2ffMLexYIAc4q9s2CO/ts5IFX5edFnahzuHKfR7eHKWOjt/O2fAgqdRfeyPAPxzffwmLgFbh+1oqGtGQos6iist2Kj28KHJ30nOubbBrVhu0HMRLqB5x4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705940019; 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=kdZGIPIeOKiZR9PMV7XS4inlMO2XkrOcO/ATQYdynj0=; b=lzEszFkxdR5gKnO7SRkr9UTtc1k1pGk5F7OOYSd7GUagktFKglzm/hT1lxC8py8s6IDzbBMgAslBE78zC3QrqrL0Xo4jIJPXG6dpSJCTlt3YBjWfWRcjwle0z7yg52NiI4XHrPud6pfumVZ5MJkwp7/p53IriBJY9hLz3cRz5Rs= 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 1705940019753796.7440012592976; Mon, 22 Jan 2024 08:13:39 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rRwtQ-0006Rk-Md; Mon, 22 Jan 2024 11:11:24 -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 1rRwtO-0006RK-UH for qemu-devel@nongnu.org; Mon, 22 Jan 2024 11:11:22 -0500 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rRwtN-0005I8-Cn for qemu-devel@nongnu.org; Mon, 22 Jan 2024 11:11:22 -0500 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-5ce10b5ee01so2272667a12.1 for ; Mon, 22 Jan 2024 08:11:21 -0800 (PST) Received: from grind.. ([152.234.127.94]) by smtp.gmail.com with ESMTPSA id db3-20020a17090ad64300b0028e245501e7sm9866446pjb.4.2024.01.22.08.11.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 08:11:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1705939879; x=1706544679; 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=kdZGIPIeOKiZR9PMV7XS4inlMO2XkrOcO/ATQYdynj0=; b=dvWrrazt6MNThmcl5Np91FA//dXKNvU29AoeoOMEG5FcVInwQpyfi+u6fTPEsvxet/ WB3MsG5WdED2xArCtxYeJ7fvHFkWSXIiZkHfSxnAC/hU5h830Jp5jGMfjYapFK6o5OHB jGS75eVaGeVX4ImVlAldre/iHDM2wTJBM7W0XFEofF4oFKKa2lWz1hWMktLzVI1GoL/M HkhnEBXDc/aSn9jXH5uYJzVHIlx/qie5fzG6jU1wTp+LHWqdVj8pz26oHKZ0v0gOyxeD 9bteshwwC47/58i4FaAe/rtjDcadYVaII80QqzPoYrGgiXKaQ6vuw6bdMGK1LdpLKn3E cbQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705939879; x=1706544679; 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=kdZGIPIeOKiZR9PMV7XS4inlMO2XkrOcO/ATQYdynj0=; b=xNa5lCf1WIHNI6QkXqaWqAML+xrJV1SSvJy1h62jP6nS/CrUWwZfpH0CkAnHxHUdim zMaSHAmCGsZxZ7sE5a+SXyF2/GI08dpJ64t++jyDg3rPNaRPDdYiQOzOeQ6CuroWjHo3 JDQJxxivmeReDAxBCowj0K9B6EH9b9ofqEl8ZPwkS+Y0vzKZsZCGwXgfk48Ic4aoQ8EA wZtLCocf57i1wHo2EZ716jwv4Ark5z47lhv7H40JQ0w3XYvbnVeWcb0AOZOVdHKCbYBk uDl4CFveZxraZw8XLJhSMN5Nhrqmjdhj0YDhxdv7fM0G4uczVKmIBCXgxU1X/6HkqGbY ut8g== X-Gm-Message-State: AOJu0YwuWZmRrTuz1vTIR1q6DlZSHeWkA6lkVqZFIEoIlm6QVka7q9Tx c1NPnjXuBZ1yP+9c85v+PJfq7jUh1/N9dbWOyVTbERlbveBe/qeAw98+5vaFLX2B61kdspwcY49 / X-Google-Smtp-Source: AGHT+IFUhhrRqGsORbL/ISvyV7gl9yqqOyFvT4c1zpYHlHo1Mteg3ms/PpoJzlsAiTp7YzaiVPaX/Q== X-Received: by 2002:a17:90a:ac0e:b0:290:1c4d:82da with SMTP id o14-20020a17090aac0e00b002901c4d82damr5067083pjq.10.1705939879300; Mon, 22 Jan 2024 08:11:19 -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, Daniel Henrique Barboza Subject: [PATCH v4 01/13] target/riscv: add 'vlenb' field in cpu->cfg Date: Mon, 22 Jan 2024 13:10:55 -0300 Message-ID: <20240122161107.26737-2-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122161107.26737-1-dbarboza@ventanamicro.com> References: <20240122161107.26737-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::532; envelope-from=dbarboza@ventanamicro.com; helo=mail-pg1-x532.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: 1705940021063100001 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 Reviewed-by: Alistair Francis --- 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 ad1df2318b..89f2349eb4 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -852,7 +852,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]); @@ -1320,6 +1320,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->cfg.cbom_blocksize =3D 64; cpu->cfg.cbop_blocksize =3D 64; @@ -1819,6 +1820,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 17:43:05 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=1705939949; cv=none; d=zohomail.com; s=zohoarc; b=JOgzLmnmk7uV6xozaqZRidcATrw82WQYjPmiHHE0kEZkLq/4JYoM+nO6cB2kIVdNLuctWmg2sxI4ScRacEuLLadj4k1vZYe2oSv8/hR+lZN+Iz6rSlr4+hCj3yqouZxICTgx3KuHs6x9ae4aKw63Qb8wmogXIVNJUFrGWENyhhU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705939949; 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=9GiRO1555hL7UtHuko7cV18F9Nb/34zN4zFg55ve12s=; b=Sz/JSEevbyWQunFSG+RHO0c0gOquBDUQ6xaMFe7Km6D2IXXgpYPlaNnh0PLSaNo1wXAnl3QmQaQ4uyeYyEThsNJhGSAaPf//+CvuTMCIDq8Gebo1C1HojMQFa6GLqGlHfs/d992YgpP8DtBNpT+zM0YlQE3yoboWut1gXGtYME8= 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 1705939949198628.824630820108; Mon, 22 Jan 2024 08:12:29 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rRwtU-0006SR-JX; Mon, 22 Jan 2024 11:11:28 -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 1rRwtS-0006S0-GE for qemu-devel@nongnu.org; Mon, 22 Jan 2024 11:11:26 -0500 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rRwtQ-0005IX-VO for qemu-devel@nongnu.org; Mon, 22 Jan 2024 11:11:26 -0500 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1d70a98c189so17051735ad.1 for ; Mon, 22 Jan 2024 08:11:24 -0800 (PST) Received: from grind.. ([152.234.127.94]) by smtp.gmail.com with ESMTPSA id db3-20020a17090ad64300b0028e245501e7sm9866446pjb.4.2024.01.22.08.11.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 08:11:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1705939883; x=1706544683; 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=9GiRO1555hL7UtHuko7cV18F9Nb/34zN4zFg55ve12s=; b=TmrKniAz+zozgVMbTuxFsZLTraxhvr/taZeHXu7rtyrWw/RuI8I7sYdoRHcFzDWuBt RoyeYG/s+lpFr7qi0ebYZOYGgq7vRNUdQTike0HZm/8ySVIcIpS0jo4FUyzLwX8swGzd RH+Ec5JAnM83nw/fCHXkUAf6KpVUU5PwDO/9bvLF+humTP0q9y3OVDuPSjQiJaZEBW9v 5bKoSfv1Rk+SY46LenUPbFbzVPsS5XtuBFLnBkd1pbj6vMLsGlZ0qrc1sqhy+bJ/USX0 19TEol/jfXiXKJk6blmBqYYAudi4hX/flDp3BCLNODgMNJgkwGIbNLYGqw9TneyVC/fO LTVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705939883; x=1706544683; 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=9GiRO1555hL7UtHuko7cV18F9Nb/34zN4zFg55ve12s=; b=rL5k7Y/RUGu2esWvRF3fhtvpC0Z+wM1i/NMwGpAHgSPNfMwIrw/jvGcmSXrgU41iLL Zj6Nh6M7xhH5wp0n2lfoCTXyc+RIRnUwXgpiVE68cv3wH1+bX5SQ8J/Kts4MpCwa5Qwu N+gAvtc8hgMbYIjn1+5x7Gc2CLhcG4MyDjAOP/EOXqdqRHOhxST8b5ywyeXQd+mUR94+ iNbxR7iCLjFra1iqgVlO6m+fDdleOoWWKLsKZY5HfG0aOICJ44KCkkgsbyMIkVfLYB9S Besq+lNFZSLCBq+r7OvN2LLdvsgCbmyotqfyaloiQv2m+k+N0EOsJbMYQuBSmfjcGZgL S6CQ== X-Gm-Message-State: AOJu0YzSy99TDpXaMXaDFCRrJZSc6Hvqjxn2QD75GIYZ8mkzHCjwevcE JtXS6Rc648xWwlJk2vEA9HjMPUIeNJaVJ1pSUFWdrll+v/MXHhBVaNmF4UV9yOdpQ8QLG8WwPCG X X-Google-Smtp-Source: AGHT+IFWTzDQq9uNmxjRcJRx+CAGLVycrA5DIlcnUPt+jo502VVMdemBSKeo6YAEYWYpfoyYVpPr2g== X-Received: by 2002:a17:90a:fd91:b0:290:8e4:466e with SMTP id cx17-20020a17090afd9100b0029008e4466emr1365831pjb.33.1705939882771; Mon, 22 Jan 2024 08:11:22 -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, Daniel Henrique Barboza Subject: [PATCH v4 02/13] target/riscv/csr.c: use 'vlenb' instead of 'vlen' Date: Mon, 22 Jan 2024 13:10:56 -0300 Message-ID: <20240122161107.26737-3-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122161107.26737-1-dbarboza@ventanamicro.com> References: <20240122161107.26737-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::635; envelope-from=dbarboza@ventanamicro.com; helo=mail-pl1-x635.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: 1705939951269100001 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 Reviewed-by: Alistair Francis --- 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 d666620e48..d9a010387f 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 17:43:05 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=1705940012; cv=none; d=zohomail.com; s=zohoarc; b=YEgQuo2u+fUuKgQu/fdpokJH++N/6nw39eaWE8TgBHBdSZKCsxWL8kHnm7SmTbK2cC2op7Np8mzEs5szPfo1YRCqc+Z8D1nsayObHhWoRRs6BOe3xVLsJpE0fqwWIllzdMi7Jr/ro2Uy4U9LJ0v5ng6pjiWSa8X7U86q+vGYZRs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705940012; 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=7DYo8VrPXlh1AJNySLC/rLx/xCLIPadhg3sHTr+fkec=; b=TsVSYs+6wSwOCik9PNF+twIa8GTBHNNsYNAA8C/I0GdcQTL1JC0J2GFkIki/qDtOUDFW+0wlvemF6NKN3WoLiPbS+oqKBuSlr5ZYWDcgqQFNWw4EjRQKDc/YvNTzF39vVvkw7SSgcVHuZmZ1p46F/8qqY+zpKaoNRko3VGZ/Y5o= 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 1705940012187251.06966020469372; Mon, 22 Jan 2024 08:13:32 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rRwtX-0006TL-S8; Mon, 22 Jan 2024 11:11:31 -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 1rRwtV-0006Se-Br for qemu-devel@nongnu.org; Mon, 22 Jan 2024 11:11:29 -0500 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rRwtT-0005Is-Tb for qemu-devel@nongnu.org; Mon, 22 Jan 2024 11:11:29 -0500 Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-5c66b093b86so3098026a12.0 for ; Mon, 22 Jan 2024 08:11:27 -0800 (PST) Received: from grind.. ([152.234.127.94]) by smtp.gmail.com with ESMTPSA id db3-20020a17090ad64300b0028e245501e7sm9866446pjb.4.2024.01.22.08.11.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 08:11:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1705939886; x=1706544686; 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=7DYo8VrPXlh1AJNySLC/rLx/xCLIPadhg3sHTr+fkec=; b=Zx81/P8RwK+4CIt4+/IOVuih8cM0aezfMjrjXBzOt6dRjhkWdhgOZIPpg4nKKQKKec L7aK1TjY8dPHuS5RJBGE9jfHmClYe3QQ1ynTYXdM1Yc+pmXZ+Pu4YgSiiAsRiz6KNwxy hrhgKYLAUvMtf22sRpwteXSA9tWmnqCQIPZQjXFZHbzoe/Xpk/3o154NNikMSqArXVYn SNreXCavZu9P14rsUZkh8Unx2DhWnbDzUB2kv4hO4sbEXc61FKrYA1iGaTjjk2bvKbWi mOHVZ5Huu5QyY6JiiaoilFUYcPajv0JjsyGXESatyMvuvTjXqXjUg15J9aEcw3HDk7qd xYEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705939886; x=1706544686; 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=7DYo8VrPXlh1AJNySLC/rLx/xCLIPadhg3sHTr+fkec=; b=sNPNaW1seg23RGcxPELChg4b96PtBG8MpLji1v7HfRsuJbaYMOxbRv6hxXZcxSCOPi pgvtA9AWmroOmLvD5bfeL4+JE91WyNjCNB6qDzZfwsHG+bY9Vd02HBDIuKWOfPb6P07C 289zk3QUmsf+g1XaQET2IY9qFIY54BGcky8DwWisAxHfJ5DMB5qIGVjPDotKl+Hvg2Mh GsalGQntYLTzbHjntIcO5f6u0/u01oBrlbkV8qi9sPwwWMP0QZzyNPi7NTfIk+m/vHry aYtsYFa0wr0Q5DAo0G/+K5F78hYoILNJMIJyJ8nVziATbwdydde5BqozgOpkIWvwiva0 8HIQ== X-Gm-Message-State: AOJu0YxIExbT/a/woXuVIAT7yb+PMqeyH7hL11fU87l1dhJ1ecJacRy4 akJlaWZfGSNMMFZ48jZx3curaOubzi+vcSg+PCz7pa7COcz4ZmKP98/Fha13d+woM3yOhGB+tl2 9 X-Google-Smtp-Source: AGHT+IEkks5yyX9C7nhNlgXuOzJQfw1/GOWBN/PMFnmdEulC0nWq4kLp8xRfwv4r77CiqZ+Yz8IUkw== X-Received: by 2002:a17:90a:43a3:b0:28d:1581:29e6 with SMTP id r32-20020a17090a43a300b0028d158129e6mr5320566pjg.13.1705939885966; Mon, 22 Jan 2024 08:11:25 -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, Daniel Henrique Barboza Subject: [PATCH v4 03/13] target/riscv/gdbstub.c: use 'vlenb' instead of shifting 'vlen' Date: Mon, 22 Jan 2024 13:10:57 -0300 Message-ID: <20240122161107.26737-4-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122161107.26737-1-dbarboza@ventanamicro.com> References: <20240122161107.26737-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::533; envelope-from=dbarboza@ventanamicro.com; helo=mail-pg1-x533.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: 1705940012799100009 Content-Type: text/plain; charset="utf-8" Signed-off-by: Daniel Henrique Barboza Reviewed-by: Richard Henderson Reviewed-by: Alistair Francis --- 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 17:43:05 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=1705940042; cv=none; d=zohomail.com; s=zohoarc; b=V8XWFITt45MUigv0rjEGNpprdm5ls5RlRB4fBHDWpLQIYCRANpPCIXz37U7JmYqHqr15OP/9K+HWqRgXq24LexdO7fuKbjxqwwyRt6v32r+NLvSL4tljnEqChkou/CIx5O+a+mRE9T3gr5+BB7l9TQcnLwp0hHWdm+n1FHRZ5Mg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705940042; 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=huJ0Y4U7cHePq8ipNQd8rkS4E9Epq2NvbZ0Qsc+OzcY=; b=DOE41T66daMGFWOCQMlZFGZ08qrKuzSn5pzjcVgFoDWzdfqgCizF7Q8ayjy7gAJNe4pKAdM9eqyi1R32a/QVZSRzhyhCJANYsa7YnTTGkQetxhHuCwfBNkM+tpq1cWnU+50KU2Ylgb4YL3sDdh0ft0zYLCYHTu0nwZk5XU8M7w8= 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 170594004254263.342648889826364; Mon, 22 Jan 2024 08:14:02 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rRwta-0006US-7X; Mon, 22 Jan 2024 11:11:34 -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 1rRwtY-0006To-7f for qemu-devel@nongnu.org; Mon, 22 Jan 2024 11:11:32 -0500 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rRwtW-0005JC-JG for qemu-devel@nongnu.org; Mon, 22 Jan 2024 11:11:31 -0500 Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-2901f9ea918so1536837a91.3 for ; Mon, 22 Jan 2024 08:11:30 -0800 (PST) Received: from grind.. ([152.234.127.94]) by smtp.gmail.com with ESMTPSA id db3-20020a17090ad64300b0028e245501e7sm9866446pjb.4.2024.01.22.08.11.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 08:11:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1705939889; x=1706544689; 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=huJ0Y4U7cHePq8ipNQd8rkS4E9Epq2NvbZ0Qsc+OzcY=; b=SfMJgS0zPswm7rM7z7gSS88afdUjRR/wgNntR5l0cQUErevBYEemsxq06lbpaNMBWr DGFDyxQuV0XQFP9Rh+GMDdOsB/Yvi0GHH4V6VAK1WlGWqKxyJ6zl6oaeUEZ2OFBzObqd 775570DvAHKHCSpM7vQQd1buoUCcVKIZZgiOVizxN9Uts+n7x1FPWSLXJDGlsuFU5AFj mpjki/tJAehOoluKStAhHuMx7+u4lZsoU3RUGQzCSG3Tu/JtEhrVoLKuzggjRr8i7b6Q TrgSiECD+Jgou/vLBlkLz6YmVYPDF48M2zv6POfawh0n3f2aaldgHTPfgV7ySkSM9Hl4 KZfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705939889; x=1706544689; 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=huJ0Y4U7cHePq8ipNQd8rkS4E9Epq2NvbZ0Qsc+OzcY=; b=eQZPARQoCSrR2pWMbjkHzcMaZHsM05peYqjIJtplhKjSqxVZBdEs9r+nu5/k9d89fZ xpH2HzFM1dUEmw01tM01cwko5tMhg1FqYizU/qBMHn96VKEja2ui7gGi6BS4wjV7bbif hDCrdeA+PqV8SBBtCNuvO/eRKopG3GIH9Bl5LSDSKF2VyaRv8eT7GasT6pbHsxM8yaYU j34CGMBN7vqHuBJx433JW9LBeg68mGMlVdQEEKdsG+OyUZGEGZLhhvGipQG0oaZ9lg6L HXeBNtmqupXnPD3T/sPSadCvCxMfyUFFWCT35FU8e+2tUypSOPBy3+rCHAGPJ2wWMEKd PrNg== X-Gm-Message-State: AOJu0YzQAilcY64wtDL8gziKE17NvKyvaWs/c4R46vPDLQHf6XL8TVUB 8zFipy2GHW5seHLgwGXMbdm0SBy1uF7FO5OLG1IhXc4ZjKY2DWtC7fQDeF0W/0YrnFTqNIoLEBC 1 X-Google-Smtp-Source: AGHT+IG9yYI/lG61I5vFwGEmVcfSZ/isRrBd/yI7M3j00YcMbynTgYFqOYmvyfevh1+ocKwBmvwVvg== X-Received: by 2002:a17:90b:4015:b0:290:c8f6:7499 with SMTP id ie21-20020a17090b401500b00290c8f67499mr46425pjb.30.1705939888964; Mon, 22 Jan 2024 08:11:28 -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, Daniel Henrique Barboza Subject: [PATCH v4 04/13] target/riscv/insn_trans/trans_rvbf16.c.inc: use cpu->cfg.vlenb Date: Mon, 22 Jan 2024 13:10:58 -0300 Message-ID: <20240122161107.26737-5-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122161107.26737-1-dbarboza@ventanamicro.com> References: <20240122161107.26737-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::102d; envelope-from=dbarboza@ventanamicro.com; helo=mail-pj1-x102d.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: 1705940042907100005 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 Reviewed-by: Alistair Francis --- 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 17:43:05 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=1705940050; cv=none; d=zohomail.com; s=zohoarc; b=nmWLOcO1Na7DyHY7uJLPSFglMvFM7P8u51tar8cIwSLLZf34LJFvyHSsjpNgv59mkSt+pVFevMszNAkRywKoRuuENokO4xpJLFp1oKF0QIXjKmmpH8hg/5qSJZ7NqZYKdvIT65abhot2/4FoywEAdn0TqLSnF386mOAc2Z6UFrQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705940050; 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=Qz8hngCz/SIlMUbJQdMn5m/GriDkoUu4BCgl9k4ZFW4=; b=Cq494Z+CeJ3mo9MOYqo98GSSG9xVcleSeqguhzjWPHd/UA25hgCJa1O8Dq1ALMV4GxokdllPAt2IiHnGIW0I6HrrKHseHl11xODayb+aloS/SfdIR7m14Bqp3LXjttybUP964VTPwkHj0SxK0bhRNRjywtq/G4h+Gf8lK4gQZts= 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 1705940050705536.0240791686388; Mon, 22 Jan 2024 08:14:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rRwte-0006Vm-50; Mon, 22 Jan 2024 11:11:38 -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 1rRwtc-0006Uv-GK for qemu-devel@nongnu.org; Mon, 22 Jan 2024 11:11:36 -0500 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rRwta-0005K0-2d for qemu-devel@nongnu.org; Mon, 22 Jan 2024 11:11:36 -0500 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6dbe5014eb5so554061b3a.0 for ; Mon, 22 Jan 2024 08:11:33 -0800 (PST) Received: from grind.. ([152.234.127.94]) by smtp.gmail.com with ESMTPSA id db3-20020a17090ad64300b0028e245501e7sm9866446pjb.4.2024.01.22.08.11.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 08:11:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1705939892; x=1706544692; 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=Qz8hngCz/SIlMUbJQdMn5m/GriDkoUu4BCgl9k4ZFW4=; b=XOW5oiL7i7frpHw5OxAyuqrUVyap0YOAiA5YqhH6mLFOZRs+v7AQGGvWUHIi7IfkB4 CWVEfz1sDR972NfzmN3wqJkqwScNrc9XxOFYIRlWbCY/7899sBRHtzUwZPkfQCkKmBPD T/vT0bA8i8vBMtslgHOTeBGouvnWvElTlWBchIjkec9tzBJZMhZ3r090KgxeRgA9OPJe mQWwclX1P+9SsJISQk2siq5J52RsCKs68n3AXNYxcTBKeoB728pcqvtRiAjzOgMXfBHd OFqNkqbPNmNKmOF25FnlKlTcv5mtybl8ON2K1Ybf8vxWEptqMW6dBnBCgokWDTaPKqMp Wozw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705939892; x=1706544692; 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=Qz8hngCz/SIlMUbJQdMn5m/GriDkoUu4BCgl9k4ZFW4=; b=KOWzgAqlAJ3veubsWw1ff6jKSfmTBsD0zRGsyRIcZyEu2bm+Ua9Rd6Eq8mh7/XBmSg een92RHX2WkJtkIBl5ZkmlWNOJ3Jh2h+Uwp3dV2AnCYPxdRUJozYSOVKjE0U91kLwOM0 zc3Bkih67HevAjW1+FHv20ImrMFw1/yr50LcTKQP3ZrYLJaW+188PG1Vo9MInYjfohVQ mCzmAbEUS3RySOKdYlfmbtWb9RsJ+5g+kKlGjeG1Z/fI55y6lpQUonXBfU3I2+BvPVBW f40+TUJ7b0SlEkcuD/j45Joefy74PeN6eJ/0Um3kmoimB5nxgfP7Cr/2JvcexYO36reo CtNA== X-Gm-Message-State: AOJu0Yz7sLouWuhEf48j7SMcVKQDefo/zM6fTNidGtRVvM7IcsOxApn3 P+Ssmh0P2/eY8BpdMNFCh1W2kwkKsyr05X+vW+dhb3tT2HZLSFVgBz9qCrgHpjuiYUUOvYdKqiG B X-Google-Smtp-Source: AGHT+IFjA9jidlcgw4oASPn9svqrMYJ2FXvtyINcBRJrmWqsNV0wfppMkpH1W/7XsWGZX4CMl3DwTg== X-Received: by 2002:a17:90b:4f83:b0:28f:eeda:e9ad with SMTP id qe3-20020a17090b4f8300b0028feedae9admr1649368pjb.28.1705939892033; Mon, 22 Jan 2024 08:11:32 -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, Daniel Henrique Barboza Subject: [PATCH v4 05/13] target/riscv/insn_trans/trans_rvv.c.inc: use 'vlenb' Date: Mon, 22 Jan 2024 13:10:59 -0300 Message-ID: <20240122161107.26737-6-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122161107.26737-1-dbarboza@ventanamicro.com> References: <20240122161107.26737-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::42e; envelope-from=dbarboza@ventanamicro.com; helo=mail-pf1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=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: 1705940052941100003 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 Reviewed-by: Alistair Francis --- 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 17:43:05 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=1705940010; cv=none; d=zohomail.com; s=zohoarc; b=Nncr4CBqdKRqCsZqbpKFaCJTGkQ9NMMgHyiYsB+P2hP+ks0YROKt9tM05Q1E8rHYMd1YHS/mbhqMlEPiojxWIXTjzou7ZHihdIENSNlmZDDLADIj6Yo/h2FAkDaDgnOEr8oBX13SC8XkauTjeIliBFAARZ7S3qKPRNTHdhWq400= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705940010; 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=Vtd2ck9WDgqr4jkxn0CvBI9nnqbyC741kYLzWfKv6Fs=; b=e4n5TONmCukRAoVv/2L51J3Uh0nIpYO0m/C+AzzyPP9+AAK7eBApT4yAG/e49ZsQb6cX337mAT363hxrs7ERkEPbGiXmkLAhZ5vw5ltKhuWCRzfuwXlQ0JgQlV3LMlDPJkpILJjqkbfAC2NGBqRirtNYD+sxMy4AEQ485Mcf8XU= 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 1705940010063318.16876144728815; Mon, 22 Jan 2024 08:13:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rRwth-0006X3-0H; Mon, 22 Jan 2024 11:11:41 -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 1rRwte-0006W0-NK for qemu-devel@nongnu.org; Mon, 22 Jan 2024 11:11:38 -0500 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rRwtd-0005KP-3f for qemu-devel@nongnu.org; Mon, 22 Jan 2024 11:11:38 -0500 Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-29026523507so2524700a91.0 for ; Mon, 22 Jan 2024 08:11:36 -0800 (PST) Received: from grind.. ([152.234.127.94]) by smtp.gmail.com with ESMTPSA id db3-20020a17090ad64300b0028e245501e7sm9866446pjb.4.2024.01.22.08.11.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 08:11:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1705939895; x=1706544695; 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=Vtd2ck9WDgqr4jkxn0CvBI9nnqbyC741kYLzWfKv6Fs=; b=CRKWh5HEFbiFh4Seo8KgAjXg1GgpXDxXz9GDAbBPXNtgumVRUd0RoJNjFNYuch0TGo Kl4Wy5ktjbkNHvVsPmmwsvWb74wdkcTgBaJZjjGFH62Py257yve55EXZVcBb7Ky3bL1W JKV4QAH3ESnolCKPpTRjyogTQIi9Ebxm4aGq7nnMPncfgaW7vvjsFaeIJh/WuJwqlO2h /pEiwMLfpNPbW3trqRnyg+JsP7c2bTzn/oF1vu9OmE/ZT7lyD425vreXTfV25z7hJT/Q nv7DPoo3akuxtSB7TWk0EeJOXV0EP0621ogJXVzxymVEKfLBnrb/fW8e91QEIGfg4bDK Z1jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705939895; x=1706544695; 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=Vtd2ck9WDgqr4jkxn0CvBI9nnqbyC741kYLzWfKv6Fs=; b=Q38BBpcSmTgg0G0Y8JJ078F8EmvAPF/OIitYZZ8XaE2rqkdC8wfAOyLU9EiDm/iTH+ ehE8iSj6r7Nhl/xCWDP2p9pTZUjZDzZr8AY515osRZFe3ehVt9IwEjvDwJ16E3ajAJAz tCGvFoA8842MEy7GJnpfsN86ZE+5B+YnSStHGfkiygi47+QcdfbBLBkUYjaOFLZPlN2f A3lRs975HhTWokplqvoWLrxKBN/jKAeOtWTT+b90OsQjqnFc1ZX2550QgWpSxZAVV03p 3naOCAoym2e5UZqnpOoX1fPNAkePQdFK4OY4g4OipPdtKJzuWS9al9GRI5frwELZo16D TSzA== X-Gm-Message-State: AOJu0YxScba6OvhQTwxif1GjvLrsI7iDV7Yz9nK36SF1FtWMS2kZpNny +WczOZRVLBwtE3g0ODdIopfjpzgCQ+iCSKa28ieadtGlFjXZNn25hh9n5yMHByFPqG7dyRgganC B X-Google-Smtp-Source: AGHT+IGAbBwDvT6LsYmOHi+obeTEERk77HsDmwffj4v2JEPPVX7YDbX4j5hXL4EA531JTfXcISwXrw== X-Received: by 2002:a17:90a:4dcf:b0:28b:db20:3803 with SMTP id r15-20020a17090a4dcf00b0028bdb203803mr1948111pjl.46.1705939895043; Mon, 22 Jan 2024 08:11:35 -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, Daniel Henrique Barboza Subject: [PATCH v4 06/13] target/riscv/insn_trans/trans_rvvk.c.inc: use 'vlenb' Date: Mon, 22 Jan 2024 13:11:00 -0300 Message-ID: <20240122161107.26737-7-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122161107.26737-1-dbarboza@ventanamicro.com> References: <20240122161107.26737-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::102d; envelope-from=dbarboza@ventanamicro.com; helo=mail-pj1-x102d.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: 1705940010814100005 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 Reviewed-by: Alistair Francis --- 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 17:43:05 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=1705940040; cv=none; d=zohomail.com; s=zohoarc; b=ENVn41Obw+dZ0mnvY+A7yLldUhiHsOyJApRxPkgynKJJZg/rPLFuW81YvXdW1hPlVIDR+kVu9S3no1Awp/5rPBwtTl5byQXdQjsZANibk0bOVjcrm15DpQB9deplCzrcCjXsNb6w3oJv4Yw4BCSarxa3YHVvcUv0RdOyE9EXR5g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705940040; 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=Lv48qBmYyxAB73lkKJKjEAgQbN3yEFZfSfzEzKLA/Ic=; b=SH3EuXfqzIDQZ8FMs+BrL+CkGfnLDCv8grdFB6xhqnmibTOMz2gYT7pS9Lak3JnnQgI6+Th3F7lmh7A9TqRg6i3T/PaIImW06ngN91wd9t5CSuxSzaJPgJmqDlh3EMTCtDG5LrLjDaKp99ykcaOZ3dzYvUFRkAwmiPo6QCPuMeA= 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 1705940040056755.6706802728336; Mon, 22 Jan 2024 08:14:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rRwtj-0006Xl-HT; Mon, 22 Jan 2024 11:11:43 -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 1rRwth-0006XG-No for qemu-devel@nongnu.org; Mon, 22 Jan 2024 11:11:41 -0500 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rRwtg-0005L3-0w for qemu-devel@nongnu.org; Mon, 22 Jan 2024 11:11:41 -0500 Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-29065efa06fso1593521a91.1 for ; Mon, 22 Jan 2024 08:11:39 -0800 (PST) Received: from grind.. ([152.234.127.94]) by smtp.gmail.com with ESMTPSA id db3-20020a17090ad64300b0028e245501e7sm9866446pjb.4.2024.01.22.08.11.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 08:11:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1705939898; x=1706544698; 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=Lv48qBmYyxAB73lkKJKjEAgQbN3yEFZfSfzEzKLA/Ic=; b=Rh4n1A7LVAUs2C5gKYGKKQIFQltwPfQyEMdLcuBwgHkNyilP/Q+YmsEtjV6kGRXPlX /aWliqtWG5Y//I3GjoyJ2ahySGrfMlwCMYqT5N44FujQll9Of+geQ6iK/zS9eD5HkrDi oNmHoTzu2clbiSjaqb8U7OVfq18PlYTQYISPLg3K3/qwfE3/4wmg8Lu4AtEoVucDwAk3 Oce5L/L07QfmpqJhQyNwzYf9dsJTuZQ7XE4l/gbrFuX4irAkqpijALxR05RCO9MhTzoq 42eQRnB/D4FSA2uRdlH4xLTOF+dP9PBZqo5/ZL5zlnpmoTt6t8yvDMpX5xu4PLOantx1 s1IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705939898; x=1706544698; 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=Lv48qBmYyxAB73lkKJKjEAgQbN3yEFZfSfzEzKLA/Ic=; b=UTe1PeErBus1upr1K3EIiv8FrDJGQSwN5rfMjT1busqPid+TLxPlg14YdvWRm9xQwB IGsiWF6qvlHUvPscSPcVI6DimBE4+rBjZpm9zpizTvpRQVQ3dApooxSZVhzD5E3jSkcK z/Ys6o0znhpQMyOnerNaCH6zLoiEO/g18aVWZkf4W5nxGJfSsedGT/5yWhBH/7OLyJbC 9U8jUZr53uzA/QM2QMb1Ieb+DYyPGxhCnpg6GwgXIaK8pQRS7Blmmquqzuc62DoMd64k WmOTVRx0L8KtAvf0zjg/tGAHhlaqT31oQ07f8cR9sLIuCqjdYgTaifAsC98jdu4/aS9+ ARKQ== X-Gm-Message-State: AOJu0YzTHxshjW+DeC0UlkwXvdWJs8prHfGSTy7KvRiqwtLWYSDqfCFn E5HYbFDhat9NVNMi6IeBD888/my9jsdH9YlpkL4GFitSsFBwGCLKDH5tGwjObRgLbYlc27LuSwI C X-Google-Smtp-Source: AGHT+IHTJ/ltiicqlwenbii+Ma+9AbZpWdVx67nGerkwBWbrF8qNWHPAfsPwd+t09mkahd1/e/SKqA== X-Received: by 2002:a17:90b:3110:b0:290:9311:9d12 with SMTP id gc16-20020a17090b311000b0029093119d12mr985827pjb.56.1705939897938; Mon, 22 Jan 2024 08:11:37 -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, Daniel Henrique Barboza Subject: [PATCH v4 07/13] target/riscv/vector_helper.c: use 'vlenb' Date: Mon, 22 Jan 2024 13:11:01 -0300 Message-ID: <20240122161107.26737-8-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122161107.26737-1-dbarboza@ventanamicro.com> References: <20240122161107.26737-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::1036; envelope-from=dbarboza@ventanamicro.com; helo=mail-pj1-x1036.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: 1705940040897100001 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 Reviewed-by: Alistair Francis --- 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 17:43:05 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=1705940142; cv=none; d=zohomail.com; s=zohoarc; b=ZCxfR5dxcFnU7S4RSc2cnFtuEkcENhnwAbiKshXTr1n1UZ/hwKOLq3nR2w1PtCzCE2F4j6QOK6Mv9OWmMyAL7WOcA+FIrBCprF3mUAFL+3k9/e7LanLbd2OPxiJ+mwHpYUcVB6mMADcEvqz3l+yjFC6ogpBCcTclkAX725FQQ9U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705940142; 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=76Mph1VWeHU8OoA0oT8y2Nr6g3kTredg0P9ZzqK98FE=; b=BxnZjVQbvRSvi4mVOdIaVg+rnAAmCLLlcuy/r1dX3aTNVLyXEnMSFJXxlKIuFR3ih9n1jN4gR6TwSXlGkuVm4QUGnSdKiYH/Zwb6PKEJf84H3P/XwH1gHpNAixuoTl7DFzbgFg348plzMq1Qp6wys9e1TOiG1+Vsb7dIL2ibYwU= 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 1705940142064373.8396355262787; Mon, 22 Jan 2024 08:15:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rRwtm-0006Yx-4j; Mon, 22 Jan 2024 11:11:46 -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 1rRwtk-0006YB-JV for qemu-devel@nongnu.org; Mon, 22 Jan 2024 11:11:44 -0500 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rRwtj-0005Lb-2m for qemu-devel@nongnu.org; Mon, 22 Jan 2024 11:11:44 -0500 Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-2907748497dso1256281a91.0 for ; Mon, 22 Jan 2024 08:11:42 -0800 (PST) Received: from grind.. ([152.234.127.94]) by smtp.gmail.com with ESMTPSA id db3-20020a17090ad64300b0028e245501e7sm9866446pjb.4.2024.01.22.08.11.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 08:11:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1705939901; x=1706544701; 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=76Mph1VWeHU8OoA0oT8y2Nr6g3kTredg0P9ZzqK98FE=; b=OGD0eRSmVKp1FS8JRHEJzBVWB+HYh1ScHnUNtVRrvUnsS9AJGd5mSUAFMDkQAlYWc4 bz95TXp4p0/L9UBQaj/9x8PiZQGAO/VZcZjkZomsH1mzidLnGTkBn7BkoSfYnJu0hEnw Mj6Uu0GoDPYPWGR7ZOqRBd6wsFMmR85g7AnL1NV340LbUXdwBuoO0+UN6Q4ugy/DaUBM mK8H1A5JbNjD9XwWJI75RCfEBL62mdz48zFXxIXRuAButJxWnoOYoSy33tJR//UpD3G7 bK+b/mIP+9qJJVaEED4lvOVHJCbtRA7tUSkYT7wYO9wyAroXo9j0cQa3zdEUJRVYxOfW BeyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705939901; x=1706544701; 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=76Mph1VWeHU8OoA0oT8y2Nr6g3kTredg0P9ZzqK98FE=; b=c369CDVrjBttIDTsIickM8x5Os/hQp+tCdStHOsKOQ0fIqY/4Y6oFpgkA98XPE79V0 J5dIXW/3fq/YUcHhSae17vI2QzrA2wuN8/qeU5rHZNLLPABp2jYeJ5i1dlVIKJ6oqgJV VOJ/YY8Szxp3zN+Z+Aw2sWZKRgubuGzvpC6aaLs4fANsvbrVyPvHXOB4BUenFpj6h54W UkerfstTfHQBleePkX8yMAxSNcMZxQ7jaKiNCdq93BoXWYYc9H6Ra9NcMk9QOs0ugglM A0SSziGA/U8gXvKn1V8PSh7RczXruWY+iOlWSBbjKZrU0OnDUZ8xcjbZIsyjUginKWaZ nUUg== X-Gm-Message-State: AOJu0YweflOOPF8Vbi9n9Fqw0oHM4oSzDS/e2KF8ReWBynof8W/4iCYZ kjCbe2t2oHXhcusfZPJ20ex+UAku9PP3aL8frvcFc9PBWmJcWEsjv4JlMWuKBxzvlZoqDGBZDuN J X-Google-Smtp-Source: AGHT+IHnrwTjQgQqSRt5BPo2CQ5bqoJUyDLqVv4/HGnM/qvzZUqWN04j/RvOC0OxNkjOpb0bo/csug== X-Received: by 2002:a17:90a:898c:b0:290:1481:f13b with SMTP id v12-20020a17090a898c00b002901481f13bmr2115348pjn.29.1705939900920; Mon, 22 Jan 2024 08:11:40 -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, Daniel Henrique Barboza Subject: [PATCH v4 08/13] target/riscv/vector_helper.c: use vlenb in HELPER(vsetvl) Date: Mon, 22 Jan 2024 13:11:02 -0300 Message-ID: <20240122161107.26737-9-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122161107.26737-1-dbarboza@ventanamicro.com> References: <20240122161107.26737-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::1034; envelope-from=dbarboza@ventanamicro.com; helo=mail-pj1-x1034.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: 1705940143731100001 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 Reviewed-by: Alistair Francis --- target/riscv/vector_helper.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c index cb944229b0..b13be1541a 100644 --- a/target/riscv/vector_helper.c +++ b/target/riscv/vector_helper.c @@ -45,9 +45,16 @@ 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 + * VLEN >> (8 - lmul) >=3D sew + * (vlenb << 3) >> (8 - lmul) >=3D sew + * vlenb >> (8 - 3 - lmul) >=3D sew + */ 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 17:43:05 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=1705939977; cv=none; d=zohomail.com; s=zohoarc; b=gH/oY0XVlREl1chEuc/VgpdcfXKPLwydYV+99xRNWsesxzOBvz03Iu+2I6CpKithayFjttp2zbbrxQva9mX3PSuqZQ/6+zOqZFGowqsxuZDmy7TXa0v2An7ejU/D1RiheWObfp18P5vAjbNw0rCeFd97qol897ooHq7/oCWBuPM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705939977; 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=dK9b8ai3GFFn6k72ZVd2T7sFWyCWDsdKiydPds9NK4c=; b=cSQOJrJL1sUHbw3oES0veKpBRDXCQXp200RNHMTUaAQgJ4UQFloNl9GWazoXa0cuj67WCzE/FlMIlL1XyZFMPNfSmNKDSp2pwnyqPS0HOKfUBci/Ca3N63ggGIfBI98Mu4OkrFpApJPQtAXb0GAJS25Vw7JMMZscflraDkzudsI= 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 1705939977990860.5699000214792; Mon, 22 Jan 2024 08:12:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rRwto-0006Zo-Qi; Mon, 22 Jan 2024 11:11: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 1rRwtn-0006ZO-8h for qemu-devel@nongnu.org; Mon, 22 Jan 2024 11:11:47 -0500 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rRwtl-0005M1-S2 for qemu-devel@nongnu.org; Mon, 22 Jan 2024 11:11:47 -0500 Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-2901f9ea918so1537072a91.3 for ; Mon, 22 Jan 2024 08:11:45 -0800 (PST) Received: from grind.. ([152.234.127.94]) by smtp.gmail.com with ESMTPSA id db3-20020a17090ad64300b0028e245501e7sm9866446pjb.4.2024.01.22.08.11.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 08:11:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1705939904; x=1706544704; 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=dK9b8ai3GFFn6k72ZVd2T7sFWyCWDsdKiydPds9NK4c=; b=Pqq86eIW1fl1RPFCz8pzxofPFNVn0sZZm4halfsIsR6fPmUXKpd/CU6xHh1nveH+ei I/wWXIL7xlu/6G+9hlICuD21Y0YGrgpYZ+8e6FjCrZoP0YItwGOyhXIWUqDVAkkQRFXp GoAqvHHWnwy3G4EeJj9xTH24V3u4Jy352PlPmBt1GW5htbzZVvNtcJjW2ytlvPyNQ/Bs OQjF5IVUbFGWYp+rs3xFiRMAwa07reVabeT7AqnpXIH2t8bs8IaPAns4rKhK0lnhPtla 9Xb5ek0JRyGzZ1JCN3WO1hIfKK/wMejtQffNUvKVwcoeQoT8Cs4ZBA4K9tpVoTt1pAyZ iM/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705939904; x=1706544704; 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=dK9b8ai3GFFn6k72ZVd2T7sFWyCWDsdKiydPds9NK4c=; b=HBt4GRpPm2Z3nTV4J7b3aX5Syb8RhpsMpR2gm5/cRgxKZA8tTKnEkllVB6KARddzPA A4UllWJi731szJE6esrfZcB9v6Xd4WXaeGjGVVoH9mWIfMxEjcwoe2hnsppJkWP79/8s EcIIkqh/o9f1cqzaVPR/P3INmi5xOATua0epmRHPYxHu7KiwUjbK03WZ7lyo7Ezsf+Qn bS6/+3JrSH8e9OlDO2MPFlAf6yW9BnlARzIz6mdwpzfHoVqiMudrAGTSdmEj1QyNfQUh k4+NhAvdQYjXqelxa5oYAkTng5NNqD/zBcwKOF+kOmyYLbvcQMyfcSxtgT97oUeCZWvh KuDg== X-Gm-Message-State: AOJu0YyE/QnPu3IwFT//u7/zYRUcLWuqu2/ZgTHQoT95LJMk1lQOSzg5 Mu4NOBd8ecwApwpa+1PXotoR+mLSpIx2R23YbXh6UQodeFiu+JCkSlut5fPBJzj10Z1/dqUOqZw c X-Google-Smtp-Source: AGHT+IG16VkHO7QxONHbiXbG/4zAA7oaZ+b6IrUr3+dlfXp4U4jmWFSYyE3qrFqAybYX1NDcyV/iKw== X-Received: by 2002:a17:90b:3105:b0:28f:fbdb:5229 with SMTP id gc5-20020a17090b310500b0028ffbdb5229mr1569235pjb.66.1705939903876; Mon, 22 Jan 2024 08:11:43 -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, Daniel Henrique Barboza Subject: [PATCH v4 09/13] target/riscv/insn_trans/trans_rvv.c.inc: use 'vlenb' in MAXSZ() Date: Mon, 22 Jan 2024 13:11:03 -0300 Message-ID: <20240122161107.26737-10-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122161107.26737-1-dbarboza@ventanamicro.com> References: <20240122161107.26737-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::1032; envelope-from=dbarboza@ventanamicro.com; helo=mail-pj1-x1032.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: 1705939978715100001 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 Reviewed-by: Alistair Francis --- 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 17:43:05 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=1705939971; cv=none; d=zohomail.com; s=zohoarc; b=fBqZyQ25u1oOkQbArMTcfdf1EodOykxNl6CkSipILECfD2QofbJqqlW8SBV13CY59+LMprkSyL+08AlV33+5LCqOTgEaVBJde4LHz/VKBgjMqc/oPX5sHrBG/A0lu06fuEfaeRntgIa/gEOLp+TDJHmHs8Q89xVDGS3UlpDZFrg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705939971; 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=KcOoJBxtOmItyxwzRVxYTpNYgBui/7NGS4TVsI5tRuk=; b=A3ekAtevxu6XvhpT82MwbFY7NobxYkrouohXf3/b1Fb2VPYu2GgWUYa3NpbnhIPjwzino9N7LIc83ktTWgVHPyHAahSHvYcOHUfQC+/5LZEtBN4QlyyWQ/r2gLLjn6DgblCsfQOEd8K71w1bfaB5CVAuJC//N8igRbx2G06j5co= 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 1705939971035694.5613781764536; Mon, 22 Jan 2024 08:12:51 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rRwtr-0006al-Tj; Mon, 22 Jan 2024 11:11:51 -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 1rRwtr-0006aa-37 for qemu-devel@nongnu.org; Mon, 22 Jan 2024 11:11:51 -0500 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rRwtp-0005MV-JJ for qemu-devel@nongnu.org; Mon, 22 Jan 2024 11:11:50 -0500 Received: by mail-pj1-x1031.google.com with SMTP id 98e67ed59e1d1-2906dffd8ddso1578388a91.3 for ; Mon, 22 Jan 2024 08:11:49 -0800 (PST) Received: from grind.. ([152.234.127.94]) by smtp.gmail.com with ESMTPSA id db3-20020a17090ad64300b0028e245501e7sm9866446pjb.4.2024.01.22.08.11.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 08:11:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1705939907; x=1706544707; 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=KcOoJBxtOmItyxwzRVxYTpNYgBui/7NGS4TVsI5tRuk=; b=j1P6HW0XAxPRrGGsAMHsRdbYrzzPg0CMZBtdpM4cwielvn8qCY8RhnvKBP/sTl80jb X0A4LPYXPKGvX27rsns7myN7cCXdwDYQRvJr2WfO6i2a+gSzh141UCnYlPSmZ6I7kj3D uXJK2LuuM432CWbbQixruNz9vn84LVfpJXqR4wXA5xixue0E2ejulrjE0xAY9+3g3oPD r0uavvgKvJtD/gD1SxWRTqJDVdiEOx3A68BtPL1HO0cyohVxwKBDQ9BXDmK8HtjOU07g npiIivMuJ9SWvnJBIYhVASREEQUw8IlbIvw3zAOAFUWaEAQaZtRmDhCfC4QtSNgn1eNE UH7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705939907; x=1706544707; 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=KcOoJBxtOmItyxwzRVxYTpNYgBui/7NGS4TVsI5tRuk=; b=KcOg8kiM+j/5lDcxkX+RipK55xJpF52lhyY0nPNZPmrE2/NPItQLvVJqgwSrI/5AVB zERoi6k2NROoSGZXFK5StreLVEoHVIJonujYq7iDmtnkAVmDsGiU076r0Z6a/YpObaT4 t/5utBL2TCtMyI53xDD6D7Tu7h3MRCpNL5x+pdSJCiy5B7sB02ASh6DGwFGN1STGOY2n TLjBm9HQzoyUwnt/EGZQuc6TsOA0mZ8kZlCu07ZZay6Z6P3bCTS/ZOv+DZq/ruKQosAj GUhR7OsFS3IdN7HM/xRYPpp/+V1/VVyiThkrOV9O3XNriyUGzjbpesAAZU2pUiru+0CP TJaw== X-Gm-Message-State: AOJu0Yz9ycvTh9+XqiGmq5WWSrZNeG447INPVqzM/xaKbfcL9/UxoaT9 fiqBSr/Z0uteCMJWyuxfBLLfa5+kReFKzVAoFMBZZAx5OYbn6J1lK2vZ3gdcI63yIdOIdKQCELc r X-Google-Smtp-Source: AGHT+IGOXZAifSExYp6cN2TXawYHcelH2S/9zYo2uKShw0Ee3l1+cHC5ZE8e1PRiM/JVtwL/Ad+GDQ== X-Received: by 2002:a17:90a:af92:b0:290:ab28:8079 with SMTP id w18-20020a17090aaf9200b00290ab288079mr936507pjq.86.1705939906926; Mon, 22 Jan 2024 08:11:46 -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, Daniel Henrique Barboza Subject: [PATCH v4 10/13] target/riscv/cpu.h: use 'vlenb' in vext_get_vlmax() Date: Mon, 22 Jan 2024 13:11:04 -0300 Message-ID: <20240122161107.26737-11-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122161107.26737-1-dbarboza@ventanamicro.com> References: <20240122161107.26737-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::1031; envelope-from=dbarboza@ventanamicro.com; helo=mail-pj1-x1031.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: 1705939972727100004 Content-Type: text/plain; charset="utf-8" Rename the existing 'sew' variable to 'vsew' for extra clarity. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- target/riscv/cpu.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 05e83c4ac9..71696762e3 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -692,9 +692,16 @@ static inline RISCVMXL riscv_cpu_sxl(CPURISCVState *en= v) */ static inline uint32_t vext_get_vlmax(RISCVCPU *cpu, target_ulong vtype) { - uint8_t sew =3D FIELD_EX64(vtype, VTYPE, VSEW); + uint8_t vsew =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); + uint32_t vlen =3D cpu->cfg.vlenb << 3; + + /* + * We need to use 'vlen' instead of 'vlenb' to + * preserve the '+ 3' in the formula. Otherwise + * we risk a negative shift if vsew < lmul. + */ + return vlen >> (vsew + 3 - lmul); } =20 void cpu_get_tb_cpu_state(CPURISCVState *env, vaddr *pc, --=20 2.43.0 From nobody Tue Nov 26 17:43:05 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=1705940008; cv=none; d=zohomail.com; s=zohoarc; b=VQdvP2VZ8eh4VXPHRhJZxW4Q18hv+Q109g7wNCjva/8z7PTHf01tJovcCd01Rdl+AfiBGQpDx+TB9tutPghtHLnRJbrulbrIDvRhSWd9yD/aCT5qXs5K/IqXcL2XO9sWYhNmW1f3lrQQJr9SPgD5jD8bChECWob9egYG2rVUU3s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705940008; 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=IVS89ICN4mvwyaEKJcyMUTMk1Ho3XQmzlZwO2q1EX0I=; b=OHtAK30R8TycrLNCoZk25Y6ohu5M8x+7jfZNIV5amqCHwYBTRtejJftQOh+aQiYSMgOqqVjbIXM1UFx22akMYveoJohyTMrzUvcnFdfCgLu9+8LeilJyNWV8jKtoPAZLDXMToVRMhMXJhYlx71h4pQqBctMDJeK1pVjdtSBmg0A= 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 1705940008182520.7845273542135; Mon, 22 Jan 2024 08:13:28 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rRwtu-0006bx-PT; Mon, 22 Jan 2024 11:11:54 -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 1rRwtt-0006bH-73 for qemu-devel@nongnu.org; Mon, 22 Jan 2024 11:11:53 -0500 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rRwtr-0005Mm-Id for qemu-devel@nongnu.org; Mon, 22 Jan 2024 11:11:52 -0500 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1d50d0c98c3so34335955ad.1 for ; Mon, 22 Jan 2024 08:11:51 -0800 (PST) Received: from grind.. ([152.234.127.94]) by smtp.gmail.com with ESMTPSA id db3-20020a17090ad64300b0028e245501e7sm9866446pjb.4.2024.01.22.08.11.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 08:11:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1705939910; x=1706544710; 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=IVS89ICN4mvwyaEKJcyMUTMk1Ho3XQmzlZwO2q1EX0I=; b=VlmMgvyIo2WoAfi1CNocuVP4FqhHV4zrWv4r4ECXerODmJPCT/VJJZ7WwZl4mjjBd9 ch7r49PogdLjV/S7TZfb4uT4Thpny+W9trptXerXcIA+IVt0tEafhatHparuW/HtM012 t0tm0qRSLilx68M6Q2F2VZl2xmYACjN/N2ppVxsWeLo77bzo0KuOyRMV/nTTDbMdXolc kDRfuJxTOj/Pt4lsy70NcbWDb2Kr+dVAbqqIjMmT38f8zMfENbbB4lZQzrq32xjIDErL ICd9RPDozV3ptbQkNmYfFvi84laCNVH3sjUaqLRWsSj9KkHUyRtM3abDWM/ObLsxWNuZ wxuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705939910; x=1706544710; 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=IVS89ICN4mvwyaEKJcyMUTMk1Ho3XQmzlZwO2q1EX0I=; b=HI025tj3F0NCefurN2+85EOg98SVhBoCSy4fuvb4hbDNApulWd/3XybDoxf1aE8Tts +LDghn4nb3oCzee7u304IbyvTl/6YMGRZdArt8+5aJH7+rmxegeDKQ6+KSo5DG3+0KlL 5i13n7x8Yl9IN/3c4dOw7bUblVI8KD5y+E/OJVn8vLgny80HfEEC0CySb45HlzIX9EAB IGbsycUjGPZ4NjQbc7uaRiyhQ60a07Zg4Iveh4XTZNRtjF3WXyRjtPirfU85Z6ocpEOt gziKDZ44rwRIeCRfT7fgtFdzttWU4ZMZn+GNM3R80JCqSAkQlVZa0zoYWK7E7AHKxlUu jaHw== X-Gm-Message-State: AOJu0YzeRKN4Ua2Dl5kNUaB2IqJ43VPXagqX8Rkf1iK7XWej53Gjrpg1 QlMeivaCvkOs4nLCIxcb2CzhmQjt40cMzkcvNBLEi/sbr2m/Wog00901yttQAAiQo199PtUh49A k X-Google-Smtp-Source: AGHT+IFyWpht4S308kv2amz6crFcbhYRRfBka7/dPVJ0UsUjROAJ8IUcnqtWObqLsqt77XZG/prvfg== X-Received: by 2002:a17:90a:8ca:b0:290:4b14:3638 with SMTP id 10-20020a17090a08ca00b002904b143638mr5115290pjn.12.1705939909860; Mon, 22 Jan 2024 08:11:49 -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, Daniel Henrique Barboza Subject: [PATCH v4 11/13] target/riscv: change vext_get_vlmax() arguments Date: Mon, 22 Jan 2024 13:11:05 -0300 Message-ID: <20240122161107.26737-12-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122161107.26737-1-dbarboza@ventanamicro.com> References: <20240122161107.26737-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::62e; envelope-from=dbarboza@ventanamicro.com; helo=mail-pl1-x62e.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: 1705940008802100001 Content-Type: text/plain; charset="utf-8" We'll re-use the logic froim vext_get_vlmax() in 2 other occurrences in the next patch, but first we need to make it independent of both 'cpu' and 'vtype'. To do that, add 'vlenb', 'vsew' and 'lmul' as parameters instead. Adapt the two existing callers. In cpu_get_tb_cpu_state(), rename 'sew' to 'vsew' to be less ambiguous about what we're encoding into *pflags. In HELPER(vsetvl) the following changes were made: - add a 'vsew' var to store vsew. Use it in the shift to get 'sew'; - the existing 'lmul' var was renamed to 'vlmul'; - add a new 'lmul' var to store 'lmul' encoded like DisasContext:lmul. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- target/riscv/cpu.h | 7 +++---- target/riscv/cpu_helper.c | 11 +++++++---- target/riscv/vector_helper.c | 16 ++++++++++------ 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 71696762e3..5138187727 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -690,11 +690,10 @@ static inline RISCVMXL riscv_cpu_sxl(CPURISCVState *e= nv) * =3D 256 >> 7 * =3D 2 */ -static inline uint32_t vext_get_vlmax(RISCVCPU *cpu, target_ulong vtype) +static inline uint32_t vext_get_vlmax(uint32_t vlenb, uint32_t vsew, + int8_t lmul) { - uint8_t vsew =3D FIELD_EX64(vtype, VTYPE, VSEW); - int8_t lmul =3D sextract32(FIELD_EX64(vtype, VTYPE, VLMUL), 0, 3); - uint32_t vlen =3D cpu->cfg.vlenb << 3; + uint32_t vlen =3D vlenb << 3; =20 /* * We need to use 'vlen' instead of 'vlenb' to diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c index c7cc7eb423..8da9104da4 100644 --- a/target/riscv/cpu_helper.c +++ b/target/riscv/cpu_helper.c @@ -81,13 +81,16 @@ void cpu_get_tb_cpu_state(CPURISCVState *env, vaddr *pc, * which is not supported by GVEC. So we set vl_eq_vlmax flag to t= rue * only when maxsz >=3D 8 bytes. */ - uint32_t vlmax =3D vext_get_vlmax(cpu, env->vtype); - uint32_t sew =3D FIELD_EX64(env->vtype, VTYPE, VSEW); - uint32_t maxsz =3D vlmax << sew; + + /* lmul encoded as in DisasContext::lmul */ + int8_t lmul =3D sextract32(FIELD_EX64(env->vtype, VTYPE, VLMUL), 0= , 3); + uint32_t vsew =3D FIELD_EX64(env->vtype, VTYPE, VSEW); + uint32_t vlmax =3D vext_get_vlmax(cpu->cfg.vlenb, vsew, lmul); + uint32_t maxsz =3D vlmax << vsew; bool vl_eq_vlmax =3D (env->vstart =3D=3D 0) && (vlmax =3D=3D env->= vl) && (maxsz >=3D 8); flags =3D FIELD_DP32(flags, TB_FLAGS, VILL, env->vill); - flags =3D FIELD_DP32(flags, TB_FLAGS, SEW, sew); + flags =3D FIELD_DP32(flags, TB_FLAGS, SEW, vsew); flags =3D FIELD_DP32(flags, TB_FLAGS, LMUL, FIELD_EX64(env->vtype, VTYPE, VLMUL)); flags =3D FIELD_DP32(flags, TB_FLAGS, VL_EQ_VLMAX, vl_eq_vlmax); diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c index b13be1541a..718a0c711a 100644 --- a/target/riscv/vector_helper.c +++ b/target/riscv/vector_helper.c @@ -35,16 +35,18 @@ target_ulong HELPER(vsetvl)(CPURISCVState *env, target_= ulong s1, { int vlmax, vl; RISCVCPU *cpu =3D env_archcpu(env); - uint64_t lmul =3D FIELD_EX64(s2, VTYPE, VLMUL); - uint16_t sew =3D 8 << FIELD_EX64(s2, VTYPE, VSEW); + uint64_t vlmul =3D FIELD_EX64(s2, VTYPE, VLMUL); + uint8_t vsew =3D FIELD_EX64(s2, VTYPE, VSEW); + uint16_t sew =3D 8 << vsew; uint8_t ediv =3D FIELD_EX64(s2, VTYPE, VEDIV); int xlen =3D riscv_cpu_xlen(env); bool vill =3D (s2 >> (xlen - 1)) & 0x1; target_ulong reserved =3D s2 & MAKE_64BIT_MASK(R_VTYPE_RESERVED_SHIFT, xlen - 1 - R_VTYPE_RESERVED_SH= IFT); + int8_t lmul; =20 - if (lmul & 4) { + if (vlmul & 4) { /* * Fractional LMUL, check: * @@ -53,8 +55,8 @@ target_ulong HELPER(vsetvl)(CPURISCVState *env, target_ul= ong s1, * (vlenb << 3) >> (8 - lmul) >=3D sew * vlenb >> (8 - 3 - lmul) >=3D sew */ - if (lmul =3D=3D 4 || - cpu->cfg.vlenb >> (8 - 3 - lmul) < sew) { + if (vlmul =3D=3D 4 || + cpu->cfg.vlenb >> (8 - 3 - vlmul) < sew) { vill =3D true; } } @@ -68,7 +70,9 @@ target_ulong HELPER(vsetvl)(CPURISCVState *env, target_ul= ong s1, return 0; } =20 - vlmax =3D vext_get_vlmax(cpu, s2); + /* lmul encoded as in DisasContext::lmul */ + lmul =3D sextract32(FIELD_EX64(s2, VTYPE, VLMUL), 0, 3); + vlmax =3D vext_get_vlmax(cpu->cfg.vlenb, vsew, lmul); if (s1 <=3D vlmax) { vl =3D s1; } else { --=20 2.43.0 From nobody Tue Nov 26 17:43:05 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=1705940148; cv=none; d=zohomail.com; s=zohoarc; b=A+iIyJm/MEy+kym3OyYRNpC0u9BCKDJ3bvIRcujMSvtLHZK1dDogXV68vl8Mt0IVu4ZucMf4Y7kKysRyc+gJENQd+qUbSy+xc6PWI7gf4rPNYCqa3pJAGH8iUKAjfh5pAOoMfoVTkAg5xplxo6xJg3L2uJjuw77EMwkS4ct4t5o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705940148; 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=MoumEW5HsIW4QWE94CfwPjvE1lhjv4Qgw5NHfZpjqhU=; b=d1yCdfYO/p+FTUElFIYBQakZ80ttupQ8uRpYAXY9DouRbpLiID2csCybaO3oFdzDbbStWvrqD797xsNjz39X1SaZKUXMWMTSQSeXN7ozj8CK4/bkYj3iuRwNt6IvnvwLxYxeu+zOvhh1zV/UP15vqLfFJXxwZ0spjvdzQtLJKBg= 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 1705940148024878.7739446330295; Mon, 22 Jan 2024 08:15:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rRwtx-0006cL-BL; Mon, 22 Jan 2024 11:11: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 1rRwtw-0006c7-3c for qemu-devel@nongnu.org; Mon, 22 Jan 2024 11:11:56 -0500 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rRwtu-0005NJ-Ma for qemu-devel@nongnu.org; Mon, 22 Jan 2024 11:11:55 -0500 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-5c229dabbb6so1142261a12.0 for ; Mon, 22 Jan 2024 08:11:54 -0800 (PST) Received: from grind.. ([152.234.127.94]) by smtp.gmail.com with ESMTPSA id db3-20020a17090ad64300b0028e245501e7sm9866446pjb.4.2024.01.22.08.11.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 08:11:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1705939913; x=1706544713; 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=MoumEW5HsIW4QWE94CfwPjvE1lhjv4Qgw5NHfZpjqhU=; b=NKPkNv1C7x8F6cIdH+cHNBu1/iHDZD150dk4QHd/EYEsvu0nGrzMRV73V/I66xEy+T 5EG2MW4j6RcEcg9xu2XUy6uXDoa10oXPFR7JZ/KnAjDILWjpzG14vVj51ZwvbWHEF3ue 7a5zI0fti67NQugbtGxLkLaxZ+Q65Y37D7/ekxQp8QguyLVlWlcQYTKjYdRUkTxsiHud Q4lW6cVBeHFR9AEzVkmJU9+J4wShSKfY4KYvlYcyvdKjDQeScPDBBpE4sKehp1xIXWZx jiUlIdl6Vm7KF+/iBKHqT8wZNy/7Ipbmn3KlQcsgy8VveSVuQ/CP8YEOKPh4+QPTSLVJ VOjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705939913; x=1706544713; 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=MoumEW5HsIW4QWE94CfwPjvE1lhjv4Qgw5NHfZpjqhU=; b=qg6ZO6XnK8FXg4kk263GnzhMgUGvWz+FM7NcLxLSdsl9y3NYV9JBOxq3+cubaU+1sr gIDBSJEuFEHJxPMIqLp0D9OvSCRv24wTy17inTdTrlkvseF6TBlD7mALNMlvdAUUpykr asi/+llZT++ccHr7xVgz6bdV9c76umkhVMFt0M/W+XxDJDm9/zK4cFPmj647/Nrw+rfi +N8Wj73kgnJU8TeBj+ywfNUgGRM/ZZgi/6XihUZLWx9TYk3Yk07KeiGdQC+srYSG5EmZ ZFR5/DBECeVNRgeWjPUfMR0rqqcKzzA9UC7Bpt+Aj1tl0sEmKyIfavitHNJenj0KLh2E 3ntw== X-Gm-Message-State: AOJu0YxLvRtGz5SYpe2IJeH3MR68az9QryDjuo9vuyYTZfP2LvN3vVqm nrvZYCOJ/2G084/s0dp+NHYtYol1C+coaIdl+uXyXqkPBwxjcXP3Bh8M+V0XzTMzyPPSCR01RbO v X-Google-Smtp-Source: AGHT+IGxcaR7KNIDvvgNwS2yu+y3viUgylCkKOjmMv4Y7F9/GundpI/W4QnOULIjCTZJ9FrcKjI7BA== X-Received: by 2002:a17:90a:ba87:b0:290:10b:4585 with SMTP id t7-20020a17090aba8700b00290010b4585mr1538023pjr.54.1705939913042; Mon, 22 Jan 2024 08:11:53 -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, Daniel Henrique Barboza Subject: [PATCH v4 12/13] trans_rvv.c.inc: use vext_get_vlmax() in trans_vrgather_v*() Date: Mon, 22 Jan 2024 13:11:06 -0300 Message-ID: <20240122161107.26737-13-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122161107.26737-1-dbarboza@ventanamicro.com> References: <20240122161107.26737-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::530; envelope-from=dbarboza@ventanamicro.com; helo=mail-pg1-x530.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: 1705940149257100001 Content-Type: text/plain; charset="utf-8" Use the helper instead of calculating vlmax by hand. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- 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..9e101ab434 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 vext_get_vlmax(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 vext_get_vlmax(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 17:43:05 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=1705940012; cv=none; d=zohomail.com; s=zohoarc; b=ZN5HV/Pu6XtMY4RoEV2SZy5+A7QBx+9qq3qcy4hJens7gxtd01kAo81otq3vNCjTUxaxkWDkbmr5GULhsPsDQ3IIczZVBDDzk122OISaz7FHqaDpdUfwujXTI8eUKBpTeF59HFC9r9furw3X2Nm6uTdzOWrcHe9BHgod0WyMufk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705940012; 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=Rpdpiw7feyllSaKykryPp2iLp2Z3weCX4u5s8qlFyP0=; b=BBwK/4Iw0Q6TDWNNUhEIeTyU+3hdg5niwmIOHe1rc7gS8zY3sSPT97+T0c4+3/8Y+zWwvG9qjvd3qIFM9wwPrZ3WHaxqDhAs1u3my6xzP6W4JSA0pfB8jhYZBunA5mKvfRyuUCO37MhjF/Y0l1p16CeqyS7pYyMdR35WLmYoUDY= 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 1705940012044117.41382570159135; Mon, 22 Jan 2024 08:13:32 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rRwu2-0006le-1W; Mon, 22 Jan 2024 11:12: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 1rRwu0-0006km-Jo for qemu-devel@nongnu.org; Mon, 22 Jan 2024 11:12:00 -0500 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rRwtx-0005PN-VP for qemu-devel@nongnu.org; Mon, 22 Jan 2024 11:12:00 -0500 Received: by mail-pj1-x102a.google.com with SMTP id 98e67ed59e1d1-2901ceb0d33so3007209a91.1 for ; Mon, 22 Jan 2024 08:11:57 -0800 (PST) Received: from grind.. ([152.234.127.94]) by smtp.gmail.com with ESMTPSA id db3-20020a17090ad64300b0028e245501e7sm9866446pjb.4.2024.01.22.08.11.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 08:11:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1705939916; x=1706544716; 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=Rpdpiw7feyllSaKykryPp2iLp2Z3weCX4u5s8qlFyP0=; b=RFd0oH7sPm7WTokM75/puP4Eh4LSC3QhzpLtiQx+eL1wuh1qSVdhukQtSmeuSPnEZU aVqHRS9zSgYMK2K4mCAQ2GxaV/WyqWlRBJtesE++Lid/GKsvIOQquDJbLCbWKLM1APE7 +EEMBYO3LUXlmJoD6Kap9GRnKDoXeF28fVI1y0+gAq8YEVTvKX5xMCJV0WidP0rYSR2m Q1tkifnvZNvnOuVKK9SnuNx8B6NsVVgV3GB7gQDmzoieFI0aGfvrQPHTimFKFyctWvm9 lVU6Uz7LWoSAHRHcX23zoCOXQvR2y9Y1057KyOydeV7DCucW3L7JkFxHKBD7LJdu54Uu SJ0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705939916; x=1706544716; 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=Rpdpiw7feyllSaKykryPp2iLp2Z3weCX4u5s8qlFyP0=; b=Y5nBo+dIa/yfV3pWM7Kh3CNEmw0B4qAxLHST0rXpP0gk5fr9Tv3W5eAHJLbbtW82CK 0WsZysFnyTWguSS4xBe3tcVrudlJSxj4uFUKvbdOFtEMUapI+rkUgwqSLlID5+8BG5ZH 2CXW0CNNearfD5GMAcMG2Rwv1eLcPR+sMdWp9qBOg3QBHKmPAEc4l1EUBL+5yNxBGcKp LAaoyxGts0z7sRKazlxLX55R63pOtfD2Pv8Y1r3+PweMox6lv3XZzbDL/SDeS5gN2hdK vH0Br3jEMct/6AkJEaG4Ok6l6OsnHBh2BrjRCi/xtPu6x5vxmNPSmT6eyXHi5VLNv+xl tK/w== X-Gm-Message-State: AOJu0YxFTWjEajDFs5VB9bF/ppK1XlsH92XPeZ0qHrk9OW+gu3UhPbLr E/+MHYipe4/mHuhO4SDI6u6NcHCXJk1hGFqGo4awxhhkNSCaXb4N+EgdtXcL9Yzl4lPOM21MQE+ x X-Google-Smtp-Source: AGHT+IF8b3aBPFYLpS/uqpjZeKB4oVtLMteFftP+wTtD6U14lEJB/uN/SiRZVcgvloqAEwRCgsMSsA== X-Received: by 2002:a17:90b:3642:b0:28d:fd67:fa9c with SMTP id nh2-20020a17090b364200b0028dfd67fa9cmr5636082pjb.37.1705939916139; Mon, 22 Jan 2024 08:11:56 -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, Daniel Henrique Barboza Subject: [PATCH v4 13/13] target/riscv/cpu.c: remove cpu->cfg.vlen Date: Mon, 22 Jan 2024 13:11:07 -0300 Message-ID: <20240122161107.26737-14-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122161107.26737-1-dbarboza@ventanamicro.com> References: <20240122161107.26737-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::102a; envelope-from=dbarboza@ventanamicro.com; helo=mail-pj1-x102a.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: 1705940012802100010 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 Reviewed-by: Alistair Francis --- 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 89f2349eb4..88e8cc8681 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1319,7 +1319,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->cfg.cbom_blocksize =3D 64; @@ -1811,22 +1810,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 401ba0beba..da437975b4 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