Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(fcvt): set xstatus.fs unconditionally on fcvt #588

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/isa/riscv64/instr/rvd/exec.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,27 @@ def_EHelper(fcvt_d_lu) {
def_EHelper(fcvt_w_d) {
rtl_hostcall(s, HOSTCALL_FP, ddest, dsrc1, rz, FPCALL_CMD(FPCALL_FToI32, FPCALL_W64));
rtl_sext(s, ddest, ddest, 4);
void fp_set_dirty();
fp_set_dirty();
}

def_EHelper(fcvt_wu_d) {
rtl_hostcall(s, HOSTCALL_FP, ddest, dsrc1, rz, FPCALL_CMD(FPCALL_FToU32, FPCALL_W64));
rtl_sext(s, ddest, ddest, 4);
void fp_set_dirty();
fp_set_dirty();
}

def_EHelper(fcvt_l_d) {
rtl_hostcall(s, HOSTCALL_FP, ddest, dsrc1, rz, FPCALL_CMD(FPCALL_FToI64, FPCALL_W64));
void fp_set_dirty();
fp_set_dirty();
}

def_EHelper(fcvt_lu_d) {
rtl_hostcall(s, HOSTCALL_FP, ddest, dsrc1, rz, FPCALL_CMD(FPCALL_FToU64, FPCALL_W64));
void fp_set_dirty();
fp_set_dirty();
}

def_EHelper(fcvt_d_s) {
Expand Down
8 changes: 8 additions & 0 deletions src/isa/riscv64/instr/rvf/exec.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,27 @@ def_EHelper(fcvt_s_lu) {
def_EHelper(fcvt_w_s) {
rtl_hostcall(s, HOSTCALL_FP, ddest, dsrc1, rz, FPCALL_CMD(FPCALL_FToI32, FPCALL_W32));
rtl_sext(s, ddest, ddest, 4);
void fp_set_dirty();
fp_set_dirty();
}

def_EHelper(fcvt_wu_s) {
rtl_hostcall(s, HOSTCALL_FP, ddest, dsrc1, rz, FPCALL_CMD(FPCALL_FToU32, FPCALL_W32));
rtl_sext(s, ddest, ddest, 4);
void fp_set_dirty();
fp_set_dirty();
}

def_EHelper(fcvt_l_s) {
rtl_hostcall(s, HOSTCALL_FP, ddest, dsrc1, rz, FPCALL_CMD(FPCALL_FToI64, FPCALL_W32));
void fp_set_dirty();
fp_set_dirty();
}

def_EHelper(fcvt_lu_s) {
rtl_hostcall(s, HOSTCALL_FP, ddest, dsrc1, rz, FPCALL_CMD(FPCALL_FToU64, FPCALL_W32));
void fp_set_dirty();
fp_set_dirty();
}

def_EHelper(fsgnjs) {
Expand Down
12 changes: 0 additions & 12 deletions src/isa/riscv64/instr/rvv/vcompute.h
Original file line number Diff line number Diff line change
Expand Up @@ -1180,38 +1180,26 @@ def_EHelper(vfmerge) {

def_EHelper(vmfeq) {
FLOAT_ARTHI_MASK(MFEQ)
void fp_set_dirty();
fp_set_dirty();
}

def_EHelper(vmfle) {
FLOAT_ARTHI_MASK(MFLE)
void fp_set_dirty();
fp_set_dirty();
}

def_EHelper(vmflt) {
FLOAT_ARTHI_MASK(MFLT)
void fp_set_dirty();
fp_set_dirty();
}

def_EHelper(vmfne) {
FLOAT_ARTHI_MASK(MFNE)
void fp_set_dirty();
fp_set_dirty();
}

def_EHelper(vmfgt) {
FLOAT_ARTHI_MASK(MFGT)
void fp_set_dirty();
fp_set_dirty();
}

def_EHelper(vmfge) {
FLOAT_ARTHI_MASK(MFGE)
void fp_set_dirty();
fp_set_dirty();
}

def_EHelper(vfdiv) {
Expand Down
6 changes: 5 additions & 1 deletion src/isa/riscv64/instr/rvv/vcompute_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,11 @@ void floating_arthimetic_instr(int opcode, int is_signed, int widening, int dest
default: Loge("other fp type not supported"); longjmp_exception(EX_II); break;
}
check_vstart_exception(s);
if(check_vstart_ignore(s)) return;
if(check_vstart_ignore(s)) {
fp_set_dirty();
vp_set_dirty();
return;
}
for(word_t idx = vstart->val; idx < vl->val; idx ++) {
// mask
rtlreg_t mask = get_mask(0, idx);
Expand Down
2 changes: 2 additions & 0 deletions src/isa/riscv64/instr/rvzfa/exec.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ def_EHelper(froundnx_d) {
def_EHelper(fcvtmod_w_d) {
rtl_hostcall(s, HOSTCALL_FP, ddest, dsrc1, rz, FPCALL_CMD(FPCALL_FCVTMOD, FPCALL_W64));
rtl_sext(s, ddest, ddest, 4);
void fp_set_dirty();
fp_set_dirty();
}

def_EHelper(fleq_s) {
Expand Down
8 changes: 8 additions & 0 deletions src/isa/riscv64/instr/rvzfh/exec.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,21 +124,29 @@ def_EHelper(fcvt_h_lu) {
def_EHelper(fcvt_w_h) {
rtl_hostcall(s, HOSTCALL_FP, ddest, dsrc1, rz, FPCALL_CMD(FPCALL_FToI32, FPCALL_W16));
rtl_sext(s, ddest, ddest, 4);
void fp_set_dirty();
fp_set_dirty();
}

def_EHelper(fcvt_wu_h) {
rtl_hostcall(s, HOSTCALL_FP, ddest, dsrc1, rz, FPCALL_CMD(FPCALL_FToU32, FPCALL_W16));
rtl_sext(s, ddest, ddest, 4);
void fp_set_dirty();
fp_set_dirty();
}

def_EHelper(fcvt_l_h) {
rtl_hostcall(s, HOSTCALL_FP, ddest, dsrc1, rz, FPCALL_CMD(FPCALL_FToI64, FPCALL_W16));
rtl_fsr(s, ddest, ddest, FPCALL_W64);
void fp_set_dirty();
fp_set_dirty();
}

def_EHelper(fcvt_lu_h) {
rtl_hostcall(s, HOSTCALL_FP, ddest, dsrc1, rz, FPCALL_CMD(FPCALL_FToU64, FPCALL_W16));
rtl_fsr(s, ddest, ddest, FPCALL_W64);
void fp_set_dirty();
fp_set_dirty();
}


Expand Down