From 67fc0f5d6be03929b412aa70d47236d67f68b769 Mon Sep 17 00:00:00 2001 From: Chih-Min Chao Date: Wed, 20 May 2020 00:05:12 -0700 Subject: rvv: fix out of range checking unit/strided Signed-off-by: Chih-Min Chao --- riscv/decode.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/riscv/decode.h b/riscv/decode.h index 8d3968f..9eb4058 100644 --- a/riscv/decode.h +++ b/riscv/decode.h @@ -484,9 +484,9 @@ static inline bool is_aligned(const unsigned val, const unsigned pos) require_vector; \ P.VU.veew = sizeof(elt_width##_t) * 8; \ P.VU.vemul = ((float)P.VU.veew / P.VU.vsew * P.VU.vflmul); \ - reg_t emul = P.VU.vemul + 0.875; \ - require(emul >= 1 && emul <= 8); \ - require_align(insn.rd(), P.VU.vflmul); \ + reg_t emul = P.VU.vemul < 1 ? 1 : P.VU.vemul; \ + require(P.VU.vemul >= 0.125 && P.VU.vemul <= 8); \ + require_align(insn.rd(), P.VU.vemul); \ require((nf * emul) <= (NVPR / 4) && \ (insn.rd() + nf * emul) <= NVPR); \ -- cgit v1.1