OpenCores
URL https://opencores.org/ocsvn/fwrisc/fwrisc/trunk

Subversion Repositories fwrisc

[/] [fwrisc/] [trunk/] [ve/] [fwrisc/] [tests/] [riscv-compliance/] [riscv-test-suite/] [rv32ud/] [rv64ud/] [recoding.S] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 mballance
# 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 "compliance_test.h"
15
#include "compliance_io.h"
16
#include "aw_test_macros.h"
17
 
18
RVTEST_RV64UF
19
RVTEST_CODE_BEGIN
20
 
21
  # Make sure infinities with different mantissas compare as equal.
22
  fld f0, minf, a0
23
  fld f1, three, a0
24
  fmul.d f1, f1, f0
25
  TEST_CASE( 2, a0, 1, feq.d a0, f0, f1)
26
  TEST_CASE( 3, a0, 1, fle.d a0, f0, f1)
27
  TEST_CASE( 4, a0, 0, flt.d a0, f0, f1)
28
 
29
  # Likewise, but for zeroes.
30
  fcvt.d.w f0, x0
31
  li a0, 1
32
  fcvt.d.w f1, a0
33
  fmul.d f1, f1, f0
34
  TEST_CASE(5, a0, 1, feq.d a0, f0, f1)
35
  TEST_CASE(6, a0, 1, fle.d a0, f0, f1)
36
  TEST_CASE(7, a0, 0, flt.d a0, f0, f1)
37
 
38
  # When converting small doubles to single-precision subnormals,
39
  # ensure that the extra precision is discarded.
40
  flw f0, big, a0
41
  fld f1, tiny, a0
42
  fcvt.s.d f1, f1
43
  fmul.s f0, f0, f1
44
  fmv.x.s a0, f0
45
  lw a1, small
46
  TEST_CASE(10, a0, 0, sub a0, a0, a1)
47
 
48
  # Make sure FSD+FLD correctly saves and restores a single-precision value.
49
  flw f0, three, a0
50
  fadd.s f1, f0, f0
51
  fadd.s f0, f0, f0
52
  fsd f0, tiny, a0
53
  fld f0, tiny, a0
54
  TEST_CASE(20, a0, 1, feq.s a0, f0, f1)
55
 
56
  TEST_PASSFAIL
57
 
58
RVTEST_CODE_END
59
 
60
  .data
61
 
62
minf: .double -Inf
63
three: .double 3.0
64
big: .float 1221
65
small: .float 2.9133121e-37
66
tiny: .double 2.3860049081905093e-40
67
 
68
  .data
69
RV_COMPLIANCE_DATA_BEGIN
70
test_res:
71
    .fill 40, 4, -1
72
RV_COMPLIANCE_DATA_END
73
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.