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 08/13] target/riscv/vector_helper.c: use vlenb in HELPER(vsetvl)
Date: Sat, 13 Jan 2024 09:40:59 +1100 [thread overview]
Message-ID: <4b0847ec-467f-4fcb-8deb-01ec435d82ad@linaro.org> (raw)
In-Reply-To: <20240112213812.173521-9-dbarboza@ventanamicro.com>
On 1/13/24 08:38, Daniel Henrique Barboza wrote:
> Use the new 'vlenb' CPU config to validate fractional LMUL. The original
> comparison is done with 'vlen' and 'sew', both in bits. Use sew/8, or
> sew in bytes, to do a direct comparison with vlenb.
>
> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
> ---
> target/riscv/vector_helper.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
> index cb944229b0..0c1a485d1e 100644
> --- a/target/riscv/vector_helper.c
> +++ b/target/riscv/vector_helper.c
> @@ -45,9 +45,12 @@ target_ulong HELPER(vsetvl)(CPURISCVState *env, target_ulong s1,
> xlen - 1 - R_VTYPE_RESERVED_SHIFT);
>
> if (lmul & 4) {
> - /* Fractional LMUL - check LMUL * VLEN >= SEW */
> - if (lmul == 4 ||
> - cpu->cfg.vlen >> (8 - lmul) < sew) {
> + /*
> + * Fractional LMUL - check LMUL * VLEN >= SEW, or
> + * vlen >> (8 - lmul) < sew. We have 'vlenb', so
> + * compare it with sew in bytes.
> + */
> + if (lmul == 4 || cpu->cfg.vlenb >> (8 - lmul) < (sew << 3)) {
You're shifting sew the wrong direction. But better to simply adjust the vlenb shift:
- cpu->cfg.vlen >> (8 - lmul) < sew
+ cpu->cfg.vlenb >> (8 - 3 - lmul) < sew
r~
next prev parent 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 [this message]
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
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=4b0847ec-467f-4fcb-8deb-01ec435d82ad@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).