Upgrade to softfloat3e.
This should solve licensing problems as well.
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
static int
|
||||
sf_F2XM1(uint32_t fetchdat)
|
||||
{
|
||||
floatx80 result;
|
||||
struct float_status_t status;
|
||||
floatx80 result;
|
||||
struct softfloat_status_t status;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
cpu_state.pc++;
|
||||
clear_C1();
|
||||
if (IS_TAG_EMPTY(0)) {
|
||||
@@ -13,7 +14,7 @@ sf_F2XM1(uint32_t fetchdat)
|
||||
}
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word() | FPU_PR_80_BITS);
|
||||
result = f2xm1(FPU_read_regi(0), &status);
|
||||
if (!FPU_exception(fetchdat, status.float_exception_flags, 0))
|
||||
if (!FPU_exception(fetchdat, status.softfloat_exceptionFlags, 0))
|
||||
FPU_save_regi(result, 0);
|
||||
|
||||
next_ins:
|
||||
@@ -25,10 +26,11 @@ next_ins:
|
||||
static int
|
||||
sf_FYL2X(uint32_t fetchdat)
|
||||
{
|
||||
floatx80 result;
|
||||
struct float_status_t status;
|
||||
floatx80 result;
|
||||
struct softfloat_status_t status;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
cpu_state.pc++;
|
||||
clear_C1();
|
||||
if (IS_TAG_EMPTY(0) || IS_TAG_EMPTY(1)) {
|
||||
@@ -37,7 +39,7 @@ sf_FYL2X(uint32_t fetchdat)
|
||||
}
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word() | FPU_PR_80_BITS);
|
||||
result = fyl2x(FPU_read_regi(0), FPU_read_regi(1), &status);
|
||||
if (!FPU_exception(fetchdat, status.float_exception_flags, 0)) {
|
||||
if (!FPU_exception(fetchdat, status.softfloat_exceptionFlags, 0)) {
|
||||
FPU_pop();
|
||||
FPU_save_regi(result, 0);
|
||||
}
|
||||
@@ -51,11 +53,12 @@ next_ins:
|
||||
static int
|
||||
sf_FPTAN(uint32_t fetchdat)
|
||||
{
|
||||
const floatx80 floatx80_default_nan = packFloatx80(0, floatx80_default_nan_exp, floatx80_default_nan_fraction);
|
||||
floatx80 y;
|
||||
struct float_status_t status;
|
||||
const floatx80 floatx80_default_nan = packFloatx80(0, floatx80_default_nan_exp, floatx80_default_nan_fraction);
|
||||
floatx80 y;
|
||||
struct softfloat_status_t status;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
cpu_state.pc++;
|
||||
clear_C1();
|
||||
clear_C2();
|
||||
@@ -76,12 +79,12 @@ sf_FPTAN(uint32_t fetchdat)
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word() | FPU_PR_80_BITS);
|
||||
y = FPU_read_regi(0);
|
||||
if (ftan(&y, &status) == -1) {
|
||||
fpu_state.swd |= C2;
|
||||
fpu_state.swd |= FPU_SW_C2;
|
||||
goto next_ins;
|
||||
}
|
||||
|
||||
if (floatx80_is_nan(y)) {
|
||||
if (!FPU_exception(fetchdat, status.float_exception_flags, 0)) {
|
||||
if (extF80_isNaN(y)) {
|
||||
if (!FPU_exception(fetchdat, status.softfloat_exceptionFlags, 0)) {
|
||||
FPU_save_regi(y, 0);
|
||||
FPU_push();
|
||||
FPU_save_regi(y, 0);
|
||||
@@ -89,7 +92,7 @@ sf_FPTAN(uint32_t fetchdat)
|
||||
goto next_ins;
|
||||
}
|
||||
|
||||
if (!FPU_exception(fetchdat, status.float_exception_flags, 0)) {
|
||||
if (!FPU_exception(fetchdat, status.softfloat_exceptionFlags, 0)) {
|
||||
FPU_save_regi(y, 0);
|
||||
FPU_push();
|
||||
FPU_save_regi(Const_1, 0);
|
||||
@@ -104,12 +107,13 @@ next_ins:
|
||||
static int
|
||||
sf_FPATAN(uint32_t fetchdat)
|
||||
{
|
||||
floatx80 a;
|
||||
floatx80 b;
|
||||
floatx80 result;
|
||||
struct float_status_t status;
|
||||
floatx80 a;
|
||||
floatx80 b;
|
||||
floatx80 result;
|
||||
struct softfloat_status_t status;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
cpu_state.pc++;
|
||||
if (IS_TAG_EMPTY(0) || IS_TAG_EMPTY(1)) {
|
||||
FPU_stack_underflow(fetchdat, 1, 1);
|
||||
@@ -119,7 +123,7 @@ sf_FPATAN(uint32_t fetchdat)
|
||||
b = FPU_read_regi(1);
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word() | FPU_PR_80_BITS);
|
||||
result = fpatan(a, b, &status);
|
||||
if (!FPU_exception(fetchdat, status.float_exception_flags, 0)) {
|
||||
if (!FPU_exception(fetchdat, status.softfloat_exceptionFlags, 0)) {
|
||||
FPU_pop();
|
||||
FPU_save_regi(result, 0);
|
||||
}
|
||||
@@ -133,11 +137,15 @@ next_ins:
|
||||
static int
|
||||
sf_FXTRACT(uint32_t fetchdat)
|
||||
{
|
||||
struct float_status_t status;
|
||||
floatx80 a;
|
||||
floatx80 b;
|
||||
struct softfloat_status_t status;
|
||||
floatx80 a;
|
||||
floatx80 b;
|
||||
#if 0
|
||||
const floatx80 floatx80_default_nan = packFloatx80(0, floatx80_default_nan_exp, floatx80_default_nan_fraction);
|
||||
#endif
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
cpu_state.pc++;
|
||||
clear_C1();
|
||||
|
||||
@@ -160,8 +168,8 @@ sf_FXTRACT(uint32_t fetchdat)
|
||||
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word());
|
||||
a = FPU_read_regi(0);
|
||||
b = floatx80_extract(&a, &status);
|
||||
if (!FPU_exception(fetchdat, status.float_exception_flags, 0)) {
|
||||
b = extF80_extract(&a, &status);
|
||||
if (!FPU_exception(fetchdat, status.softfloat_exceptionFlags, 0)) {
|
||||
FPU_save_regi(b, 0); // exponent
|
||||
FPU_push();
|
||||
FPU_save_regi(a, 0); // fraction
|
||||
@@ -178,15 +186,16 @@ next_ins:
|
||||
static int
|
||||
sf_FPREM1(uint32_t fetchdat)
|
||||
{
|
||||
floatx80 a;
|
||||
floatx80 b;
|
||||
floatx80 result;
|
||||
struct float_status_t status;
|
||||
uint64_t quotient = 0;
|
||||
int flags;
|
||||
int cc;
|
||||
floatx80 a;
|
||||
floatx80 b;
|
||||
floatx80 result;
|
||||
struct softfloat_status_t status;
|
||||
uint64_t quotient = 0;
|
||||
int flags;
|
||||
int cc;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
cpu_state.pc++;
|
||||
clear_C1();
|
||||
clear_C2();
|
||||
@@ -198,18 +207,18 @@ sf_FPREM1(uint32_t fetchdat)
|
||||
a = FPU_read_regi(0);
|
||||
b = FPU_read_regi(1);
|
||||
flags = floatx80_ieee754_remainder(a, b, &result, "ient, &status);
|
||||
if (!FPU_exception(fetchdat, status.float_exception_flags, 0)) {
|
||||
if (!FPU_exception(fetchdat, status.softfloat_exceptionFlags, 0)) {
|
||||
if (flags >= 0) {
|
||||
cc = 0;
|
||||
if (flags)
|
||||
cc = C2;
|
||||
cc = FPU_SW_C2;
|
||||
else {
|
||||
if (quotient & 1)
|
||||
cc |= C1;
|
||||
cc |= FPU_SW_C1;
|
||||
if (quotient & 2)
|
||||
cc |= C3;
|
||||
cc |= FPU_SW_C3;
|
||||
if (quotient & 4)
|
||||
cc |= C0;
|
||||
cc |= FPU_SW_C0;
|
||||
}
|
||||
setcc(cc);
|
||||
}
|
||||
@@ -225,15 +234,16 @@ next_ins:
|
||||
static int
|
||||
sf_FPREM(uint32_t fetchdat)
|
||||
{
|
||||
floatx80 a;
|
||||
floatx80 b;
|
||||
floatx80 result;
|
||||
struct float_status_t status;
|
||||
uint64_t quotient = 0;
|
||||
int flags;
|
||||
int cc;
|
||||
floatx80 a;
|
||||
floatx80 b;
|
||||
floatx80 result;
|
||||
struct softfloat_status_t status;
|
||||
uint64_t quotient = 0;
|
||||
int flags;
|
||||
int cc;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
cpu_state.pc++;
|
||||
clear_C1();
|
||||
clear_C2();
|
||||
@@ -246,18 +256,18 @@ sf_FPREM(uint32_t fetchdat)
|
||||
b = FPU_read_regi(1);
|
||||
// handle unsupported extended double-precision floating encodings
|
||||
flags = floatx80_remainder(a, b, &result, "ient, &status);
|
||||
if (!FPU_exception(fetchdat, status.float_exception_flags, 0)) {
|
||||
if (!FPU_exception(fetchdat, status.softfloat_exceptionFlags, 0)) {
|
||||
if (flags >= 0) {
|
||||
cc = 0;
|
||||
if (flags)
|
||||
cc = C2;
|
||||
cc = FPU_SW_C2;
|
||||
else {
|
||||
if (quotient & 1)
|
||||
cc |= C1;
|
||||
cc |= FPU_SW_C1;
|
||||
if (quotient & 2)
|
||||
cc |= C3;
|
||||
cc |= FPU_SW_C3;
|
||||
if (quotient & 4)
|
||||
cc |= C0;
|
||||
cc |= FPU_SW_C0;
|
||||
}
|
||||
setcc(cc);
|
||||
}
|
||||
@@ -273,10 +283,11 @@ next_ins:
|
||||
static int
|
||||
sf_FYL2XP1(uint32_t fetchdat)
|
||||
{
|
||||
floatx80 result;
|
||||
struct float_status_t status;
|
||||
floatx80 result;
|
||||
struct softfloat_status_t status;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
cpu_state.pc++;
|
||||
clear_C1();
|
||||
if (IS_TAG_EMPTY(0) || IS_TAG_EMPTY(1)) {
|
||||
@@ -285,7 +296,7 @@ sf_FYL2XP1(uint32_t fetchdat)
|
||||
}
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word() | FPU_PR_80_BITS);
|
||||
result = fyl2xp1(FPU_read_regi(0), FPU_read_regi(1), &status);
|
||||
if (!FPU_exception(fetchdat, status.float_exception_flags, 0)) {
|
||||
if (!FPU_exception(fetchdat, status.softfloat_exceptionFlags, 0)) {
|
||||
FPU_save_regi(result, 1);
|
||||
FPU_pop();
|
||||
}
|
||||
@@ -300,13 +311,14 @@ next_ins:
|
||||
static int
|
||||
sf_FSINCOS(uint32_t fetchdat)
|
||||
{
|
||||
const floatx80 floatx80_default_nan = packFloatx80(0, floatx80_default_nan_exp, floatx80_default_nan_fraction);
|
||||
struct float_status_t status;
|
||||
floatx80 y;
|
||||
floatx80 sin_y;
|
||||
floatx80 cos_y;
|
||||
const floatx80 floatx80_default_nan = packFloatx80(0, floatx80_default_nan_exp, floatx80_default_nan_fraction);
|
||||
struct softfloat_status_t status;
|
||||
floatx80 y;
|
||||
floatx80 sin_y;
|
||||
floatx80 cos_y;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
cpu_state.pc++;
|
||||
clear_C1();
|
||||
clear_C2();
|
||||
@@ -327,10 +339,10 @@ sf_FSINCOS(uint32_t fetchdat)
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word() | FPU_PR_80_BITS);
|
||||
y = FPU_read_regi(0);
|
||||
if (fsincos(y, &sin_y, &cos_y, &status) == -1) {
|
||||
fpu_state.swd |= C2;
|
||||
fpu_state.swd |= FPU_SW_C2;
|
||||
goto next_ins;
|
||||
}
|
||||
if (!FPU_exception(fetchdat, status.float_exception_flags, 0)) {
|
||||
if (!FPU_exception(fetchdat, status.softfloat_exceptionFlags, 0)) {
|
||||
FPU_save_regi(sin_y, 0);
|
||||
FPU_push();
|
||||
FPU_save_regi(cos_y, 0);
|
||||
@@ -346,10 +358,11 @@ next_ins:
|
||||
static int
|
||||
sf_FSCALE(uint32_t fetchdat)
|
||||
{
|
||||
floatx80 result;
|
||||
struct float_status_t status;
|
||||
floatx80 result;
|
||||
struct softfloat_status_t status;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
cpu_state.pc++;
|
||||
clear_C1();
|
||||
if (IS_TAG_EMPTY(0) || IS_TAG_EMPTY(1)) {
|
||||
@@ -357,8 +370,8 @@ sf_FSCALE(uint32_t fetchdat)
|
||||
goto next_ins;
|
||||
}
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word());
|
||||
result = floatx80_scale(FPU_read_regi(0), FPU_read_regi(1), &status);
|
||||
if (!FPU_exception(fetchdat, status.float_exception_flags, 0))
|
||||
result = extF80_scale(FPU_read_regi(0), FPU_read_regi(1), &status);
|
||||
if (!FPU_exception(fetchdat, status.softfloat_exceptionFlags, 0))
|
||||
FPU_save_regi(result, 0);
|
||||
|
||||
next_ins:
|
||||
@@ -371,10 +384,11 @@ next_ins:
|
||||
static int
|
||||
sf_FSIN(uint32_t fetchdat)
|
||||
{
|
||||
floatx80 y;
|
||||
struct float_status_t status;
|
||||
floatx80 y;
|
||||
struct softfloat_status_t status;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
cpu_state.pc++;
|
||||
clear_C1();
|
||||
clear_C2();
|
||||
@@ -385,10 +399,10 @@ sf_FSIN(uint32_t fetchdat)
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word() | FPU_PR_80_BITS);
|
||||
y = FPU_read_regi(0);
|
||||
if (fsin(&y, &status) == -1) {
|
||||
fpu_state.swd |= C2;
|
||||
fpu_state.swd |= FPU_SW_C2;
|
||||
goto next_ins;
|
||||
}
|
||||
if (!FPU_exception(fetchdat, status.float_exception_flags, 0))
|
||||
if (!FPU_exception(fetchdat, status.softfloat_exceptionFlags, 0))
|
||||
FPU_save_regi(y, 0);
|
||||
|
||||
next_ins:
|
||||
@@ -400,10 +414,11 @@ next_ins:
|
||||
static int
|
||||
sf_FCOS(uint32_t fetchdat)
|
||||
{
|
||||
floatx80 y;
|
||||
struct float_status_t status;
|
||||
floatx80 y;
|
||||
struct softfloat_status_t status;
|
||||
|
||||
FP_ENTER();
|
||||
FPU_check_pending_exceptions();
|
||||
cpu_state.pc++;
|
||||
clear_C1();
|
||||
clear_C2();
|
||||
@@ -414,10 +429,10 @@ sf_FCOS(uint32_t fetchdat)
|
||||
status = i387cw_to_softfloat_status_word(i387_get_control_word() | FPU_PR_80_BITS);
|
||||
y = FPU_read_regi(0);
|
||||
if (fcos(&y, &status) == -1) {
|
||||
fpu_state.swd |= C2;
|
||||
fpu_state.swd |= FPU_SW_C2;
|
||||
goto next_ins;
|
||||
}
|
||||
if (!FPU_exception(fetchdat, status.float_exception_flags, 0))
|
||||
if (!FPU_exception(fetchdat, status.softfloat_exceptionFlags, 0))
|
||||
FPU_save_regi(y, 0);
|
||||
|
||||
next_ins:
|
||||
|
||||
Reference in New Issue
Block a user