1# See LICENSE for license details.
2
3#*****************************************************************************
4# fmin.S
5#-----------------------------------------------------------------------------
6#
7# Test f{min|max}.d instructinos.
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,  fmin.d, 0,        1.0,        2.5,        1.0 );
27  TEST_FP_OP2_D( 3,  fmin.d, 0,    -1235.1,    -1235.1,        1.1 );
28  TEST_FP_OP2_D( 4,  fmin.d, 0,    -1235.1,        1.1,    -1235.1 );
29  TEST_FP_OP2_D( 5,  fmin.d, 0,    -1235.1,        NaN,    -1235.1 );
30  TEST_FP_OP2_D( 6,  fmin.d, 0, 0.00000001, 3.14159265, 0.00000001 );
31  TEST_FP_OP2_D( 7,  fmin.d, 0,       -2.0,       -1.0,       -2.0 );
32
33  TEST_FP_OP2_D(12,  fmax.d, 0,        2.5,        2.5,        1.0 );
34  TEST_FP_OP2_D(13,  fmax.d, 0,        1.1,    -1235.1,        1.1 );
35  TEST_FP_OP2_D(14,  fmax.d, 0,        1.1,        1.1,    -1235.1 );
36  TEST_FP_OP2_D(15,  fmax.d, 0,    -1235.1,        NaN,    -1235.1 );
37  TEST_FP_OP2_D(16,  fmax.d, 0, 3.14159265, 3.14159265, 0.00000001 );
38  TEST_FP_OP2_D(17,  fmax.d, 0,       -1.0,       -1.0,       -2.0 );
39
40  # FMIN(sNaN, x) = x
41  TEST_FP_OP2_D(20,  fmax.d, 0x10, 1.0, sNaN, 1.0);
42  # FMIN(qNaN, qNaN) = canonical NaN
43  TEST_FP_OP2_D(21,  fmax.d, 0x00, qNaN, NaN, NaN);
44
45  # -0.0 < +0.0
46  TEST_FP_OP2_D(30,  fmin.d, 0,       -0.0,       -0.0,        0.0 );
47  TEST_FP_OP2_D(31,  fmin.d, 0,       -0.0,        0.0,       -0.0 );
48  TEST_FP_OP2_D(32,  fmax.d, 0,        0.0,       -0.0,        0.0 );
49  TEST_FP_OP2_D(33,  fmax.d, 0,        0.0,        0.0,       -0.0 );
50
51  TEST_PASSFAIL
52
53RVTEST_CODE_END
54
55  .data
56RVTEST_DATA_BEGIN
57
58  TEST_DATA
59
60RVTEST_DATA_END
61