]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
68040+ support unnormal zeros in hardware.
authorToni Wilen <twilen@winuae.net>
Sun, 2 Jul 2017 07:43:18 +0000 (10:43 +0300)
committerToni Wilen <twilen@winuae.net>
Sun, 2 Jul 2017 07:43:18 +0000 (10:43 +0300)
fpp.cpp
softfloat/softfloat-specialize.h

diff --git a/fpp.cpp b/fpp.cpp
index 9b12106b8dc054eb7c818221de1cdd9355a3f430..1ecaf02259322c22c2351c76c3ccdc69b6954ad9 100644 (file)
--- a/fpp.cpp
+++ b/fpp.cpp
@@ -821,8 +821,8 @@ static void fp_unimp_instruction(uae_u16 opcode, uae_u16 extra, uae_u32 ea, uaec
                }
        }
        if (warned > 0) {
-               write_log (_T("FPU unimplemented instruction: OP=%04X-%04X EA=%08X PC=%08X\n"),
-                       opcode, extra, ea, oldpc);
+               write_log (_T("FPU unimplemented instruction: OP=%04X-%04X SRC=%08X-%08X-%08X EA=%08X PC=%08X\n"),
+                       opcode, extra, fsave_data.et[0],fsave_data.et[1],fsave_data.et[2], ea, oldpc);
  #if EXCEPTION_FPP == 0
                warned--;
  #endif
@@ -895,8 +895,9 @@ static void fp_unimp_datatype(uae_u16 opcode, uae_u16 extra, uae_u32 ea, uaecptr
                }
        }
        if (warned > 0) {
-               write_log (_T("FPU unimplemented datatype (%s): OP=%04X-%04X EA=%08X PC=%08X\n"),
-                       packed ? _T("packed") : _T("denormal"), opcode, extra, ea, oldpc);
+               write_log (_T("FPU unimplemented datatype (%s): OP=%04X-%04X SRC=%08X-%08X-%08X EA=%08X PC=%08X\n"),
+                       packed ? "packed" : "denormal", opcode, extra,
+                       packed ? fsave_data.fpt[2] : fsave_data.et[0], fsave_data.et[1], fsave_data.et[2], ea, oldpc);
 #if EXCEPTION_FPP == 0
                warned--;
 #endif
@@ -1134,8 +1135,12 @@ static bool normalize_or_fault_if_no_denormal_support(uae_u16 opcode, uae_u16 ex
                return false;
        if (fpp_is_unnormal(src) || fpp_is_denormal(src)) {
                if (currprefs.cpu_model >= 68040 && currprefs.fpu_model && currprefs.fpu_no_unimplemented) {
-                       fp_unimp_datatype(opcode, extra, ea, oldpc, src, NULL);
-                       return true;
+                       if (fpp_is_zero(src)) {
+                               fpp_normalize(src); // 68040/060 can only fix unnormal zeros
+                       } else {
+                               fp_unimp_datatype(opcode, extra, ea, oldpc, src, NULL);
+                               return true;
+                       }
                } else {
                        fpp_normalize(src);
                }
@@ -1148,8 +1153,12 @@ static bool normalize_or_fault_if_no_denormal_support_dst(uae_u16 opcode, uae_u1
                return false;
        if (fpp_is_unnormal(dst) || fpp_is_denormal(dst)) {
                if (currprefs.cpu_model >= 68040 && currprefs.fpu_model && currprefs.fpu_no_unimplemented) {
-                       fp_unimp_datatype(opcode, extra, ea, oldpc, src, NULL);
-                       return true;
+                       if (fpp_is_zero(dst)) {
+                               fpp_normalize(dst); // 68040/060 can only fix unnormal zeros
+                       } else {
+                               fp_unimp_datatype(opcode, extra, ea, oldpc, src, NULL);
+                               return true;
+                       }
                } else {
                        fpp_normalize(dst);
                }
@@ -1381,7 +1390,7 @@ static int put_fp_value (fpdata *value, uae_u32 opcode, uae_u16 extra, uaecptr o
 
 #if DEBUG_FPP
        if (!isinrom ())
-               write_log (_T("PUTFP: %f %04X %04X\n"), value, opcode, extra);
+               write_log (_T("PUTFP: %04X %04X\n"), opcode, extra);
 #endif
 #if 0
        if (!(extra & 0x4000)) {
@@ -2112,6 +2121,7 @@ void fpuop_restore (uae_u32 opcode)
        uae_u32 d;
 
        regs.fp_exception = false;
+
 #if DEBUG_FPP
        if (!isinrom ())
                write_log (_T("frestore_opp at %08x\n"), m68k_getpc ());
index 4dd65a205c271eddd12f02ca5bdf3cefaa491919..69e741e5c263e2dcc7ea3e98ef07bd5f08abd10e 100644 (file)
@@ -374,7 +374,7 @@ static inline floatx80 propagateFloatx80NaNOneArg(floatx80 a, float_status *stat
 static inline flag floatx80_is_zero( floatx80 a )
 {
     
-    return ( ( a.high & 0x7FFF ) == 0 ) && ( a.low == 0 );
+    return ( ( a.high & 0x7FFF ) < 0x7FFF ) && ( a.low == 0 );
     
 }