[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 08/13] target/riscv/vector_helper.c: use vlenb in HELPER(vsetvl)
From: |
Daniel Henrique Barboza |
Subject: |
[PATCH 08/13] target/riscv/vector_helper.c: use vlenb in HELPER(vsetvl) |
Date: |
Fri, 12 Jan 2024 18:38:07 -0300 |
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)) {
vill = true;
}
}
--
2.43.0
- [PATCH 00/13] target/riscv: add 'cpu->cfg.vlenb', remove 'cpu->cfg.vlen', Daniel Henrique Barboza, 2024/01/12
- [PATCH 01/13] target/riscv: add 'vlenb' field in cpu->cfg, Daniel Henrique Barboza, 2024/01/12
- [PATCH 02/13] target/riscv/csr.c: use 'vlenb' instead of 'vlen', Daniel Henrique Barboza, 2024/01/12
- [PATCH 03/13] target/riscv/gdbstub.c: use 'vlenb' instead of shifting 'vlen', Daniel Henrique Barboza, 2024/01/12
- [PATCH 04/13] target/riscv/insn_trans/trans_rvbf16.c.inc: use cpu->cfg.vlenb, Daniel Henrique Barboza, 2024/01/12
- [PATCH 05/13] target/riscv/insn_trans/trans_rvv.c.inc: use 'vlenb', Daniel Henrique Barboza, 2024/01/12
- [PATCH 06/13] target/riscv/insn_trans/trans_rvvk.c.inc: use 'vlenb', Daniel Henrique Barboza, 2024/01/12
- [PATCH 07/13] target/riscv/vector_helper.c: use 'vlenb', Daniel Henrique Barboza, 2024/01/12
- [PATCH 08/13] target/riscv/vector_helper.c: use vlenb in HELPER(vsetvl),
Daniel Henrique Barboza <=
- [PATCH 09/13] target/riscv/cpu.h: use 'vlenb' in vext_get_vlmax(), Daniel Henrique Barboza, 2024/01/12
- [PATCH 11/13] trans_rvv.c.inc: remove vlmax arg from vec_element_loadx(), Daniel Henrique Barboza, 2024/01/12
- [PATCH 10/13] target/riscv/insn_trans/trans_rvv.c.inc: use 'vlenb' in MAXSZ(), Daniel Henrique Barboza, 2024/01/12