Line 791... |
Line 791... |
t = ffs ((t >> 16) | (t << 16));
|
t = ffs ((t >> 16) | (t << 16));
|
|
|
SET_PARAM0 (0 == t ? t : 33 - t);
|
SET_PARAM0 (0 == t ? t : 33 - t);
|
}
|
}
|
/******* Floating point instructions *******/
|
/******* Floating point instructions *******/
|
|
/* Do calculation, and update FPCSR as required */
|
/* Single precision */
|
/* Single precision */
|
INSTRUCTION (lf_add_s) {
|
INSTRUCTION (lf_add_s) {
|
if (config.cpu.hardfloat) {
|
if (config.cpu.hardfloat) {
|
FLOAT param0, param1, param2;
|
FLOAT param0, param1, param2;
|
param1.hval = (uorreg_t)PARAM1;
|
param1.hval = (uorreg_t)PARAM1;
|
param2.hval = (uorreg_t)PARAM2;
|
param2.hval = (uorreg_t)PARAM2;
|
|
fp_set_or1k_rm();
|
param0.fval = param1.fval + param2.fval;
|
param0.fval = param1.fval + param2.fval;
|
SET_PARAM0(param0.hval);
|
SET_PARAM0(param0.hval);
|
|
fp_set_flags_restore_host_rm();
|
} else l_invalid();
|
} else l_invalid();
|
}
|
}
|
INSTRUCTION (lf_div_s) {
|
INSTRUCTION (lf_div_s) {
|
if (config.cpu.hardfloat) {
|
if (config.cpu.hardfloat) {
|
FLOAT param0, param1, param2;
|
FLOAT param0, param1, param2;
|
param1.hval = (uorreg_t)PARAM1;
|
param1.hval = (uorreg_t)PARAM1;
|
param2.hval = (uorreg_t)PARAM2;
|
param2.hval = (uorreg_t)PARAM2;
|
|
fp_set_or1k_rm();
|
param0.fval = param1.fval / param2.fval;
|
param0.fval = param1.fval / param2.fval;
|
SET_PARAM0(param0.hval);
|
SET_PARAM0(param0.hval);
|
|
fp_set_flags_restore_host_rm();
|
} else l_invalid();
|
} else l_invalid();
|
}
|
}
|
INSTRUCTION (lf_ftoi_s) {
|
INSTRUCTION (lf_ftoi_s) {
|
if (config.cpu.hardfloat) {
|
if (config.cpu.hardfloat) {
|
|
fp_set_or1k_rm();
|
// no other way appeared to work --jb
|
// no other way appeared to work --jb
|
float tmp_f; memcpy((void*)&tmp_f, (void*)&PARAM1, sizeof(float));
|
float tmp_f; memcpy((void*)&tmp_f, (void*)&PARAM1, sizeof(float));
|
SET_PARAM0((int)tmp_f);
|
SET_PARAM0((int)tmp_f);
|
|
fp_set_flags_restore_host_rm();
|
} else l_invalid();
|
} else l_invalid();
|
}
|
}
|
INSTRUCTION (lf_itof_s) {
|
INSTRUCTION (lf_itof_s) {
|
if (config.cpu.hardfloat) {
|
if (config.cpu.hardfloat) {
|
FLOAT param0;
|
FLOAT param0;
|
|
fp_set_or1k_rm();
|
param0.fval = (float)((int)PARAM1);
|
param0.fval = (float)((int)PARAM1);
|
SET_PARAM0(param0.hval);
|
SET_PARAM0(param0.hval);
|
|
fp_set_flags_restore_host_rm();
|
} else l_invalid();
|
} else l_invalid();
|
}
|
}
|
INSTRUCTION (lf_madd_s) {
|
INSTRUCTION (lf_madd_s) {
|
if (config.cpu.hardfloat) {
|
if (config.cpu.hardfloat) {
|
FLOAT param0,param1, param2;
|
FLOAT param0,param1, param2;
|
param0.hval = (uorreg_t)PARAM0;
|
param0.hval = (uorreg_t)PARAM0;
|
param1.hval = (uorreg_t)PARAM1;
|
param1.hval = (uorreg_t)PARAM1;
|
|
fp_set_or1k_rm();
|
param2.hval = PARAM2;
|
param2.hval = PARAM2;
|
param0.fval += param1.fval * param2.fval;
|
param0.fval += param1.fval * param2.fval;
|
SET_PARAM0(param0.hval);
|
SET_PARAM0(param0.hval);
|
|
fp_set_flags_restore_host_rm();
|
} else l_invalid();
|
} else l_invalid();
|
}
|
}
|
INSTRUCTION (lf_mul_s) {
|
INSTRUCTION (lf_mul_s) {
|
if (config.cpu.hardfloat) {
|
if (config.cpu.hardfloat) {
|
FLOAT param0, param1, param2;
|
FLOAT param0, param1, param2;
|
param1.hval = (uorreg_t)PARAM1;
|
param1.hval = (uorreg_t)PARAM1;
|
param2.hval = (uorreg_t)PARAM2;
|
param2.hval = (uorreg_t)PARAM2;
|
|
fp_set_or1k_rm();
|
param0.fval = param1.fval * param2.fval;
|
param0.fval = param1.fval * param2.fval;
|
SET_PARAM0(param0.hval);
|
SET_PARAM0(param0.hval);
|
|
fp_set_flags_restore_host_rm();
|
} else l_invalid();
|
} else l_invalid();
|
}
|
}
|
INSTRUCTION (lf_rem_s) {
|
INSTRUCTION (lf_rem_s) {
|
if (config.cpu.hardfloat) {
|
if (config.cpu.hardfloat) {
|
FLOAT param0, param1, param2;
|
FLOAT param0, param1, param2;
|
param1.hval = PARAM1;
|
param1.hval = PARAM1;
|
param2.hval = PARAM2;
|
param2.hval = PARAM2;
|
|
fp_set_or1k_rm();
|
param0.fval = fmodf (param1.fval, param2.fval);
|
param0.fval = fmodf (param1.fval, param2.fval);
|
SET_PARAM0(param0.hval);
|
SET_PARAM0(param0.hval);
|
|
fp_set_flags_restore_host_rm();
|
} else l_invalid();
|
} else l_invalid();
|
}
|
}
|
INSTRUCTION (lf_sfeq_s) {
|
INSTRUCTION (lf_sfeq_s) {
|
if (config.cpu.hardfloat) {
|
if (config.cpu.hardfloat) {
|
FLOAT param0, param1;
|
FLOAT param0, param1;
|
param0.hval = PARAM0;
|
param0.hval = PARAM0;
|
param1.hval = PARAM1;
|
param1.hval = PARAM1;
|
|
fp_set_or1k_rm();
|
if(param0.fval == param1.fval)
|
if(param0.fval == param1.fval)
|
cpu_state.sprs[SPR_SR] |= SPR_SR_F;
|
cpu_state.sprs[SPR_SR] |= SPR_SR_F;
|
else
|
else
|
cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
|
cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
|
|
fp_set_flags_restore_host_rm();
|
} else l_invalid();
|
} else l_invalid();
|
}
|
}
|
INSTRUCTION (lf_sfge_s) {
|
INSTRUCTION (lf_sfge_s) {
|
if (config.cpu.hardfloat) {
|
if (config.cpu.hardfloat) {
|
FLOAT param0, param1;
|
FLOAT param0, param1;
|
param0.hval = PARAM0;
|
param0.hval = PARAM0;
|
param1.hval = PARAM1;
|
param1.hval = PARAM1;
|
|
fp_set_or1k_rm();
|
if(param0.fval >= param1.fval)
|
if(param0.fval >= param1.fval)
|
cpu_state.sprs[SPR_SR] |= SPR_SR_F;
|
cpu_state.sprs[SPR_SR] |= SPR_SR_F;
|
else
|
else
|
cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
|
cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
|
|
fp_set_flags_restore_host_rm();
|
} else l_invalid();
|
} else l_invalid();
|
}
|
}
|
INSTRUCTION (lf_sfgt_s) {
|
INSTRUCTION (lf_sfgt_s) {
|
if (config.cpu.hardfloat) {
|
if (config.cpu.hardfloat) {
|
FLOAT param0, param1;
|
FLOAT param0, param1;
|
param0.hval = PARAM0;
|
param0.hval = PARAM0;
|
param1.hval = PARAM1;
|
param1.hval = PARAM1;
|
|
fp_set_or1k_rm();
|
if(param0.fval > param1.fval)
|
if(param0.fval > param1.fval)
|
cpu_state.sprs[SPR_SR] |= SPR_SR_F;
|
cpu_state.sprs[SPR_SR] |= SPR_SR_F;
|
else
|
else
|
cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
|
cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
|
|
fp_set_flags_restore_host_rm();
|
} else l_invalid();
|
} else l_invalid();
|
}
|
}
|
INSTRUCTION (lf_sfle_s) {
|
INSTRUCTION (lf_sfle_s) {
|
if (config.cpu.hardfloat) {
|
if (config.cpu.hardfloat) {
|
FLOAT param0, param1;
|
FLOAT param0, param1;
|
param0.hval = PARAM0;
|
param0.hval = PARAM0;
|
param1.hval = PARAM1;
|
param1.hval = PARAM1;
|
|
fp_set_or1k_rm();
|
if(param0.fval <= param1.fval)
|
if(param0.fval <= param1.fval)
|
cpu_state.sprs[SPR_SR] |= SPR_SR_F;
|
cpu_state.sprs[SPR_SR] |= SPR_SR_F;
|
else
|
else
|
cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
|
cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
|
|
fp_set_flags_restore_host_rm();
|
} else l_invalid();
|
} else l_invalid();
|
}
|
}
|
INSTRUCTION (lf_sflt_s) {
|
INSTRUCTION (lf_sflt_s) {
|
if (config.cpu.hardfloat) {
|
if (config.cpu.hardfloat) {
|
FLOAT param0, param1;
|
FLOAT param0, param1;
|
param0.hval = PARAM0;
|
param0.hval = PARAM0;
|
param1.hval = PARAM1;
|
param1.hval = PARAM1;
|
|
fp_set_or1k_rm();
|
if(param0.fval < param1.fval)
|
if(param0.fval < param1.fval)
|
cpu_state.sprs[SPR_SR] |= SPR_SR_F;
|
cpu_state.sprs[SPR_SR] |= SPR_SR_F;
|
else
|
else
|
cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
|
cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
|
|
fp_set_flags_restore_host_rm();
|
} else l_invalid();
|
} else l_invalid();
|
}
|
}
|
INSTRUCTION (lf_sfne_s) {
|
INSTRUCTION (lf_sfne_s) {
|
if (config.cpu.hardfloat) {
|
if (config.cpu.hardfloat) {
|
FLOAT param0, param1;
|
FLOAT param0, param1;
|
param0.hval = PARAM0;
|
param0.hval = PARAM0;
|
param1.hval = PARAM1;
|
param1.hval = PARAM1;
|
|
fp_set_or1k_rm();
|
if(param0.fval != param1.fval)
|
if(param0.fval != param1.fval)
|
cpu_state.sprs[SPR_SR] |= SPR_SR_F;
|
cpu_state.sprs[SPR_SR] |= SPR_SR_F;
|
else
|
else
|
cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
|
cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
|
} else l_invalid();
|
} else l_invalid();
|
Line 923... |
Line 949... |
INSTRUCTION (lf_sub_s) {
|
INSTRUCTION (lf_sub_s) {
|
if (config.cpu.hardfloat) {
|
if (config.cpu.hardfloat) {
|
FLOAT param0, param1, param2;
|
FLOAT param0, param1, param2;
|
param1.hval = PARAM1;
|
param1.hval = PARAM1;
|
param2.hval = PARAM2;
|
param2.hval = PARAM2;
|
|
fp_set_or1k_rm();
|
param0.fval = param1.fval - param2.fval;
|
param0.fval = param1.fval - param2.fval;
|
SET_PARAM0(param0.hval);
|
SET_PARAM0(param0.hval);
|
|
fp_set_flags_restore_host_rm();
|
} else l_invalid();
|
} else l_invalid();
|
}
|
}
|
|
|
/******* Custom instructions *******/
|
/******* Custom instructions *******/
|
INSTRUCTION (l_cust1) {
|
INSTRUCTION (l_cust1) {
|