From 74bc584aa5be5d52ded54e44dbf465f63b03a629 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Fri, 20 Mar 2015 22:16:44 -0700 Subject: [PATCH] Add fdiv test --- isa/macros/scalar/test_macros.h | 8 +++--- isa/rv64uf/Makefrag | 2 +- isa/rv64uf/fdiv.S | 43 +++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 isa/rv64uf/fdiv.S diff --git a/isa/macros/scalar/test_macros.h b/isa/macros/scalar/test_macros.h index 83116f2..6242f0b 100644 --- a/isa/macros/scalar/test_macros.h +++ b/isa/macros/scalar/test_macros.h @@ -492,12 +492,12 @@ test_ ## testnum: \ TEST_FP_OP_S_INTERNAL( testnum, 0, float result, val1, 0.0, 0.0, \ fcvt.d.s f3, f0; fcvt.s.d f3, f3; fmv.x.s a0, f3) -#define TEST_FP_OP1_S( testnum, inst, result, val1 ) \ - TEST_FP_OP_S_INTERNAL( testnum, 0, float result, val1, 0.0, 0.0, \ +#define TEST_FP_OP1_S( testnum, inst, flags, result, val1 ) \ + TEST_FP_OP_S_INTERNAL( testnum, flags, float result, val1, 0.0, 0.0, \ inst f3, f0; fmv.x.s a0, f3) -#define TEST_FP_OP1_D( testnum, inst, result, val1 ) \ - TEST_FP_OP_D_INTERNAL( testnum, 0, double result, val1, 0.0, 0.0, \ +#define TEST_FP_OP1_D( testnum, inst, flags, result, val1 ) \ + TEST_FP_OP_D_INTERNAL( testnum, flags, double result, val1, 0.0, 0.0, \ inst f3, f0; fmv.x.d a0, f3) #define TEST_FP_OP2_S( testnum, inst, flags, result, val1, val2 ) \ diff --git a/isa/rv64uf/Makefrag b/isa/rv64uf/Makefrag index f9ed202..c29d4f4 100644 --- a/isa/rv64uf/Makefrag +++ b/isa/rv64uf/Makefrag @@ -3,7 +3,7 @@ #----------------------------------------------------------------------- rv64uf_sc_tests = \ - fadd fclass fcmp fcvt fcvt_w fmadd fmin fsgnj \ + fadd fdiv fclass fcmp fcvt fcvt_w fmadd fmin fsgnj \ ldst move structural \ rv64uf_sc_vec_tests = \ diff --git a/isa/rv64uf/fdiv.S b/isa/rv64uf/fdiv.S new file mode 100644 index 0000000..b445663 --- /dev/null +++ b/isa/rv64uf/fdiv.S @@ -0,0 +1,43 @@ +# See LICENSE for license details. + +#***************************************************************************** +# fdiv.S +#----------------------------------------------------------------------------- +# +# Test f{div|sqrt}.{s|d} instructions. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64UF +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_FP_OP2_S( 2, fdiv.s, 1, 1.1557273520668288, 3.14159265, 2.71828182 ); + TEST_FP_OP2_S( 3, fdiv.s, 1,-0.9991093838555584, -1234, 1235.1 ); + TEST_FP_OP2_S( 4, fdiv.s, 0, 3.14159265, 3.14159265, 1.0 ); + + TEST_FP_OP2_D( 5, fdiv.d, 1, 1.1557273520668288, 3.14159265, 2.71828182 ); + TEST_FP_OP2_D( 6, fdiv.d, 1,-0.9991093838555584, -1234, 1235.1 ); + TEST_FP_OP2_D( 7, fdiv.d, 0, 3.14159265, 3.14159265, 1.0 ); + + TEST_FP_OP1_S(11, fsqrt.s, 1, 1.7724538498928541, 3.14159265 ); + TEST_FP_OP1_S(12, fsqrt.s, 0, 100, 10000 ); + + TEST_FP_OP1_D(13, fsqrt.d, 1, 1.7724538498928541, 3.14159265 ); + TEST_FP_OP1_D(14, fsqrt.d, 0, 100, 10000 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END -- 2.30.2