Upgrade to softfloat3e.
This should solve licensing problems as well.
This commit is contained in:
@@ -38,10 +38,10 @@ sf_FILDiw_a16(uint32_t fetchdat)
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
clear_C1();
|
||||
if (!IS_TAG_EMPTY(-1)) {
|
||||
if (!IS_TAG_EMPTY(-1))
|
||||
FPU_stack_overflow(fetchdat);
|
||||
} else {
|
||||
result = int32_to_floatx80(temp);
|
||||
else {
|
||||
result = i32_to_extF80(temp);
|
||||
FPU_push();
|
||||
FPU_save_regi(result, 0);
|
||||
}
|
||||
@@ -67,7 +67,7 @@ sf_FILDiw_a32(uint32_t fetchdat)
|
||||
if (!IS_TAG_EMPTY(-1)) {
|
||||
FPU_stack_overflow(fetchdat);
|
||||
} else {
|
||||
result = int32_to_floatx80(temp);
|
||||
result = i32_to_extF80(temp);
|
||||
FPU_push();
|
||||
FPU_save_regi(result, 0);
|
||||
}
|
||||
@@ -94,7 +94,7 @@ sf_FILDil_a16(uint32_t fetchdat)
|
||||
if (!IS_TAG_EMPTY(-1)) {
|
||||
FPU_stack_overflow(fetchdat);
|
||||
} else {
|
||||
result = int32_to_floatx80(templ);
|
||||
result = i32_to_extF80(templ);
|
||||
FPU_push();
|
||||
FPU_save_regi(result, 0);
|
||||
}
|
||||
@@ -120,7 +120,7 @@ sf_FILDil_a32(uint32_t fetchdat)
|
||||
if (!IS_TAG_EMPTY(-1)) {
|
||||
FPU_stack_overflow(fetchdat);
|
||||
} else {
|
||||
result = int32_to_floatx80(templ);
|
||||
result = i32_to_extF80(templ);
|
||||
FPU_push();
|
||||
FPU_save_regi(result, 0);
|
||||
}
|
||||
@@ -147,7 +147,7 @@ sf_FILDiq_a16(uint32_t fetchdat)
|
||||
if (!IS_TAG_EMPTY(-1)) {
|
||||
FPU_stack_overflow(fetchdat);
|
||||
} else {
|
||||
result = int64_to_floatx80(temp64);
|
||||
result = i64_to_extF80(temp64);
|
||||
FPU_push();
|
||||
FPU_save_regi(result, 0);
|
||||
}
|
||||
@@ -173,7 +173,7 @@ sf_FILDiq_a32(uint32_t fetchdat)
|
||||
if (!IS_TAG_EMPTY(-1)) {
|
||||
FPU_stack_overflow(fetchdat);
|
||||
} else {
|
||||
result = int64_to_floatx80(temp64);
|
||||
result = i64_to_extF80(temp64);
|
||||
FPU_push();
|
||||
FPU_save_regi(result, 0);
|
||||
}
|
||||
@@ -187,40 +187,36 @@ static int
|
||||
sf_FBLD_PACKED_BCD_a16(uint32_t fetchdat)
|
||||
{
|
||||
floatx80 result;
|
||||
uint16_t load_reg_hi = 0xffff;
|
||||
uint64_t load_reg_lo = BX_CONST64(0xC000000000000000);
|
||||
int64_t load_val = 0ULL;
|
||||
uint64_t power;
|
||||
int sign;
|
||||
uint16_t load_reg_hi;
|
||||
uint64_t load_reg_lo;
|
||||
int64_t val64 = 0;
|
||||
int64_t scale = 1;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
fetch_ea_16(fetchdat);
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
load_reg_hi = readmemw(easeg, (cpu_state.eaaddr + 8) & 0xffff);
|
||||
load_reg_lo = readmemq(easeg, cpu_state.eaaddr);
|
||||
load_reg_hi = readmemw(easeg, cpu_state.eaaddr + 8);
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
clear_C1();
|
||||
if (!IS_TAG_EMPTY(-1)) {
|
||||
FPU_stack_overflow(fetchdat);
|
||||
} else {
|
||||
sign = (load_reg_hi & 0x8000) != 0;
|
||||
load_val = 0ULL;
|
||||
power = 1;
|
||||
for (int i = 0; i < 16; i++) {
|
||||
load_val += ((uint64_t) (load_reg_lo & 0xf)) * power;
|
||||
for (int n = 0; n < 16; n++) {
|
||||
val64 += ((load_reg_lo & 0x0f) * scale);
|
||||
load_reg_lo >>= 4;
|
||||
power *= 10;
|
||||
scale *= 10;
|
||||
}
|
||||
for (int i = 0; i < 2; i++) {
|
||||
load_val += ((uint64_t) (load_reg_hi & 0xf)) * power;
|
||||
load_reg_hi >>= 4;
|
||||
power *= 10;
|
||||
}
|
||||
if (sign)
|
||||
load_val = -load_val;
|
||||
result = int64_to_floatx80(load_val);
|
||||
val64 += ((load_reg_hi & 0x0f) * scale);
|
||||
val64 += (((load_reg_hi >> 4) & 0x0f) * scale * 10);
|
||||
|
||||
result = (floatx80) i64_to_extF80(val64);
|
||||
|
||||
if (load_reg_hi & 0x8000)
|
||||
floatx80_chs(result);
|
||||
|
||||
FPU_push();
|
||||
FPU_save_regi(result, 0);
|
||||
}
|
||||
@@ -233,40 +229,36 @@ static int
|
||||
sf_FBLD_PACKED_BCD_a32(uint32_t fetchdat)
|
||||
{
|
||||
floatx80 result;
|
||||
uint16_t load_reg_hi = 0xffff;
|
||||
uint64_t load_reg_lo = BX_CONST64(0xC000000000000000);
|
||||
int64_t load_val = 0ULL;
|
||||
uint64_t power;
|
||||
int sign;
|
||||
uint16_t load_reg_hi;
|
||||
uint64_t load_reg_lo;
|
||||
int64_t val64 = 0;
|
||||
int64_t scale = 1;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
fetch_ea_16(fetchdat);
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
load_reg_hi = readmemw(easeg, (cpu_state.eaaddr + 8) & 0xffff);
|
||||
load_reg_lo = readmemq(easeg, cpu_state.eaaddr);
|
||||
load_reg_hi = readmemw(easeg, cpu_state.eaaddr + 8);
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
clear_C1();
|
||||
if (!IS_TAG_EMPTY(-1)) {
|
||||
FPU_stack_overflow(fetchdat);
|
||||
} else {
|
||||
sign = (load_reg_hi & 0x8000) != 0;
|
||||
load_val = 0ULL;
|
||||
power = 1;
|
||||
for (int i = 0; i < 16; i++) {
|
||||
load_val += ((uint64_t) (load_reg_lo & 0xf)) * power;
|
||||
for (int n = 0; n < 16; n++) {
|
||||
val64 += ((load_reg_lo & 0x0f) * scale);
|
||||
load_reg_lo >>= 4;
|
||||
power *= 10;
|
||||
scale *= 10;
|
||||
}
|
||||
for (int i = 0; i < 2; i++) {
|
||||
load_val += ((uint64_t) (load_reg_hi & 0xf)) * power;
|
||||
load_reg_hi >>= 4;
|
||||
power *= 10;
|
||||
}
|
||||
if (sign)
|
||||
load_val = -load_val;
|
||||
result = int64_to_floatx80(load_val);
|
||||
val64 += ((load_reg_hi & 0x0f) * scale);
|
||||
val64 += (((load_reg_hi >> 4) & 0x0f) * scale * 10);
|
||||
|
||||
result = (floatx80) i64_to_extF80(val64);
|
||||
|
||||
if (load_reg_hi & 0x8000)
|
||||
floatx80_chs(result);
|
||||
|
||||
FPU_push();
|
||||
FPU_save_regi(result, 0);
|
||||
}
|
||||
@@ -279,10 +271,10 @@ sf_FBLD_PACKED_BCD_a32(uint32_t fetchdat)
|
||||
static int
|
||||
sf_FLDs_a16(uint32_t fetchdat)
|
||||
{
|
||||
struct float_status_t status;
|
||||
floatx80 result;
|
||||
float32 load_reg;
|
||||
unsigned unmasked;
|
||||
struct softfloat_status_t status;
|
||||
floatx80 result;
|
||||
float32 load_reg;
|
||||
unsigned unmasked;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
@@ -297,8 +289,8 @@ sf_FLDs_a16(uint32_t fetchdat)
|
||||
goto next_ins;
|
||||
}
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word());
|
||||
result = float32_to_floatx80(load_reg, &status);
|
||||
unmasked = FPU_exception(fetchdat, status.float_exception_flags, 0);
|
||||
result = f32_to_extF80(load_reg, &status);
|
||||
unmasked = FPU_exception(fetchdat, status.softfloat_exceptionFlags, 0);
|
||||
if (!(unmasked & FPU_CW_Invalid)) {
|
||||
FPU_push();
|
||||
FPU_save_regi(result, 0);
|
||||
@@ -313,10 +305,10 @@ next_ins:
|
||||
static int
|
||||
sf_FLDs_a32(uint32_t fetchdat)
|
||||
{
|
||||
struct float_status_t status;
|
||||
floatx80 result;
|
||||
float32 load_reg;
|
||||
unsigned unmasked;
|
||||
struct softfloat_status_t status;
|
||||
floatx80 result;
|
||||
float32 load_reg;
|
||||
unsigned unmasked;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
@@ -331,8 +323,8 @@ sf_FLDs_a32(uint32_t fetchdat)
|
||||
goto next_ins;
|
||||
}
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word());
|
||||
result = float32_to_floatx80(load_reg, &status);
|
||||
unmasked = FPU_exception(fetchdat, status.float_exception_flags, 0);
|
||||
result = f32_to_extF80(load_reg, &status);
|
||||
unmasked = FPU_exception(fetchdat, status.softfloat_exceptionFlags, 0);
|
||||
if (!(unmasked & FPU_CW_Invalid)) {
|
||||
FPU_push();
|
||||
FPU_save_regi(result, 0);
|
||||
@@ -348,10 +340,10 @@ next_ins:
|
||||
static int
|
||||
sf_FLDd_a16(uint32_t fetchdat)
|
||||
{
|
||||
struct float_status_t status;
|
||||
floatx80 result;
|
||||
float64 load_reg;
|
||||
unsigned unmasked;
|
||||
struct softfloat_status_t status;
|
||||
floatx80 result;
|
||||
float64 load_reg;
|
||||
unsigned unmasked;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
@@ -366,8 +358,8 @@ sf_FLDd_a16(uint32_t fetchdat)
|
||||
goto next_ins;
|
||||
}
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word());
|
||||
result = float64_to_floatx80(load_reg, &status);
|
||||
unmasked = FPU_exception(fetchdat, status.float_exception_flags, 0);
|
||||
result = f64_to_extF80(load_reg, &status);
|
||||
unmasked = FPU_exception(fetchdat, status.softfloat_exceptionFlags, 0);
|
||||
if (!(unmasked & FPU_CW_Invalid)) {
|
||||
FPU_push();
|
||||
FPU_save_regi(result, 0);
|
||||
@@ -382,10 +374,10 @@ next_ins:
|
||||
static int
|
||||
sf_FLDd_a32(uint32_t fetchdat)
|
||||
{
|
||||
struct float_status_t status;
|
||||
floatx80 result;
|
||||
float64 load_reg;
|
||||
unsigned unmasked;
|
||||
struct softfloat_status_t status;
|
||||
floatx80 result;
|
||||
float64 load_reg;
|
||||
unsigned unmasked;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
@@ -400,8 +392,8 @@ sf_FLDd_a32(uint32_t fetchdat)
|
||||
goto next_ins;
|
||||
}
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word());
|
||||
result = float64_to_floatx80(load_reg, &status);
|
||||
unmasked = FPU_exception(fetchdat, status.float_exception_flags, 0);
|
||||
result = f64_to_extF80(load_reg, &status);
|
||||
unmasked = FPU_exception(fetchdat, status.softfloat_exceptionFlags, 0);
|
||||
if (!(unmasked & FPU_CW_Invalid)) {
|
||||
FPU_push();
|
||||
FPU_save_regi(result, 0);
|
||||
@@ -423,10 +415,11 @@ sf_FLDe_a16(uint32_t fetchdat)
|
||||
FPU_check_pending_exceptions();
|
||||
fetch_ea_16(fetchdat);
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
result.fraction = readmemq(easeg, cpu_state.eaaddr);
|
||||
result.exp = readmemw(easeg, cpu_state.eaaddr + 8);
|
||||
result.signif = readmemq(easeg, cpu_state.eaaddr);
|
||||
result.signExp = readmemw(easeg, cpu_state.eaaddr + 8);
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
|
||||
clear_C1();
|
||||
if (!IS_TAG_EMPTY(-1)) {
|
||||
FPU_stack_overflow(fetchdat);
|
||||
@@ -448,10 +441,11 @@ sf_FLDe_a32(uint32_t fetchdat)
|
||||
FPU_check_pending_exceptions();
|
||||
fetch_ea_32(fetchdat);
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
result.fraction = readmemq(easeg, cpu_state.eaaddr);
|
||||
result.exp = readmemw(easeg, cpu_state.eaaddr + 8);
|
||||
result.signif = readmemq(easeg, cpu_state.eaaddr);
|
||||
result.signExp = readmemw(easeg, cpu_state.eaaddr + 8);
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
|
||||
clear_C1();
|
||||
if (!IS_TAG_EMPTY(-1)) {
|
||||
FPU_stack_overflow(fetchdat);
|
||||
@@ -484,9 +478,8 @@ sf_FLD_sti(uint32_t fetchdat)
|
||||
FPU_exception(fetchdat, FPU_EX_Stack_Underflow, 0);
|
||||
if (!is_IA_masked())
|
||||
goto next_ins;
|
||||
} else {
|
||||
} else
|
||||
sti_reg = FPU_read_regi(fetchdat & 7);
|
||||
}
|
||||
|
||||
FPU_push();
|
||||
FPU_save_regi(sti_reg, 0);
|
||||
@@ -500,9 +493,9 @@ next_ins:
|
||||
static int
|
||||
sf_FISTiw_a16(uint32_t fetchdat)
|
||||
{
|
||||
struct float_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
int16_t save_reg = int16_indefinite;
|
||||
struct softfloat_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
int16_t save_reg = int16_indefinite;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
@@ -516,8 +509,8 @@ sf_FISTiw_a16(uint32_t fetchdat)
|
||||
}
|
||||
} else {
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word());
|
||||
save_reg = floatx80_to_int16(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.float_exception_flags, 1)) {
|
||||
save_reg = extF80_to_i16(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.softfloat_exceptionFlags, 1)) {
|
||||
goto next_ins;
|
||||
}
|
||||
}
|
||||
@@ -535,9 +528,9 @@ next_ins:
|
||||
static int
|
||||
sf_FISTiw_a32(uint32_t fetchdat)
|
||||
{
|
||||
struct float_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
int16_t save_reg = int16_indefinite;
|
||||
struct softfloat_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
int16_t save_reg = int16_indefinite;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
@@ -550,8 +543,8 @@ sf_FISTiw_a32(uint32_t fetchdat)
|
||||
goto next_ins;
|
||||
} else {
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word());
|
||||
save_reg = floatx80_to_int16(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.float_exception_flags, 1))
|
||||
save_reg = extF80_to_i16(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.softfloat_exceptionFlags, 1))
|
||||
goto next_ins;
|
||||
}
|
||||
// store to the memory might generate an exception, in this case original FPU_SW must be kept
|
||||
@@ -569,9 +562,9 @@ next_ins:
|
||||
static int
|
||||
sf_FISTPiw_a16(uint32_t fetchdat)
|
||||
{
|
||||
struct float_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
int16_t save_reg = int16_indefinite;
|
||||
struct softfloat_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
int16_t save_reg = int16_indefinite;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
@@ -584,8 +577,8 @@ sf_FISTPiw_a16(uint32_t fetchdat)
|
||||
goto next_ins;
|
||||
} else {
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word());
|
||||
save_reg = floatx80_to_int16(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.float_exception_flags, 1)) {
|
||||
save_reg = extF80_to_i16(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.softfloat_exceptionFlags, 1)) {
|
||||
goto next_ins;
|
||||
}
|
||||
}
|
||||
@@ -606,9 +599,9 @@ next_ins:
|
||||
static int
|
||||
sf_FISTPiw_a32(uint32_t fetchdat)
|
||||
{
|
||||
struct float_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
int16_t save_reg = int16_indefinite;
|
||||
struct softfloat_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
int16_t save_reg = int16_indefinite;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
@@ -621,8 +614,8 @@ sf_FISTPiw_a32(uint32_t fetchdat)
|
||||
goto next_ins;
|
||||
} else {
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word());
|
||||
save_reg = floatx80_to_int16(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.float_exception_flags, 1))
|
||||
save_reg = extF80_to_i16(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.softfloat_exceptionFlags, 1))
|
||||
goto next_ins;
|
||||
}
|
||||
// store to the memory might generate an exception, in this case original FPU_SW must be kept
|
||||
@@ -643,9 +636,9 @@ next_ins:
|
||||
static int
|
||||
sf_FISTil_a16(uint32_t fetchdat)
|
||||
{
|
||||
struct float_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
int32_t save_reg = int32_indefinite;
|
||||
struct softfloat_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
int32_t save_reg = int32_indefinite;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
@@ -658,8 +651,8 @@ sf_FISTil_a16(uint32_t fetchdat)
|
||||
goto next_ins;
|
||||
} else {
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word());
|
||||
save_reg = floatx80_to_int32(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.float_exception_flags, 1)) {
|
||||
save_reg = extF80_to_i32_normal(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.softfloat_exceptionFlags, 1)) {
|
||||
goto next_ins;
|
||||
}
|
||||
}
|
||||
@@ -677,9 +670,9 @@ next_ins:
|
||||
static int
|
||||
sf_FISTil_a32(uint32_t fetchdat)
|
||||
{
|
||||
struct float_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
int32_t save_reg = int32_indefinite;
|
||||
struct softfloat_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
int32_t save_reg = int32_indefinite;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
@@ -692,8 +685,8 @@ sf_FISTil_a32(uint32_t fetchdat)
|
||||
goto next_ins;
|
||||
} else {
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word());
|
||||
save_reg = floatx80_to_int32(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.float_exception_flags, 1))
|
||||
save_reg = extF80_to_i32_normal(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.softfloat_exceptionFlags, 1))
|
||||
goto next_ins;
|
||||
}
|
||||
// store to the memory might generate an exception, in this case original FPU_SW must be kept
|
||||
@@ -711,9 +704,9 @@ next_ins:
|
||||
static int
|
||||
sf_FISTPil_a16(uint32_t fetchdat)
|
||||
{
|
||||
struct float_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
int32_t save_reg = int32_indefinite;
|
||||
struct softfloat_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
int32_t save_reg = int32_indefinite;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
@@ -726,8 +719,8 @@ sf_FISTPil_a16(uint32_t fetchdat)
|
||||
goto next_ins;
|
||||
} else {
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word());
|
||||
save_reg = floatx80_to_int32(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.float_exception_flags, 1)) {
|
||||
save_reg = extF80_to_i32_normal(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.softfloat_exceptionFlags, 1)) {
|
||||
goto next_ins;
|
||||
}
|
||||
}
|
||||
@@ -748,9 +741,9 @@ next_ins:
|
||||
static int
|
||||
sf_FISTPil_a32(uint32_t fetchdat)
|
||||
{
|
||||
struct float_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
int32_t save_reg = int32_indefinite;
|
||||
struct softfloat_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
int32_t save_reg = int32_indefinite;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
@@ -763,8 +756,8 @@ sf_FISTPil_a32(uint32_t fetchdat)
|
||||
goto next_ins;
|
||||
} else {
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word());
|
||||
save_reg = floatx80_to_int32(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.float_exception_flags, 1))
|
||||
save_reg = extF80_to_i32_normal(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.softfloat_exceptionFlags, 1))
|
||||
goto next_ins;
|
||||
}
|
||||
// store to the memory might generate an exception, in this case original FPU_SW must be kept
|
||||
@@ -785,9 +778,9 @@ next_ins:
|
||||
static int
|
||||
sf_FISTPiq_a16(uint32_t fetchdat)
|
||||
{
|
||||
struct float_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
int64_t save_reg = int64_indefinite;
|
||||
struct softfloat_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
int64_t save_reg = int64_indefinite;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
@@ -800,8 +793,8 @@ sf_FISTPiq_a16(uint32_t fetchdat)
|
||||
goto next_ins;
|
||||
} else {
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word());
|
||||
save_reg = floatx80_to_int64(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.float_exception_flags, 1)) {
|
||||
save_reg = extF80_to_i64_normal(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.softfloat_exceptionFlags, 1)) {
|
||||
goto next_ins;
|
||||
}
|
||||
}
|
||||
@@ -822,9 +815,9 @@ next_ins:
|
||||
static int
|
||||
sf_FISTPiq_a32(uint32_t fetchdat)
|
||||
{
|
||||
struct float_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
int64_t save_reg = int64_indefinite;
|
||||
struct softfloat_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
int64_t save_reg = int64_indefinite;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
@@ -837,8 +830,8 @@ sf_FISTPiq_a32(uint32_t fetchdat)
|
||||
goto next_ins;
|
||||
} else {
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word());
|
||||
save_reg = floatx80_to_int64(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.float_exception_flags, 1))
|
||||
save_reg = extF80_to_i64_normal(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.softfloat_exceptionFlags, 1))
|
||||
goto next_ins;
|
||||
}
|
||||
// store to the memory might generate an exception, in this case origial FPU_SW must be kept
|
||||
@@ -859,13 +852,13 @@ next_ins:
|
||||
static int
|
||||
sf_FBSTP_PACKED_BCD_a16(uint32_t fetchdat)
|
||||
{
|
||||
struct float_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
uint16_t save_reg_hi = 0xffff;
|
||||
uint64_t save_reg_lo = BX_CONST64(0xC000000000000000);
|
||||
floatx80 reg;
|
||||
int64_t save_val;
|
||||
int sign;
|
||||
struct softfloat_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
uint16_t save_reg_hi = 0xffff;
|
||||
uint64_t save_reg_lo = BX_CONST64(0xC000000000000000);
|
||||
floatx80 reg;
|
||||
int64_t save_val;
|
||||
int sign;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
@@ -879,15 +872,15 @@ sf_FBSTP_PACKED_BCD_a16(uint32_t fetchdat)
|
||||
} else {
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word());
|
||||
reg = FPU_read_regi(0);
|
||||
save_val = floatx80_to_int64(reg, &status);
|
||||
sign = (reg.exp & 0x8000) != 0;
|
||||
save_val = extF80_to_i64_normal(reg, &status);
|
||||
sign = extF80_sign(reg);
|
||||
if (sign)
|
||||
save_val = -save_val;
|
||||
|
||||
if (save_val > BX_CONST64(999999999999999999))
|
||||
status.float_exception_flags = float_flag_invalid; // throw away other flags
|
||||
softfloat_setFlags(&status, softfloat_flag_invalid); // throw away other flags
|
||||
|
||||
if (!(status.float_exception_flags & float_flag_invalid)) {
|
||||
if (!(status.softfloat_exceptionFlags & softfloat_flag_invalid)) {
|
||||
save_reg_hi = sign ? 0x8000 : 0;
|
||||
save_reg_lo = 0;
|
||||
for (int i = 0; i < 16; i++) {
|
||||
@@ -899,7 +892,7 @@ sf_FBSTP_PACKED_BCD_a16(uint32_t fetchdat)
|
||||
save_reg_hi += (uint16_t) (save_val % 10) << 4;
|
||||
}
|
||||
/* check for fpu arithmetic exceptions */
|
||||
if (FPU_exception(fetchdat, status.float_exception_flags, 1)) {
|
||||
if (FPU_exception(fetchdat, status.softfloat_exceptionFlags, 1)) {
|
||||
goto next_ins;
|
||||
}
|
||||
}
|
||||
@@ -923,13 +916,13 @@ next_ins:
|
||||
static int
|
||||
sf_FBSTP_PACKED_BCD_a32(uint32_t fetchdat)
|
||||
{
|
||||
struct float_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
uint16_t save_reg_hi = 0xffff;
|
||||
uint64_t save_reg_lo = BX_CONST64(0xC000000000000000);
|
||||
floatx80 reg;
|
||||
int64_t save_val;
|
||||
int sign;
|
||||
struct softfloat_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
uint16_t save_reg_hi = 0xffff;
|
||||
uint64_t save_reg_lo = BX_CONST64(0xC000000000000000);
|
||||
floatx80 reg;
|
||||
int64_t save_val;
|
||||
int sign;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
@@ -943,15 +936,15 @@ sf_FBSTP_PACKED_BCD_a32(uint32_t fetchdat)
|
||||
} else {
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word());
|
||||
reg = FPU_read_regi(0);
|
||||
save_val = floatx80_to_int64(reg, &status);
|
||||
sign = (reg.exp & 0x8000) != 0;
|
||||
save_val = extF80_to_i64_normal(reg, &status);
|
||||
sign = extF80_sign(reg);
|
||||
if (sign)
|
||||
save_val = -save_val;
|
||||
|
||||
if (save_val > BX_CONST64(999999999999999999))
|
||||
status.float_exception_flags = float_flag_invalid; // throw away other flags
|
||||
softfloat_setFlags(&status, softfloat_flag_invalid); // throw away other flags
|
||||
|
||||
if (!(status.float_exception_flags & float_flag_invalid)) {
|
||||
if (!(status.softfloat_exceptionFlags & softfloat_flag_invalid)) {
|
||||
save_reg_hi = sign ? 0x8000 : 0;
|
||||
save_reg_lo = 0;
|
||||
for (int i = 0; i < 16; i++) {
|
||||
@@ -963,7 +956,7 @@ sf_FBSTP_PACKED_BCD_a32(uint32_t fetchdat)
|
||||
save_reg_hi += (uint16_t) (save_val % 10) << 4;
|
||||
}
|
||||
/* check for fpu arithmetic exceptions */
|
||||
if (FPU_exception(fetchdat, status.float_exception_flags, 1)) {
|
||||
if (FPU_exception(fetchdat, status.softfloat_exceptionFlags, 1)) {
|
||||
goto next_ins;
|
||||
}
|
||||
}
|
||||
@@ -988,9 +981,9 @@ next_ins:
|
||||
static int
|
||||
sf_FSTs_a16(uint32_t fetchdat)
|
||||
{
|
||||
struct float_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
float32 save_reg = float32_default_nan;
|
||||
struct softfloat_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
float32 save_reg = float32_default_nan;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
@@ -1003,8 +996,8 @@ sf_FSTs_a16(uint32_t fetchdat)
|
||||
goto next_ins;
|
||||
} else {
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word());
|
||||
save_reg = floatx80_to_float32(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.float_exception_flags, 1)) {
|
||||
save_reg = extF80_to_f32(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.softfloat_exceptionFlags, 1)) {
|
||||
goto next_ins;
|
||||
}
|
||||
}
|
||||
@@ -1022,9 +1015,9 @@ next_ins:
|
||||
static int
|
||||
sf_FSTs_a32(uint32_t fetchdat)
|
||||
{
|
||||
struct float_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
float32 save_reg = float32_default_nan;
|
||||
struct softfloat_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
float32 save_reg = float32_default_nan;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
@@ -1037,8 +1030,8 @@ sf_FSTs_a32(uint32_t fetchdat)
|
||||
goto next_ins;
|
||||
} else {
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word());
|
||||
save_reg = floatx80_to_float32(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.float_exception_flags, 1))
|
||||
save_reg = extF80_to_f32(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.softfloat_exceptionFlags, 1))
|
||||
goto next_ins;
|
||||
}
|
||||
// store to the memory might generate an exception, in this case original FPU_SW must be kept
|
||||
@@ -1056,9 +1049,9 @@ next_ins:
|
||||
static int
|
||||
sf_FSTPs_a16(uint32_t fetchdat)
|
||||
{
|
||||
struct float_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
float32 save_reg = float32_default_nan;
|
||||
struct softfloat_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
float32 save_reg = float32_default_nan;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
@@ -1071,17 +1064,17 @@ sf_FSTPs_a16(uint32_t fetchdat)
|
||||
goto next_ins;
|
||||
} else {
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word());
|
||||
save_reg = floatx80_to_float32(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.float_exception_flags, 1)) {
|
||||
save_reg = extF80_to_f32(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.softfloat_exceptionFlags, 1)) {
|
||||
goto next_ins;
|
||||
}
|
||||
}
|
||||
// store to the memory might generate an exception, in this case original FPU_SW must be kept
|
||||
swap_values16u(sw, fpu_state.swd);
|
||||
seteal(save_reg);
|
||||
if (cpu_state.abrt) {
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
}
|
||||
|
||||
fpu_state.swd = sw;
|
||||
FPU_pop();
|
||||
|
||||
@@ -1094,9 +1087,9 @@ next_ins:
|
||||
static int
|
||||
sf_FSTPs_a32(uint32_t fetchdat)
|
||||
{
|
||||
struct float_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
float32 save_reg = float32_default_nan;
|
||||
struct softfloat_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
float32 save_reg = float32_default_nan;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
@@ -1109,8 +1102,8 @@ sf_FSTPs_a32(uint32_t fetchdat)
|
||||
goto next_ins;
|
||||
} else {
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word());
|
||||
save_reg = floatx80_to_float32(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.float_exception_flags, 1))
|
||||
save_reg = extF80_to_f32(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.softfloat_exceptionFlags, 1))
|
||||
goto next_ins;
|
||||
}
|
||||
// store to the memory might generate an exception, in this case original FPU_SW must be kept
|
||||
@@ -1118,6 +1111,7 @@ sf_FSTPs_a32(uint32_t fetchdat)
|
||||
seteal(save_reg);
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
|
||||
fpu_state.swd = sw;
|
||||
FPU_pop();
|
||||
|
||||
@@ -1131,9 +1125,9 @@ next_ins:
|
||||
static int
|
||||
sf_FSTd_a16(uint32_t fetchdat)
|
||||
{
|
||||
struct float_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
float64 save_reg = float64_default_nan;
|
||||
struct softfloat_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
float64 save_reg = float64_default_nan;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
@@ -1146,8 +1140,8 @@ sf_FSTd_a16(uint32_t fetchdat)
|
||||
goto next_ins;
|
||||
} else {
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word());
|
||||
save_reg = floatx80_to_float64(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.float_exception_flags, 1)) {
|
||||
save_reg = extF80_to_f64(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.softfloat_exceptionFlags, 1)) {
|
||||
goto next_ins;
|
||||
}
|
||||
}
|
||||
@@ -1165,9 +1159,9 @@ next_ins:
|
||||
static int
|
||||
sf_FSTd_a32(uint32_t fetchdat)
|
||||
{
|
||||
struct float_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
float64 save_reg = float64_default_nan;
|
||||
struct softfloat_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
float64 save_reg = float64_default_nan;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
@@ -1180,8 +1174,8 @@ sf_FSTd_a32(uint32_t fetchdat)
|
||||
goto next_ins;
|
||||
} else {
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word());
|
||||
save_reg = floatx80_to_float64(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.float_exception_flags, 1))
|
||||
save_reg = extF80_to_f64(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.softfloat_exceptionFlags, 1))
|
||||
goto next_ins;
|
||||
}
|
||||
// store to the memory might generate an exception, in this case original FPU_SW must be kept
|
||||
@@ -1199,9 +1193,9 @@ next_ins:
|
||||
static int
|
||||
sf_FSTPd_a16(uint32_t fetchdat)
|
||||
{
|
||||
struct float_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
float64 save_reg = float64_default_nan;
|
||||
struct softfloat_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
float64 save_reg = float64_default_nan;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
@@ -1215,8 +1209,8 @@ sf_FSTPd_a16(uint32_t fetchdat)
|
||||
}
|
||||
} else {
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word());
|
||||
save_reg = floatx80_to_float64(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.float_exception_flags, 1)) {
|
||||
save_reg = extF80_to_f64(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.softfloat_exceptionFlags, 1)) {
|
||||
goto next_ins;
|
||||
}
|
||||
}
|
||||
@@ -1225,6 +1219,7 @@ sf_FSTPd_a16(uint32_t fetchdat)
|
||||
seteaq(save_reg);
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
|
||||
fpu_state.swd = sw;
|
||||
FPU_pop();
|
||||
|
||||
@@ -1237,9 +1232,9 @@ next_ins:
|
||||
static int
|
||||
sf_FSTPd_a32(uint32_t fetchdat)
|
||||
{
|
||||
struct float_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
float64 save_reg = float64_default_nan;
|
||||
struct softfloat_status_t status;
|
||||
uint16_t sw = fpu_state.swd;
|
||||
float64 save_reg = float64_default_nan;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
@@ -1252,8 +1247,8 @@ sf_FSTPd_a32(uint32_t fetchdat)
|
||||
goto next_ins;
|
||||
} else {
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word());
|
||||
save_reg = floatx80_to_float64(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.float_exception_flags, 1))
|
||||
save_reg = extF80_to_f64(FPU_read_regi(0), &status);
|
||||
if (FPU_exception(fetchdat, status.softfloat_exceptionFlags, 1))
|
||||
goto next_ins;
|
||||
}
|
||||
// store to the memory might generate an exception, in this case original FPU_SW must be kept
|
||||
@@ -1261,6 +1256,7 @@ sf_FSTPd_a32(uint32_t fetchdat)
|
||||
seteaq(save_reg);
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
|
||||
fpu_state.swd = sw;
|
||||
FPU_pop();
|
||||
|
||||
@@ -1293,8 +1289,8 @@ sf_FSTPe_a16(uint32_t fetchdat)
|
||||
} else {
|
||||
save_reg = FPU_read_regi(0);
|
||||
}
|
||||
writememq(easeg, cpu_state.eaaddr, save_reg.fraction);
|
||||
writememw(easeg, cpu_state.eaaddr + 8, save_reg.exp);
|
||||
writememq(easeg, cpu_state.eaaddr, save_reg.signif);
|
||||
writememw(easeg, cpu_state.eaaddr + 8, save_reg.signExp);
|
||||
FPU_pop();
|
||||
|
||||
next_ins:
|
||||
@@ -1324,8 +1320,8 @@ sf_FSTPe_a32(uint32_t fetchdat)
|
||||
} else {
|
||||
save_reg = FPU_read_regi(0);
|
||||
}
|
||||
writememq(easeg, cpu_state.eaaddr, save_reg.fraction);
|
||||
writememw(easeg, cpu_state.eaaddr + 8, save_reg.exp);
|
||||
writememq(easeg, cpu_state.eaaddr, save_reg.signif);
|
||||
writememw(easeg, cpu_state.eaaddr + 8, save_reg.signExp);
|
||||
FPU_pop();
|
||||
|
||||
next_ins:
|
||||
@@ -1365,7 +1361,7 @@ sf_FSTP_sti(uint32_t fetchdat)
|
||||
cpu_state.pc++;
|
||||
clear_C1();
|
||||
if (IS_TAG_EMPTY(0)) {
|
||||
FPU_stack_underflow(fetchdat, fetchdat & 7, 1);
|
||||
FPU_pop();
|
||||
} else {
|
||||
st0_reg = FPU_read_regi(0);
|
||||
FPU_save_regi(st0_reg, fetchdat & 7);
|
||||
|
||||
Reference in New Issue
Block a user