]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
FPU update.
authorToni Wilen <twilen@winuae.net>
Sun, 29 Jan 2017 10:16:27 +0000 (12:16 +0200)
committerToni Wilen <twilen@winuae.net>
Sun, 29 Jan 2017 10:16:27 +0000 (12:16 +0200)
fpp.cpp
fpp_native.cpp
fpp_softfloat.cpp
softfloat/softfloat.cpp

diff --git a/fpp.cpp b/fpp.cpp
index 8800cb62ae38fd7f475219fcb0c7bb9cdf510c18..e7bd149e70ea81f51a8094bb66152bae95ef6cbc 100644 (file)
--- a/fpp.cpp
+++ b/fpp.cpp
@@ -2004,7 +2004,7 @@ void fpuop_save (uae_u32 opcode)
                                ad -= frame_size;
                }
        } else { /* 68881/68882 */
-               int frame_size_real = currprefs.fpu_model == 68882 ? 0x3c : 0x1c;;
+               int frame_size_real = currprefs.fpu_model == 68882 ? 0x3c : 0x1c;
                int frame_size = regs.fpu_state == 0 ? 0 : frame_size_real;
                uae_u32 frame_id = regs.fpu_state == 0 ? ((frame_size_real - 4) << 16) : (fpu_version << 24) | ((frame_size_real - 4) << 16);
                
@@ -2420,7 +2420,10 @@ static bool arithmetic(fpdata *src, int reg, int extra)
                case 0x38: /* FCMP */
                {
                        fpdata t = *dst;
+                       uae_u32 status = regs.fpsr;
                        fpp_sub(&t, src);
+                       fpsr_clear_status();
+                       fpp_set_fpsr(status);
                        fpsr_set_result(&t);
                        return true;
                }
index 5a4728b01843ef4edc42903edc94592190080939..3611969e4d1fced361ad83fef22bf69395dbdd89 100644 (file)
 #include "uae/vm.h"
 #include "newcpu.h"
 
-static uae_u32 xhex_pi[]    ={0x2168c235, 0xc90fdaa2, 0x4000};
+#ifdef JIT
 uae_u32 xhex_exp_1[] ={0xa2bb4a9a, 0xadf85458, 0x4000};
-static uae_u32 xhex_l2_e[]  ={0x5c17f0bc, 0xb8aa3b29, 0x3fff};
-static uae_u32 xhex_ln_2[]  ={0xd1cf79ac, 0xb17217f7, 0x3ffe};
 uae_u32 xhex_ln_10[] ={0xaaa8ac17, 0x935d8ddd, 0x4000};
 uae_u32 xhex_l10_2[] ={0xfbcff798, 0x9a209a84, 0x3ffd};
 uae_u32 xhex_l10_e[] ={0x37287195, 0xde5bd8a9, 0x3ffd};
@@ -47,6 +45,13 @@ uae_u32 xhex_1e512[] ={0xa60e91c7, 0xe319a0ae, 0x46a3};
 uae_u32 xhex_1e1024[]={0x81750c17, 0xc9767586, 0x4d48};
 uae_u32 xhex_1e2048[]={0xc53d5de5, 0x9e8b3b5d, 0x5a92};
 uae_u32 xhex_1e4096[]={0x8a20979b, 0xc4605202, 0x7525};
+double fp_1e8 = 1.0e8;
+float  fp_1e0 = 1, fp_1e1 = 10, fp_1e2 = 100, fp_1e4 = 10000;
+#endif
+
+static uae_u32 xhex_pi[]    ={0x2168c235, 0xc90fdaa2, 0x4000};
+static uae_u32 xhex_l2_e[]  ={0x5c17f0bc, 0xb8aa3b29, 0x3fff};
+static uae_u32 xhex_ln_2[]  ={0xd1cf79ac, 0xb17217f7, 0x3ffe};
 static uae_u32 xhex_inf[]   ={0x00000000, 0x00000000, 0x7fff};
 static uae_u32 xhex_nan[]   ={0xffffffff, 0xffffffff, 0x7fff};
 static uae_u32 xhex_snan[]  ={0xffffffff, 0xbfffffff, 0x7fff};
@@ -104,8 +109,6 @@ static double *fp_inf    = (double *)dhex_inf;
 static double *fp_nan    = (double *)dhex_nan;
 #endif
 static const double twoto32 = 4294967296.0;
-double fp_1e8 = 1.0e8;
-float  fp_1e0 = 1, fp_1e1 = 10, fp_1e2 = 100, fp_1e4 = 10000;
 
 #define        FPCR_ROUNDING_MODE      0x00000030
 #define        FPCR_ROUND_NEAR         0x00000000
@@ -812,11 +815,13 @@ static void fp_mul(fpdata *a, fpdata *b)
 }
 static void fp_sglmul(fpdata *a, fpdata *b)
 {
+       // not exact
        a->fp = a->fp * b->fp;
        fpp_roundsgl(a);
 }
 static void fp_sgldiv(fpdata *a, fpdata *b)
 {
+       // not exact
        a->fp = a->fp / b->fp;
        fpp_roundsgl(a);
 }
index c092ffd75abfa95afdf336fcc3d2a96c3beec4e9..83aa2d43e8c5a0f7211108100837700c8fb6c7b3 100644 (file)
@@ -41,7 +41,6 @@
 
 static floatx80 fxsizes[6];
 static floatx80 fxzero;
-static floatx80 fx_1e0, fx_1e1, fx_1e2, fx_1e4, fx_1e8;
 static struct float_status fs;
 
 /* Functions for setting host/library modes and getting status */
@@ -327,8 +326,27 @@ static void from_int(fpdata *fpd, uae_s32 src)
     fpd->fpx = int32_to_floatx80(src, &fs);
 }
 
+
+static inline int32_t extractFloatx80Exp( floatx80 a )
+{
+    return a.high & 0x7FFF;
+}
+static inline uint64_t extractFloatx80Frac( floatx80 a )
+{
+    return a.low;
+}
+
+
 /* Functions for rounding */
 
+static floatx80 fp_to_sgl(floatx80 a)
+{
+    floatx80 v = floatx80_round32(a, &fs);
+       v.high &= 0x7fff;
+       v.high |= a.high & 0x7fff;
+       return v;
+}
+
 // round to float with extended precision exponent
 static void fp_roundsgl(fpdata *fpd)
 {
@@ -413,16 +431,6 @@ static void fp_log2(fpdata *a, fpdata *dst)
     from_native(fpa, dst);
 }
 
-static inline int32_t extractFloatx80Exp( floatx80 a )
-{
-    return a.high & 0x7FFF;
-}
-static inline uint64_t extractFloatx80Frac( floatx80 a )
-{
-    return a.low;
-}
-
-
 static void fp_abs(fpdata *a, fpdata *dst)
 {
        uint64_t aSig = extractFloatx80Frac(a->fpx);
index 52fae6afcee8dc505e896cb4f245fdfa382a832b..83af324ea1ab55bb77bf3df3d0b21d55000c3d3b 100644 (file)
@@ -740,7 +740,6 @@ static void
 #else
        *zExpPtr = 1 - shiftCount;
 #endif
-       *zExpPtr = 1 - shiftCount;
 }
 
 /*----------------------------------------------------------------------------
@@ -5765,7 +5764,7 @@ floatx80 floatx80_sglmul( floatx80 a, floatx80 b, float_status *status )
        bSig &= LIT64( 0xFFFFFF0000000000 );
        zExp = aExp + bExp - 0x3FFE;
        mul64To128( aSig, bSig, &zSig0, &zSig1 );
-       if ( 0 < (uint64_t) zSig0 ) {
+       if ( 0 < (int64_t) zSig0 ) {
                shortShift128Left( zSig0, zSig1, 1, &zSig0, &zSig1 );
                --zExp;
        }
@@ -5906,8 +5905,7 @@ floatx80 floatx80_sgldiv( floatx80 a, floatx80 b, float_status *status )
                if ( aSig == 0 ) return packFloatx80( zSign, 0, 0 );
                normalizeFloatx80Subnormal( aSig, &aExp, &aSig );
        }
-    aSig &= LIT64( 0xFFFFFF0000000000 );
-    bSig &= LIT64( 0xFFFFFF0000000000 );
+
        zExp = aExp - bExp + 0x3FFE;
        rem1 = 0;
        if ( bSig <= aSig ) {