From: TANG Tiancheng <[email protected]>

operand_vimm() sign-extends the 5-bit vector immediate field in bits
19:15, but returns uint32_t. This sends negative immediates through an
unsigned type before they are assigned to rv_decode.imm.

Return int32_t to match the signed value extracted by the helper.

Signed-off-by: TANG Tiancheng <[email protected]>
Reviewed-by: LIU Zhiwei <[email protected]>
Reviewed-by: Alistair Francis <[email protected]>
Message-ID: 
<20260703-b4-disas-xthead-fix-riscv-next-v4-3-84c566330...@linux.alibaba.com>
Signed-off-by: Alistair Francis <[email protected]>
(cherry picked from commit 7899d3c6bdb008dd301b474f3524bad5f37a411e)
Signed-off-by: Michael Tokarev <[email protected]>

diff --git a/disas/riscv.c b/disas/riscv.c
index 692765cd32f..99d7474aff2 100644
--- a/disas/riscv.c
+++ b/disas/riscv.c
@@ -4479,7 +4479,7 @@ static uint32_t operand_cimmq(rv_inst inst)
         ((inst << 57) >> 62) << 6;
 }
 
-static uint32_t operand_vimm(rv_inst inst)
+static int32_t operand_vimm(rv_inst inst)
 {
     return (int64_t)(inst << 44) >> 59;
 }
-- 
2.47.3


Reply via email to