aboutsummaryrefslogtreecommitdiff
path: root/source/RISCV
diff options
context:
space:
mode:
authorJohn Hauser <jhauser@eecs.berkeley.edu>2016-02-22 15:51:12 -0800
committerJohn Hauser <jhauser@eecs.berkeley.edu>2016-02-22 15:51:12 -0800
commit45fdcf1c6583e4af380b147ac568f5aa721b7ba8 (patch)
tree844650fe6e692766e725deaed8149125895cbc4b /source/RISCV
parent9dc9d10297e1d43e10188b5b19e2b697216fba2b (diff)
downloadberkeley-softfloat-3-45fdcf1c6583e4af380b147ac568f5aa721b7ba8.zip
berkeley-softfloat-3-45fdcf1c6583e4af380b147ac568f5aa721b7ba8.tar.gz
berkeley-softfloat-3-45fdcf1c6583e4af380b147ac568f5aa721b7ba8.tar.bz2
Added the ability to specify the result values delivered when conversions
from floating-point to an integer format raise an invalid exception. For the provided specializations (8086 and RISC-V), changed the result of converting a negative floating-point value to an unsigned integer format to now be zero. (Also renamed `shiftCount' inside functions to `shiftDist'.)
Diffstat (limited to 'source/RISCV')
-rw-r--r--source/RISCV/specialize.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/source/RISCV/specialize.h b/source/RISCV/specialize.h
index 972425d..6975f39 100644
--- a/source/RISCV/specialize.h
+++ b/source/RISCV/specialize.h
@@ -2,7 +2,7 @@
/*============================================================================
This C header file is part of the SoftFloat IEEE Floating-Point Arithmetic
-Package, Release 3a, by John R. Hauser.
+Package, Release 3a+, by John R. Hauser.
Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
California. All rights reserved.
@@ -45,7 +45,29 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/*----------------------------------------------------------------------------
| Default value for `softfloat_detectTininess'.
*----------------------------------------------------------------------------*/
-#define init_detectTininess softfloat_tininess_afterRounding;
+#define init_detectTininess softfloat_tininess_afterRounding
+
+/*----------------------------------------------------------------------------
+| The values to return on conversions to 32-bit integer format that raise an
+| invalid exception.
+*----------------------------------------------------------------------------*/
+#define ui32_fromPosOverflow 0xFFFFFFFF
+#define ui32_fromNegOverflow 0
+#define ui32_fromNaN 0xFFFFFFFF
+#define i32_fromPosOverflow 0x7FFFFFFF
+#define i32_fromNegOverflow (-0x7FFFFFFF - 1)
+#define i32_fromNaN 0x7FFFFFFF
+
+/*----------------------------------------------------------------------------
+| The values to return on conversions to 64-bit integer format that raise an
+| invalid exception.
+*----------------------------------------------------------------------------*/
+#define ui64_fromPosOverflow UINT64_C( 0xFFFFFFFFFFFFFFFF )
+#define ui64_fromNegOverflow 0
+#define ui64_fromNaN UINT64_C( 0xFFFFFFFFFFFFFFFF )
+#define i64_fromPosOverflow UINT64_C( 0x7FFFFFFFFFFFFFFF )
+#define i64_fromNegOverflow (-UINT64_C( 0x7FFFFFFFFFFFFFFF ) - 1)
+#define i64_fromNaN UINT64_C( 0x7FFFFFFFFFFFFFFF )
/*----------------------------------------------------------------------------
| "Common NaN" structure, used to transfer NaN representations from one format