6397143feff169c605102cc16cec4f29e38f935f
[riscv-tests.git] / isa / rv64uf / recoding.S
1 # See LICENSE for license details.
2
3 #*****************************************************************************
4 # recoding.S
5 #-----------------------------------------------------------------------------
6 #
7 # Test corner cases of John Hauser's microarchitectural recoding scheme.
8 # There are twice as many recoded values as IEEE-754 values; some of these
9 # extras are redundant (e.g. Inf) and others are illegal (subnormals with
10 # too many bits set).
11 #
12
13 #include "riscv_test.h"
14 #include "test_macros.h"
15
16 RVTEST_RV64UF
17 RVTEST_CODE_BEGIN
18
19 # Make sure infinities with different mantissas compare as equal.
20 flw f0, minf, a0
21 flw f1, three, a0
22 fmul.s f1, f1, f0
23 TEST_CASE( 2, a0, 1, feq.s a0, f0, f1)
24 TEST_CASE( 3, a0, 1, fle.s a0, f0, f1)
25 TEST_CASE( 4, a0, 0, flt.s a0, f0, f1)
26
27 # When converting small doubles to single-precision subnormals,
28 # ensure that the extra precision is discarded.
29 flw f0, big, a0
30 fld f1, tiny, a0
31 fcvt.s.d f1, f1
32 fmul.s f0, f0, f1
33 fmv.x.s a0, f0
34 lw a1, small
35 TEST_CASE(10, a0, 0, sub a0, a0, a1)
36
37 TEST_PASSFAIL
38
39 RVTEST_CODE_END
40
41 .data
42 RVTEST_DATA_BEGIN
43
44 minf: .float -Inf
45 three: .float 3.0
46 big: .float 1221
47 small: .float 2.9133121e-37
48 tiny: .double 2.3860049081905093e-40
49
50 RVTEST_DATA_END