aboutsummaryrefslogtreecommitdiff
path: root/target-i386/op.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2005-03-13 17:01:47 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2005-03-13 17:01:47 +0000
commit7a0e1f41ceeb658791a1456ffc7f8f9edca7da19 (patch)
treeeab50fb37085ad2dc6e8aa283f334defd538fa8c /target-i386/op.c
parent4ecc31906d7535c4ad88fcc63968bef412dd67ba (diff)
downloadqemu-7a0e1f41ceeb658791a1456ffc7f8f9edca7da19.zip
qemu-7a0e1f41ceeb658791a1456ffc7f8f9edca7da19.tar.gz
qemu-7a0e1f41ceeb658791a1456ffc7f8f9edca7da19.tar.bz2
soft float support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1336 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-i386/op.c')
-rw-r--r--target-i386/op.c49
1 files changed, 6 insertions, 43 deletions
diff --git a/target-i386/op.c b/target-i386/op.c
index dc0dcea..bbc2b19 100644
--- a/target-i386/op.c
+++ b/target-i386/op.c
@@ -1598,26 +1598,6 @@ CCTable cc_table[CC_OP_NB] = {
functions comes from the LGPL'ed x86 emulator found in the Willows
TWIN windows emulator. */
-#if defined(__powerpc__)
-extern CPU86_LDouble copysign(CPU86_LDouble, CPU86_LDouble);
-
-/* correct (but slow) PowerPC rint() (glibc version is incorrect) */
-double qemu_rint(double x)
-{
- double y = 4503599627370496.0;
- if (fabs(x) >= y)
- return x;
- if (x < 0)
- y = -y;
- y = (x + y) - y;
- if (y == 0.0)
- y = copysign(y, x);
- return y;
-}
-
-#define rint qemu_rint
-#endif
-
/* fp load FT0 */
void OPPROTO op_flds_FT0_A0(void)
@@ -1866,7 +1846,7 @@ void OPPROTO op_fist_ST0_A0(void)
int val;
d = ST0;
- val = lrint(d);
+ val = floatx_to_int32(d, &env->fp_status);
if (val != (int16_t)val)
val = -32768;
stw(A0, val);
@@ -1883,7 +1863,7 @@ void OPPROTO op_fistl_ST0_A0(void)
int val;
d = ST0;
- val = lrint(d);
+ val = floatx_to_int32(d, &env->fp_status);
stl(A0, val);
FORCE_RET();
}
@@ -1898,7 +1878,7 @@ void OPPROTO op_fistll_ST0_A0(void)
int64_t val;
d = ST0;
- val = llrint(d);
+ val = floatx_to_int64(d, &env->fp_status);
stq(A0, val);
FORCE_RET();
}
@@ -2101,12 +2081,12 @@ void OPPROTO op_fdivr_STN_ST0(void)
/* misc FPU operations */
void OPPROTO op_fchs_ST0(void)
{
- ST0 = -ST0;
+ ST0 = floatx_chs(ST0);
}
void OPPROTO op_fabs_ST0(void)
{
- ST0 = fabs(ST0);
+ ST0 = floatx_abs(ST0);
}
void OPPROTO op_fxam_ST0(void)
@@ -2251,25 +2231,8 @@ void OPPROTO op_fnstcw_A0(void)
void OPPROTO op_fldcw_A0(void)
{
- int rnd_type;
env->fpuc = lduw(A0);
- /* set rounding mode */
- switch(env->fpuc & RC_MASK) {
- default:
- case RC_NEAR:
- rnd_type = FE_TONEAREST;
- break;
- case RC_DOWN:
- rnd_type = FE_DOWNWARD;
- break;
- case RC_UP:
- rnd_type = FE_UPWARD;
- break;
- case RC_CHOP:
- rnd_type = FE_TOWARDZERO;
- break;
- }
- fesetround(rnd_type);
+ update_fp_status();
}
void OPPROTO op_fclex(void)