[sim] integrated SoftFloat-3 with ISA sim; removed SoftFloat-2b
[riscv-isa-sim.git] / softfloat / i32_to_f32.cc
diff --git a/softfloat/i32_to_f32.cc b/softfloat/i32_to_f32.cc
new file mode 100755 (executable)
index 0000000..f51facd
--- /dev/null
@@ -0,0 +1,21 @@
+\r
+#include <stdbool.h>\r
+#include <stdint.h>\r
+#include "platform.h"\r
+#include "internals.h"\r
+#include "softfloat.h"\r
+\r
+float32_t i32_to_f32( int_fast32_t a )\r
+{\r
+    bool sign;\r
+    union ui32_f32 uZ;\r
+\r
+    sign = ( a < 0 );\r
+    if ( ! ( a & 0x7FFFFFFF ) ) {\r
+        uZ.ui = sign ? packToF32UI( 1, 0x9E, 0 ) : 0;\r
+        return uZ.f;\r
+    }\r
+    return softfloat_normRoundPackToF32( sign, 0x9C, sign ? - a : a );\r
+\r
+}\r
+\r