1# See LICENSE for license details.
2
3#*****************************************************************************
4# fmadd.S
5#-----------------------------------------------------------------------------
6#
7# Test f[n]m{add|sub}.s and f[n]m{add|sub}.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_OP3_D
19    #define TEST_FP_OP3_D TEST_FP_OP3_D32
20#endif
21
22  #-------------------------------------------------------------
23  # Arithmetic tests
24  #-------------------------------------------------------------
25
26  TEST_FP_OP3_D( 2,  fmadd.d, 0,                 3.5,  1.0,        2.5,        1.0 );
27  TEST_FP_OP3_D( 3,  fmadd.d, 1,  1236.1999999999999, -1.0,    -1235.1,        1.1 );
28  TEST_FP_OP3_D( 4,  fmadd.d, 0,               -12.0,  2.0,       -5.0,       -2.0 );
29
30  TEST_FP_OP3_D( 5, fnmadd.d, 0,                -3.5,  1.0,        2.5,        1.0 );
31  TEST_FP_OP3_D( 6, fnmadd.d, 1, -1236.1999999999999, -1.0,    -1235.1,        1.1 );
32  TEST_FP_OP3_D( 7, fnmadd.d, 0,                12.0,  2.0,       -5.0,       -2.0 );
33
34  TEST_FP_OP3_D( 8,  fmsub.d, 0,                 1.5,  1.0,        2.5,        1.0 );
35  TEST_FP_OP3_D( 9,  fmsub.d, 1,                1234, -1.0,    -1235.1,        1.1 );
36  TEST_FP_OP3_D(10,  fmsub.d, 0,                -8.0,  2.0,       -5.0,       -2.0 );
37
38  TEST_FP_OP3_D(11, fnmsub.d, 0,                -1.5,  1.0,        2.5,        1.0 );
39  TEST_FP_OP3_D(12, fnmsub.d, 1,               -1234, -1.0,    -1235.1,        1.1 );
40  TEST_FP_OP3_D(13, fnmsub.d, 0,                 8.0,  2.0,       -5.0,       -2.0 );
41
42  TEST_PASSFAIL
43
44RVTEST_CODE_END
45
46  .data
47RVTEST_DATA_BEGIN
48
49  TEST_DATA
50
51RVTEST_DATA_END
52