Under Zfinx/Zhinx, trans_fsgnjn_h() and trans_fsgnjx_h() compute their results 
into a temporary but return without calling gen_set_fpr_hs(). The instructions 
consequently retire without updating the corresponding integer register. Add 
the missing writeback calls, matching trans_fsgnj_h().

Tested with the 3-case RV32 linux-user witness and control matrix on a clean 
patched QEMU build.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4407

Signed-off-by: wangyang <[email protected]>
---
 target/riscv/tcg/insn_trans/trans_rvzfh.c.inc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/target/riscv/tcg/insn_trans/trans_rvzfh.c.inc 
b/target/riscv/tcg/insn_trans/trans_rvzfh.c.inc
index f36b46c211..fcdc6065a8 100644
--- a/target/riscv/tcg/insn_trans/trans_rvzfh.c.inc
+++ b/target/riscv/tcg/insn_trans/trans_rvzfh.c.inc
@@ -313,6 +313,7 @@ static bool trans_fsgnjn_h(DisasContext *ctx, arg_fsgnjn_h 
*a)
     if (ctx->cfg_ptr->ext_zfinx) {
         tcg_gen_ext16s_i64(dest, dest);
     }
+    gen_set_fpr_hs(ctx, a->rd, dest);
     mark_fs_dirty(ctx);
     return true;
 }
@@ -357,6 +358,7 @@ static bool trans_fsgnjx_h(DisasContext *ctx, arg_fsgnjx_h 
*a)
     if (ctx->cfg_ptr->ext_zfinx) {
         tcg_gen_ext16s_i64(dest, dest);
     }
+    gen_set_fpr_hs(ctx, a->rd, dest);
     mark_fs_dirty(ctx);
     return true;
 }
-- 
2.55.0.windows.2


Reply via email to