[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 08/13] target/riscv/vector_helper.c: use vlenb in HELPER(vsetv
From: |
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 |
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>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
---
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_ulong
s1,
xlen - 1 - R_VTYPE_RESERVED_SHIFT);
if (lmul & 4) {
- /* Fractional LMUL - check LMUL * VLEN >= SEW */
+ /*
+ * Fractional LMUL, check:
+ *
+ * VLEN * LMUL >= SEW
+ * VLEN >> (8 - lmul) >= sew
+ * (vlenb << 3) >> (8 - lmul) >= sew
+ * vlenb >> (8 - 3 - lmul) >= sew
+ */
if (lmul == 4 ||
- cpu->cfg.vlen >> (8 - lmul) < sew) {
+ cpu->cfg.vlenb >> (8 - 3 - lmul) < sew) {
vill = true;
}
}
--
2.43.0
- [PATCH v4 00/13] target/riscv: add 'cpu->cfg.vlenb', remove, Daniel Henrique Barboza, 2024/01/22
- [PATCH v4 01/13] target/riscv: add 'vlenb' field in cpu->cfg, Daniel Henrique Barboza, 2024/01/22
- [PATCH v4 02/13] target/riscv/csr.c: use 'vlenb' instead of 'vlen', Daniel Henrique Barboza, 2024/01/22
- [PATCH v4 03/13] target/riscv/gdbstub.c: use 'vlenb' instead of shifting 'vlen', Daniel Henrique Barboza, 2024/01/22
- [PATCH v4 04/13] target/riscv/insn_trans/trans_rvbf16.c.inc: use cpu->cfg.vlenb, Daniel Henrique Barboza, 2024/01/22
- [PATCH v4 05/13] target/riscv/insn_trans/trans_rvv.c.inc: use 'vlenb', Daniel Henrique Barboza, 2024/01/22
- [PATCH v4 06/13] target/riscv/insn_trans/trans_rvvk.c.inc: use 'vlenb', Daniel Henrique Barboza, 2024/01/22
- [PATCH v4 07/13] target/riscv/vector_helper.c: use 'vlenb', Daniel Henrique Barboza, 2024/01/22
- [PATCH v4 08/13] target/riscv/vector_helper.c: use vlenb in HELPER(vsetvl),
Daniel Henrique Barboza <=
- [PATCH v4 09/13] target/riscv/insn_trans/trans_rvv.c.inc: use 'vlenb' in MAXSZ(), Daniel Henrique Barboza, 2024/01/22
- [PATCH v4 10/13] target/riscv/cpu.h: use 'vlenb' in vext_get_vlmax(), Daniel Henrique Barboza, 2024/01/22
- [PATCH v4 11/13] target/riscv: change vext_get_vlmax() arguments, Daniel Henrique Barboza, 2024/01/22
- [PATCH v4 12/13] trans_rvv.c.inc: use vext_get_vlmax() in trans_vrgather_v*(), Daniel Henrique Barboza, 2024/01/22
- [PATCH v4 13/13] target/riscv/cpu.c: remove cpu->cfg.vlen, Daniel Henrique Barboza, 2024/01/22
- Re: [PATCH v4 00/13] target/riscv: add 'cpu->cfg.vlenb', remove, Alistair Francis, 2024/01/23