1# See LICENSE for license details.
2
3#*****************************************************************************
4# fadd.S
5#-----------------------------------------------------------------------------
6#
7# Test f{add|sub|mul}.d instructions.
8#
9
10#include "riscv_test.h"
11#include "test_macros.h"
12
13RVTEST_RV64UF
14RVTEST_CODE_BEGIN
15
16#if __riscv_xlen == 32
17    # Replace the function with the 32-bit variant defined in test_macros.h
18    #undef TEST_FP_OP2_D
19    #define TEST_FP_OP2_D TEST_FP_OP2_D32
20#endif
21
22  #-------------------------------------------------------------
23  # Arithmetic tests
24  #-------------------------------------------------------------
25
26  TEST_FP_OP2_D( 2,  fadd.d, 0,                3.5,        2.5,        1.0 );
27  TEST_FP_OP2_D( 3,  fadd.d, 1,              -1234,    -1235.1,        1.1 );
28  TEST_FP_OP2_D( 4,  fadd.d, 1,         3.14159266, 3.14159265, 0.00000001 );
29
30  TEST_FP_OP2_D( 5,  fsub.d, 0,                1.5,        2.5,        1.0 );
31  TEST_FP_OP2_D( 6,  fsub.d, 1,              -1234,    -1235.1,       -1.1 );
32  TEST_FP_OP2_D( 7,  fsub.d, 1, 3.1415926400000001, 3.14159265, 0.00000001 );
33
34  TEST_FP_OP2_D( 8,  fmul.d, 0,                2.5,        2.5,        1.0 );
35  TEST_FP_OP2_D( 9,  fmul.d, 1,            1358.61,    -1235.1,       -1.1 );
36  TEST_FP_OP2_D(10,  fmul.d, 1,      3.14159265e-8, 3.14159265, 0.00000001 );
37
38  # Is the canonical NaN generated for Inf - Inf?
39  TEST_FP_OP2_D(11,  fsub.d, 0x10, qNaN, Inf, Inf);
40
41  TEST_PASSFAIL
42
43RVTEST_CODE_END
44
45  .data
46RVTEST_DATA_BEGIN
47
48  TEST_DATA
49
50RVTEST_DATA_END
51