1# See LICENSE for license details.
2
3#*****************************************************************************
4# fdiv.S
5#-----------------------------------------------------------------------------
6#
7# Test f{div|sqrt}.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 functions with the 32-bit variants defined in test_macros.h
18    #undef TEST_FP_OP2_D
19    #define TEST_FP_OP2_D TEST_FP_OP2_D32
20
21    #undef TEST_FP_OP1_D
22    #define TEST_FP_OP1_D TEST_FP_OP1_D32
23
24    #undef TEST_FP_OP1_D_DWORD_RESULT
25    #define TEST_FP_OP1_D_DWORD_RESULT TEST_FP_OP1_D32_DWORD_RESULT
26#endif
27
28  #-------------------------------------------------------------
29  # Arithmetic tests
30  #-------------------------------------------------------------
31
32  TEST_FP_OP2_D( 2,  fdiv.d, 1, 1.1557273520668288, 3.14159265, 2.71828182 );
33  TEST_FP_OP2_D( 3,  fdiv.d, 1,-0.9991093838555584,      -1234,     1235.1 );
34  TEST_FP_OP2_D( 4,  fdiv.d, 0,         3.14159265, 3.14159265,        1.0 );
35
36  TEST_FP_OP1_D( 5,  fsqrt.d, 1, 1.7724538498928541, 3.14159265 );
37  TEST_FP_OP1_D( 6,  fsqrt.d, 0,                100,      10000 );
38
39  TEST_FP_OP1_D_DWORD_RESULT(16,  fsqrt.d, 0x10,      0x7FF8000000000000,      -1.0 );
40
41  TEST_FP_OP1_D( 7,  fsqrt.d, 1, 13.076696830622021, 171.0);
42
43  TEST_FP_OP1_D( 8,  fsqrt.d, 1,0.00040099251863345283320230749702, 1.60795e-7);
44
45  TEST_PASSFAIL
46
47RVTEST_CODE_END
48
49  .data
50RVTEST_DATA_BEGIN
51
52  TEST_DATA
53
54RVTEST_DATA_END
55