Skip to content

Commit

Permalink
fix(zfh): fix fsgn src unbox
Browse files Browse the repository at this point in the history
  • Loading branch information
HeiHuDie authored and huxuan0307 committed Nov 22, 2024
1 parent 0b85cdc commit 47b88e1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
4 changes: 4 additions & 0 deletions src/engine/interpreter/fp.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ def_rtl(fpcall, rtlreg_t *dest, const rtlreg_t *src1, const rtlreg_t *src2, uint
case FPCALL_LT: *dest = f16_lt(fsrc1, fsrc2); break;
case FPCALL_EQ: *dest = f16_eq(fsrc1, fsrc2); break;

case FPCALL_SGNJ: *dest = fsgnj16(fsrc1, fsrc2, false, false); break;
case FPCALL_SGNJN: *dest = fsgnj16(fsrc1, fsrc2, true, false); break;
case FPCALL_SGNJX: *dest = fsgnj16(fsrc1, fsrc2, false, true); break;

case FPCALL_I32ToF: *dest = my_i32_to_f16 (*src1).v; break;
case FPCALL_U32ToF: *dest = my_ui32_to_f16(*src1).v; break;
case FPCALL_I64ToF: *dest = my_i64_to_f16 (*src1).v; break;
Expand Down
14 changes: 3 additions & 11 deletions src/isa/riscv64/instr/rvzfh/exec.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,25 +151,17 @@ def_EHelper(fcvt_lu_h) {


def_EHelper(fsgnjh) {
rtl_andi(s, s0, dsrc1, ~F16_SIGN);
rtl_andi(s, ddest, dsrc2, F16_SIGN);
rtl_or(s, ddest, s0, ddest);
rtl_hostcall(s, HOSTCALL_FP, ddest, dsrc1, dsrc2, FPCALL_CMD(FPCALL_SGNJ, FPCALL_W16));
rtl_fsr(s, ddest, ddest, FPCALL_W16);
}

def_EHelper(fsgnjnh) {
rtl_andi(s, s0, dsrc1, ~F16_SIGN);
rtl_xori(s, ddest, dsrc2, F16_SIGN);
rtl_andi(s, ddest, ddest, F16_SIGN);
rtl_or(s, ddest, s0, ddest);
rtl_hostcall(s, HOSTCALL_FP, ddest, dsrc1, dsrc2, FPCALL_CMD(FPCALL_SGNJN, FPCALL_W16));
rtl_fsr(s, ddest, ddest, FPCALL_W16);
}

def_EHelper(fsgnjxh) {
rtl_andi(s, s0, dsrc1, ~F16_SIGN);
rtl_xor(s, ddest, dsrc1, dsrc2);
rtl_andi(s, ddest, ddest, F16_SIGN);
rtl_or(s, ddest, s0, ddest);
rtl_hostcall(s, HOSTCALL_FP, ddest, dsrc1, dsrc2, FPCALL_CMD(FPCALL_SGNJX, FPCALL_W16));
rtl_fsr(s, ddest, ddest, FPCALL_W16);
}

Expand Down

0 comments on commit 47b88e1

Please sign in to comment.