qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Daniel Henrique Barboza <dbarboza@ventanamicro.com>,
	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,
	max.chou@sifive.com
Subject: Re: [PATCH 09/13] target/riscv/cpu.h: use 'vlenb' in vext_get_vlmax()
Date: Sat, 13 Jan 2024 09:42:26 +1100	[thread overview]
Message-ID: <d0cc2c90-e401-460c-8883-7125c0506df7@linaro.org> (raw)
In-Reply-To: <20240112213812.173521-10-dbarboza@ventanamicro.com>

On 1/13/24 08:38, Daniel Henrique Barboza wrote:
> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
> ---
>   target/riscv/cpu.h | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
> index 11df226a00..628ef67d5f 100644
> --- a/target/riscv/cpu.h
> +++ b/target/riscv/cpu.h
> @@ -692,7 +692,8 @@ static inline uint32_t vext_get_vlmax(RISCVCPU *cpu, target_ulong vtype)
>   {
>       uint8_t sew = FIELD_EX64(vtype, VTYPE, VSEW);
>       int8_t lmul = sextract32(FIELD_EX64(vtype, VTYPE, VLMUL), 0, 3);
> -    return cpu->cfg.vlen >> (sew + 3 - lmul);
> +    /* vlen = vlenb << 3 */
> +    return (cpu->cfg.vlenb << 3) >> (sew + 3 - lmul);
>   }

Better to simplify the arithmetic:

-    return cpu->cfg.vlen >> (sew + 3 - lmul);
+    return cpu->cfg.vlenb >> (sew - lmul);


r~


  reply	other threads:[~2024-01-12 22:42 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-12 21:37 [PATCH 00/13] target/riscv: add 'cpu->cfg.vlenb', remove 'cpu->cfg.vlen' Daniel Henrique Barboza
2024-01-12 21:38 ` [PATCH 01/13] target/riscv: add 'vlenb' field in cpu->cfg Daniel Henrique Barboza
2024-01-12 21:38 ` [PATCH 02/13] target/riscv/csr.c: use 'vlenb' instead of 'vlen' Daniel Henrique Barboza
2024-01-12 21:38 ` [PATCH 03/13] target/riscv/gdbstub.c: use 'vlenb' instead of shifting 'vlen' Daniel Henrique Barboza
2024-01-12 21:38 ` [PATCH 04/13] target/riscv/insn_trans/trans_rvbf16.c.inc: use cpu->cfg.vlenb Daniel Henrique Barboza
2024-01-12 21:38 ` [PATCH 05/13] target/riscv/insn_trans/trans_rvv.c.inc: use 'vlenb' Daniel Henrique Barboza
2024-01-12 21:38 ` [PATCH 06/13] target/riscv/insn_trans/trans_rvvk.c.inc: " Daniel Henrique Barboza
2024-01-12 21:38 ` [PATCH 07/13] target/riscv/vector_helper.c: " Daniel Henrique Barboza
2024-01-12 21:38 ` [PATCH 08/13] target/riscv/vector_helper.c: use vlenb in HELPER(vsetvl) Daniel Henrique Barboza
2024-01-12 22:40   ` Richard Henderson
2024-01-12 21:38 ` [PATCH 09/13] target/riscv/cpu.h: use 'vlenb' in vext_get_vlmax() Daniel Henrique Barboza
2024-01-12 22:42   ` Richard Henderson [this message]
2024-01-12 21:38 ` [PATCH 10/13] target/riscv/insn_trans/trans_rvv.c.inc: use 'vlenb' in MAXSZ() Daniel Henrique Barboza
2024-01-12 22:45   ` Richard Henderson
2024-01-15 13:51     ` Daniel Henrique Barboza
2024-01-12 21:38 ` [PATCH 11/13] trans_rvv.c.inc: remove vlmax arg from vec_element_loadx() Daniel Henrique Barboza
2024-01-12 22:51   ` Richard Henderson
2024-01-15 17:57     ` Daniel Henrique Barboza
2024-01-15 20:16       ` Richard Henderson
2024-01-12 21:38 ` [PATCH 12/13] trans_rvv.c.inc: use cpu_vl in trans_vrgather_vi() Daniel Henrique Barboza
2024-01-12 21:38 ` [PATCH 13/13] target/riscv/cpu.c: remove cpu->cfg.vlen Daniel Henrique Barboza

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d0cc2c90-e401-460c-8883-7125c0506df7@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=alistair.francis@wdc.com \
    --cc=bmeng@tinylab.org \
    --cc=dbarboza@ventanamicro.com \
    --cc=liwei1518@gmail.com \
    --cc=max.chou@sifive.com \
    --cc=palmer@rivosinc.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=zhiwei_liu@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).