Skip to content

Commit

Permalink
rv64zfhmin:add zfhmin extension tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zmx2018 committed Aug 26, 2024
1 parent dc96ba0 commit b9e68c9
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 6 deletions.
2 changes: 2 additions & 0 deletions isa/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ include $(src_dir)/rv64ua/Makefrag
include $(src_dir)/rv64uf/Makefrag
include $(src_dir)/rv64ud/Makefrag
include $(src_dir)/rv64uzfh/Makefrag
include $(src_dir)/rv64uzfhmin/Makefrag
include $(src_dir)/rv64si/Makefrag
include $(src_dir)/rv64ssvnapot/Makefrag
include $(src_dir)/rv64mi/Makefrag
Expand Down Expand Up @@ -146,6 +147,7 @@ $(foreach s, $(SUITES), $(eval $(call compile_template,$(s),-march=rv64g -mabi=l
$(eval $(call compile_template,rv32uzfh,-march=rv32g_zfh -mabi=ilp32))
ifeq ($(XLEN),64)
$(eval $(call compile_template,rv64uzfh,-march=rv64g_zfh -mabi=lp64))
$(eval $(call compile_template,rv64uzfhmin,-march=rv64g_zfh -mabi=lp64))
$(eval $(call compile_template,rv64mzicbo,-march=rv64g_zicboz -mabi=lp64))
$(eval $(call compile_template,rv64ssvnapot,-march=rv64g -mabi=lp64))
endif
Expand Down
8 changes: 4 additions & 4 deletions isa/macros/scalar/test_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -491,12 +491,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_FCVT_H_S( testnum, result, val1 ) \
TEST_FP_OP_H_INTERNAL( testnum, 0, float16 result, val1, 0.0, 0.0, \
#define TEST_FCVT_H_S( testnum, result, val1, flag ) \
TEST_FP_OP_H_INTERNAL( testnum, flag, float16 result, val1, 0.0, 0.0, \
fcvt.s.h f3, f0; fcvt.h.s f3, f3; fmv.x.h a0, f3)

#define TEST_FCVT_H_D( testnum, result, val1 ) \
TEST_FP_OP_H_INTERNAL( testnum, 0, float16 result, val1, 0.0, 0.0, \
#define TEST_FCVT_H_D( testnum, result, val1, flag ) \
TEST_FP_OP_H_INTERNAL( testnum, flag, float16 result, val1, 0.0, 0.0, \
fcvt.d.h f3, f0; fcvt.h.d f3, f3; fmv.x.h a0, f3)


Expand Down
4 changes: 2 additions & 2 deletions isa/rv64uzfh/fcvt.S
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ RVTEST_CODE_BEGIN
TEST_INT_FP_OP_H( 9, fcvt.h.lu, 0h:7c00, -2);
#endif

TEST_FCVT_H_S( 10, -1.5, -1.5)
TEST_FCVT_H_S( 10, -1.5, -1.5, 0)

#if __riscv_xlen >= 64
TEST_FCVT_H_D( 11, -1.5, -1.5)
TEST_FCVT_H_D( 11, -1.5, -1.5, 0)
#endif

TEST_PASSFAIL
Expand Down
8 changes: 8 additions & 0 deletions isa/rv64uzfhmin/Makefrag
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#=======================================================================
# Makefrag for rv64uzfhmin tests
#-----------------------------------------------------------------------

rv64uzfhmin_sc_tests = fzfhmincvt

rv64uzfhmin_p_tests = $(addprefix rv64uzfhmin-p-, $(rv64uzfhmin_sc_tests))
rv64uzfhmin_v_tests = $(addprefix rv64uzfhmin-v-, $(rv64uzfhmin_sc_tests))
54 changes: 54 additions & 0 deletions isa/rv64uzfhmin/fzfhmincvt.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# See LICENSE for license details.

#*****************************************************************************
# fzfhmincvt.S
#-----------------------------------------------------------------------------
#
# Test fcvt.h.s, fcvt.s.h, fcvt.h.d, and fcvt.d.h instructions.
#

#include "riscv_test.h"
#include "test_macros.h"

RVTEST_RV64UF
RVTEST_CODE_BEGIN

#-------------------------------------------------------------
# Arithmetic tests
#-------------------------------------------------------------

TEST_FCVT_H_S( 10, -0, -0, 0)
TEST_FCVT_H_S( 11, 0, 0, 0)
TEST_FCVT_H_S( 12, -100.5, -100.5, 0)
TEST_FCVT_H_S( 13, 125.5, 125.5, 0)
TEST_FCVT_H_S( 14, 65504.0, 65504.0, 0)
TEST_FCVT_H_S( 15, +inf, +inf, 0)
TEST_FCVT_H_S( 16, -inf, -inf, 0)
TEST_FCVT_H_S( 17, 0.0000000003, 0.0000000003, 0)
TEST_FCVT_H_S( 18, qNaNh, qNaNh, 0)
TEST_FCVT_H_S( 19, qNaNh, sNaNh, 0x10)


#if __riscv_xlen >= 64
TEST_FCVT_H_D( 20, -0, -0, 0)
TEST_FCVT_H_D( 21, 0, 0, 0)
TEST_FCVT_H_D( 22, -100.5, -100.5, 0)
TEST_FCVT_H_D( 23, 125.5, 125.5, 0)
TEST_FCVT_H_D( 24, 65504.0, 65504.0, 0)
TEST_FCVT_H_D( 25, +inf, +inf, 0)
TEST_FCVT_H_D( 26, -inf, -inf, 0)
TEST_FCVT_H_D( 27, 0.0000000003, 0.0000000003, 0)
TEST_FCVT_H_D( 28, qNaNh, qNaNh, 0)
TEST_FCVT_H_D( 29, qNaNh, sNaNh, 0x10)
#endif

TEST_PASSFAIL

RVTEST_CODE_END

.data
RVTEST_DATA_BEGIN

TEST_DATA

RVTEST_DATA_END

0 comments on commit b9e68c9

Please sign in to comment.