target/riscv: Fix the check with vector register multiples of LMUL
PATCH 1/1 target/riscv: Fix the check with vector register multiples of LMUL
In the original extract32(val, 0, lmul) logic, when lmul is 2 and val is v10 or v12, there is an issue with this check condition. I think a simple mod operation is sufficient.
Signed-off-by Zhiwei Jiang <[email protected]>
--- target/riscv/insn_trans/trans_rvv.c.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/riscv/insn_trans/trans_rvv.c.inc +1 -1
@@ -118,7 +118,7 @@ static bool require_nf(int vd, int nf, int lmul) */ static bool require_align(const int8_t val, const int8_t lmul) { - return lmul <= 0 || extract32(val, 0, lmul) == 0; + return lmul <= 0 || val % lmul == 0; } /*
Signature · 1 line
2.17.1
Quoted 3 lines · Zhiwei Jiang
In the original
extract32(val, 0, lmul)logic, when lmul is 2 and val is v10 or v12, there is an issue with this check condition. I think a simple mod operation is sufficient.
Overall looks ok. Do you mind updating the commit message to describe what exactly this fixes (as in what issue you had) and why this fixes it
Alistair
Quoted 23 lines
Signed-off-by Zhiwei Jiang <[email protected]>--- target/riscv/insn_trans/trans_rvv.c.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/riscv/insn_trans/trans_rvv.c.inc +1
-2@@ -118,7 +118,7 @@ static bool require_nf(int vd, int nf, int lmul) */ static bool require_align(const int8_t val, const int8_t lmul) { - return lmul <= 0 || extract32(val, 0, lmul) == 0; + return lmul <= 0 || val % lmul == 0; } /* --2.17.1