[sim] integrated SoftFloat-3 with ISA sim; removed SoftFloat-2b
[riscv-isa-sim.git] / softfloat / 8086 / specialize.h
diff --git a/softfloat/8086/specialize.h b/softfloat/8086/specialize.h
new file mode 100755 (executable)
index 0000000..ca0bb1d
--- /dev/null
@@ -0,0 +1,113 @@
+\r
+/*============================================================================\r
+\r
+*** FIX.\r
+\r
+This C source fragment is part of the SoftFloat IEC/IEEE Floating-point\r
+Arithmetic Package, Release 2b.\r
+\r
+Written by John R. Hauser.  This work was made possible in part by the\r
+International Computer Science Institute, located at Suite 600, 1947 Center\r
+Street, Berkeley, California 94704.  Funding was partially provided by the\r
+National Science Foundation under grant MIP-9311980.  The original version\r
+of this code was written as part of a project to build a fixed-point vector\r
+processor in collaboration with the University of California at Berkeley,\r
+overseen by Profs. Nelson Morgan and John Wawrzynek.  More information\r
+is available through the Web page `http://www.cs.berkeley.edu/~jhauser/\r
+arithmetic/SoftFloat.html'.\r
+\r
+THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort has\r
+been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT TIMES\r
+RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO PERSONS\r
+AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ALL LOSSES,\r
+COSTS, OR OTHER PROBLEMS THEY INCUR DUE TO THE SOFTWARE, AND WHO FURTHERMORE\r
+EFFECTIVELY INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER SCIENCE\r
+INSTITUTE (possibly via similar legal warning) AGAINST ALL LOSSES, COSTS, OR\r
+OTHER PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE SOFTWARE.\r
+\r
+Derivative works are acceptable, even for commercial purposes, so long as\r
+(1) the source code for the derivative work includes prominent notice that\r
+the work is derivative, and (2) the source code includes prominent notice with\r
+these four paragraphs for those parts of this code that are retained.\r
+\r
+=============================================================================*/\r
+\r
+#include <stdbool.h>\r
+#include <stdint.h>\r
+\r
+/*----------------------------------------------------------------------------\r
+*----------------------------------------------------------------------------*/\r
+#define init_detectTininess softfloat_tininess_afterRounding;\r
+\r
+/*----------------------------------------------------------------------------\r
+| Structure used to transfer NaN representations from one format to another.\r
+*----------------------------------------------------------------------------*/\r
+struct commonNaN {\r
+    bool sign;\r
+    uint64_t v64, v0;\r
+};\r
+\r
+/*----------------------------------------------------------------------------\r
+| The pattern for a default generated single-precision NaN.\r
+*----------------------------------------------------------------------------*/\r
+#define defaultNaNF32UI 0xFFC00000\r
+\r
+/*----------------------------------------------------------------------------\r
+| Returns 1 if the single-precision floating-point value `a' is a signaling\r
+| NaN; otherwise, returns 0.\r
+*----------------------------------------------------------------------------*/\r
+#if defined INLINE_LEVEL && ( 1 <= INLINE_LEVEL )\r
+INLINE bool softfloat_isSigNaNF32UI( uint_fast32_t ui )\r
+    { return ( ( ui>>22 & 0x1FF ) == 0x1FE ) && ( ui & 0x003FFFFF ); }\r
+#else\r
+bool softfloat_isSigNaNF32UI( uint_fast32_t );\r
+#endif\r
+\r
+/*----------------------------------------------------------------------------\r
+*----------------------------------------------------------------------------*/\r
+struct commonNaN softfloat_f32UIToCommonNaN( uint_fast32_t );\r
+#if defined INLINE_LEVEL && ( 1 <= INLINE_LEVEL )\r
+INLINE uint_fast32_t softfloat_commonNaNToF32UI( struct commonNaN a )\r
+    { return (uint_fast32_t) a.sign<<31 | 0x7FC00000 | a.v64>>41; }\r
+#else\r
+uint_fast32_t softfloat_commonNaNToF32UI( struct commonNaN );\r
+#endif\r
+\r
+/*----------------------------------------------------------------------------\r
+| Takes two single-precision floating-point values `a' and `b', one of which\r
+| is a NaN, and returns the appropriate NaN result.  If either `a' or `b' is a\r
+| signaling NaN, the invalid exception is raised.\r
+*----------------------------------------------------------------------------*/\r
+uint_fast32_t softfloat_propagateNaNF32UI( uint_fast32_t, uint_fast32_t );\r
+\r
+/*----------------------------------------------------------------------------\r
+| The pattern for a default generated double-precision NaN.\r
+*----------------------------------------------------------------------------*/\r
+#define defaultNaNF64UI UINT64_C(0xFFF8000000000000)\r
+\r
+/*----------------------------------------------------------------------------\r
+*----------------------------------------------------------------------------*/\r
+#if defined INLINE_LEVEL && ( 1 <= INLINE_LEVEL )\r
+INLINE bool softfloat_isSigNaNF64UI( uint_fast64_t ui )\r
+{\r
+    return\r
+        ( ( ui>>51 & 0xFFF ) == 0xFFE )\r
+            && ( ui & UINT64_C( 0x0007FFFFFFFFFFFF ) );\r
+}\r
+#else\r
+bool softfloat_isSigNaNF64UI( uint_fast64_t );\r
+#endif\r
+\r
+/*----------------------------------------------------------------------------\r
+*----------------------------------------------------------------------------*/\r
+/*** MIGHT BE INLINE'D. ***/\r
+struct commonNaN softfloat_f64UIToCommonNaN( uint_fast64_t );\r
+uint_fast64_t softfloat_commonNaNToF64UI( struct commonNaN );\r
+\r
+/*----------------------------------------------------------------------------\r
+| Takes two double-precision floating-point values `a' and `b', one of which\r
+| is a NaN, and returns the appropriate NaN result.  If either `a' or `b' is a\r
+| signaling NaN, the invalid exception is raised.\r
+*----------------------------------------------------------------------------*/\r
+uint_fast64_t softfloat_propagateNaNF64UI( uint_fast64_t, uint_fast64_t );\r
+\r