Tcl Source Code

Artifact [71542f3de7]
Login

Artifact 71542f3de7bd17d59c2ac489944a73aef5eab54c:

Attachment "mipsdenorm.patch" to ticket [2819200fff] added by dgp 2009-07-10 02:45:15.
Index: generic/tclStrToD.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclStrToD.c,v
retrieving revision 1.33.2.1
diff -u -r1.33.2.1 tclStrToD.c
--- generic/tclStrToD.c	1 Apr 2008 20:12:01 -0000	1.33.2.1
+++ generic/tclStrToD.c	9 Jul 2009 19:44:04 -0000
@@ -68,6 +68,14 @@
 #if defined(__sun) && defined(__i386) && !defined(__GNUC__)
 #include <sunmath.h>
 #endif
+
+/*
+ * MIPS floating-point units need special settings in control registers
+ * to use gradual underflow as we expect.
+ */
+#if defined(__mips)
+#include <sys/fpu.h>
+#endif
 /*
  * HP's PA_RISC architecture uses 7ff4000000000000 to represent a quiet NaN.
  * Everyone else uses 7ff8000000000000. (Why, HP, why?)
@@ -2158,6 +2166,14 @@
     } bitwhack;
 #endif
 
+#if defined(__mips)
+    union fpc_csr mipsCR;
+
+    mipsCR.fc_word = get_fpc_csr();
+    mipsCR.fc_struct.flush = 0;
+    set_fpc_csr(mipsCR.fc_word);
+#endif
+
     /*
      * Initialize table of powers of 10 expressed as wide integers.
      */