aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2015-09-20 14:57:19 -0700
committerAndrew Waterman <waterman@cs.berkeley.edu>2015-09-20 16:19:09 -0700
commitf66d9faeca28d491115eb60a8f5b6b747f255a09 (patch)
treeb85570d6d9c048474440f6ef7390b349abe55b17
parent017320312f1bc1adf22390f8692a1c4d2d06268f (diff)
downloadriscv-tests-f66d9faeca28d491115eb60a8f5b6b747f255a09.zip
riscv-tests-f66d9faeca28d491115eb60a8f5b6b747f255a09.tar.gz
riscv-tests-f66d9faeca28d491115eb60a8f5b6b747f255a09.tar.bz2
Add another FP recoding test case
-rw-r--r--isa/rv64uf/recoding.S26
1 files changed, 20 insertions, 6 deletions
diff --git a/isa/rv64uf/recoding.S b/isa/rv64uf/recoding.S
index dee7f6d..6397143 100644
--- a/isa/rv64uf/recoding.S
+++ b/isa/rv64uf/recoding.S
@@ -5,6 +5,9 @@
#-----------------------------------------------------------------------------
#
# Test corner cases of John Hauser's microarchitectural recoding scheme.
+# There are twice as many recoded values as IEEE-754 values; some of these
+# extras are redundant (e.g. Inf) and others are illegal (subnormals with
+# too many bits set).
#
#include "riscv_test.h"
@@ -13,15 +16,23 @@
RVTEST_RV64UF
RVTEST_CODE_BEGIN
- # Infinity has a redundant internal form in Rocket.
- # Make sure two different internal infinities compare as equal.
- li TESTNUM, 8
+ # Make sure infinities with different mantissas compare as equal.
flw f0, minf, a0
flw f1, three, a0
fmul.s f1, f1, f0
- TEST_CASE( 8, a0, 1, feq.s a0, f0, f1)
- TEST_CASE( 9, a0, 1, fle.s a0, f0, f1)
- TEST_CASE(10, a0, 0, flt.s a0, f0, f1)
+ TEST_CASE( 2, a0, 1, feq.s a0, f0, f1)
+ TEST_CASE( 3, a0, 1, fle.s a0, f0, f1)
+ TEST_CASE( 4, a0, 0, flt.s a0, f0, f1)
+
+ # When converting small doubles to single-precision subnormals,
+ # ensure that the extra precision is discarded.
+ flw f0, big, a0
+ fld f1, tiny, a0
+ fcvt.s.d f1, f1
+ fmul.s f0, f0, f1
+ fmv.x.s a0, f0
+ lw a1, small
+ TEST_CASE(10, a0, 0, sub a0, a0, a1)
TEST_PASSFAIL
@@ -32,5 +43,8 @@ RVTEST_DATA_BEGIN
minf: .float -Inf
three: .float 3.0
+big: .float 1221
+small: .float 2.9133121e-37
+tiny: .double 2.3860049081905093e-40
RVTEST_DATA_END