From 15a75d870cfd4cf3030dbfaf0a54bd1f518af7d0 Mon Sep 17 00:00:00 2001 From: Ziyue Zhang Date: Wed, 20 Nov 2024 11:38:13 +0800 Subject: [PATCH] fix(vnclip): use uimm instead of imm for vnclip_wi instructions --- src/isa/riscv64/instr/rvv/vcompute_impl.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/isa/riscv64/instr/rvv/vcompute_impl.c b/src/isa/riscv64/instr/rvv/vcompute_impl.c index 58e09f48..5461321a 100644 --- a/src/isa/riscv64/instr/rvv/vcompute_impl.c +++ b/src/isa/riscv64/instr/rvv/vcompute_impl.c @@ -584,8 +584,14 @@ void arthimetic_instr(int opcode, int is_signed, int widening, int narrow, int d break; case SRC_VI : shift_mask = 0x1f; - if(is_signed) rtl_li(s, s1, s->isa.instr.v_opsimm.v_simm5); - else { + if(is_signed) { + if (opcode == NCLIP) { + // vnclip use unsigned imm, signed vs2 + rtl_li(s, s1, s->isa.instr.v_opimm.v_imm5); + } else { + rtl_li(s, s1, s->isa.instr.v_opsimm.v_simm5); + } + } else { if (opcode == MSLEU || opcode == MSGTU || opcode == SADDU) { rtl_li(s, s1, s->isa.instr.v_opsimm.v_simm5); switch (vtype->vsew) {