[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] target/riscv/vector_helper.c: Avoid shifting negative in fractio
From: |
Max Chou |
Subject: |
[PATCH] target/riscv/vector_helper.c: Avoid shifting negative in fractional LMUL checking |
Date: |
Thu, 7 Mar 2024 00:10:22 +0800 |
When vlmul is larger than 5, the original fractional LMUL checking may
gets unexpected result.
Signed-off-by: Max Chou <max.chou@sifive.com>
---
target/riscv/vector_helper.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
index 84cec73eb20..adceec378fd 100644
--- a/target/riscv/vector_helper.c
+++ b/target/riscv/vector_helper.c
@@ -53,10 +53,9 @@ target_ulong HELPER(vsetvl)(CPURISCVState *env, target_ulong
s1,
* VLEN * LMUL >= SEW
* VLEN >> (8 - lmul) >= sew
* (vlenb << 3) >> (8 - lmul) >= sew
- * vlenb >> (8 - 3 - lmul) >= sew
*/
if (vlmul == 4 ||
- cpu->cfg.vlenb >> (8 - 3 - vlmul) < sew) {
+ ((cpu->cfg.vlenb << 3) >> (8 - vlmul)) < sew) {
vill = true;
}
}
--
2.34.1
- [PATCH] target/riscv/vector_helper.c: Avoid shifting negative in fractional LMUL checking,
Max Chou <=