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 v2 08/12] target/riscv/vector_helper.c: use vlenb in HELPER(vsetvl)
Date: Tue, 16 Jan 2024 09:57:21 +1100 [thread overview]
Message-ID: <3920915d-3ee8-4dbb-9d39-820b7abf273d@linaro.org> (raw)
In-Reply-To: <20240115222528.257342-9-dbarboza@ventanamicro.com>
On 1/16/24 09:25, 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. Adjust the shift
> to use vlenb.
>
> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
> ---
> target/riscv/vector_helper.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
> index cb944229b0..9e3ae4b5d3 100644
> --- a/target/riscv/vector_helper.c
> +++ b/target/riscv/vector_helper.c
> @@ -45,9 +45,13 @@ target_ulong HELPER(vsetvl)(CPURISCVState *env, target_ulong s1,
> xlen - 1 - R_VTYPE_RESERVED_SHIFT);
>
> if (lmul & 4) {
> - /* Fractional LMUL - check LMUL * VLEN >= SEW */
> + /*
> + * Fractional LMUL: check VLEN * LMUL >= SEW,
> + * or VLEN * (8 - lmul) >= SEW. Using VLENB we
> + * need 3 less shifts rights.
The last sentence is structured oddly. Perhaps
Using VLENB, we decrease the right shift by 3
or perhaps just show the expansion:
/*
* Fractional LMUL, check
*
* VLEN * LMUL >= SEW
* VLEN >> (8 - lmul) >= sew
* (vlenb << 3) >> (8 - lmul) >= sew
* vlenb >> (8 - 3 - lmul) >= sew
*/
Anyway,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
> + */
> if (lmul == 4 ||
> - cpu->cfg.vlen >> (8 - lmul) < sew) {
> + cpu->cfg.vlenb >> (8 - 3 - lmul) < sew) {
> vill = true;
> }
> }
next prev parent reply other threads:[~2024-01-15 22:58 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-15 22:25 [PATCH v2 00/12] target/riscv: add 'cpu->cfg.vlenb', remove 'cpu->cfg.vlen' Daniel Henrique Barboza
2024-01-15 22:25 ` [PATCH v2 01/12] target/riscv: add 'vlenb' field in cpu->cfg Daniel Henrique Barboza
2024-01-15 22:33 ` Richard Henderson
2024-01-15 22:25 ` [PATCH v2 02/12] target/riscv/csr.c: use 'vlenb' instead of 'vlen' Daniel Henrique Barboza
2024-01-15 22:39 ` Richard Henderson
2024-01-15 22:25 ` [PATCH v2 03/12] target/riscv/gdbstub.c: use 'vlenb' instead of shifting 'vlen' Daniel Henrique Barboza
2024-01-15 22:39 ` Richard Henderson
2024-01-15 22:25 ` [PATCH v2 04/12] target/riscv/insn_trans/trans_rvbf16.c.inc: use cpu->cfg.vlenb Daniel Henrique Barboza
2024-01-15 22:40 ` Richard Henderson
2024-01-15 22:25 ` [PATCH v2 05/12] target/riscv/insn_trans/trans_rvv.c.inc: use 'vlenb' Daniel Henrique Barboza
2024-01-15 22:45 ` Richard Henderson
2024-01-15 22:25 ` [PATCH v2 06/12] target/riscv/insn_trans/trans_rvvk.c.inc: " Daniel Henrique Barboza
2024-01-15 22:47 ` Richard Henderson
2024-01-15 22:25 ` [PATCH v2 07/12] target/riscv/vector_helper.c: " Daniel Henrique Barboza
2024-01-15 22:48 ` Richard Henderson
2024-01-15 22:25 ` [PATCH v2 08/12] target/riscv/vector_helper.c: use vlenb in HELPER(vsetvl) Daniel Henrique Barboza
2024-01-15 22:57 ` Richard Henderson [this message]
2024-01-16 20:45 ` Daniel Henrique Barboza
2024-01-15 22:25 ` [PATCH v2 09/12] target/riscv/cpu.h: use 'vlenb' in vext_get_vlmax() Daniel Henrique Barboza
2024-01-15 22:58 ` Richard Henderson
2024-01-15 23:14 ` Richard Henderson
2024-01-16 17:52 ` Daniel Henrique Barboza
2024-01-15 22:25 ` [PATCH v2 10/12] target/riscv/insn_trans/trans_rvv.c.inc: use 'vlenb' in MAXSZ() Daniel Henrique Barboza
2024-01-15 23:02 ` Richard Henderson
2024-01-15 22:25 ` [PATCH v2 11/12] trans_rvv.c.inc: use 'vlenb' to calc vlmax in trans_vrgather_v*() Daniel Henrique Barboza
2024-01-15 22:25 ` [PATCH v2 12/12] target/riscv/cpu.c: remove cpu->cfg.vlen Daniel Henrique Barboza
2024-01-15 23:15 ` Richard Henderson
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=3920915d-3ee8-4dbb-9d39-820b7abf273d@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).