From: Andrew Waterman Date: Tue, 18 Mar 2014 23:38:57 +0000 (-0700) Subject: Check FP corner cases and flags X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7e1460032cf6f522ce4bc7e8a347c1f08a4476d2;p=riscv-tests.git Check FP corner cases and flags --- diff --git a/isa/macros/scalar/test_macros.h b/isa/macros/scalar/test_macros.h index dca9a92..5250a19 100644 --- a/isa/macros/scalar/test_macros.h +++ b/isa/macros/scalar/test_macros.h @@ -443,7 +443,7 @@ test_ ## testnum: \ # Tests floating-point instructions #----------------------------------------------------------------------- -#define TEST_FP_OP_S_INTERNAL( testnum, result, val1, val2, val3, code... ) \ +#define TEST_FP_OP_S_INTERNAL( testnum, flags, result, val1, val2, val3, code... ) \ test_ ## testnum: \ li TESTNUM, testnum; \ la a0, test_ ## testnum ## _data ;\ @@ -452,17 +452,22 @@ test_ ## testnum: \ flw f2, 8(a0); \ lw a3, 12(a0); \ code; \ + fsflags a1, x0; \ + li a2, flags; \ bne a0, a3, fail; \ - b 1f; \ + bne a1, a2, fail; \ + j 2f; \ .align 2; \ + .data; \ test_ ## testnum ## _data: \ .float val1; \ .float val2; \ .float val3; \ .result; \ -1: + .text; \ +2: -#define TEST_FP_OP_D_INTERNAL( testnum, result, val1, val2, val3, code... ) \ +#define TEST_FP_OP_D_INTERNAL( testnum, flags, result, val1, val2, val3, code... ) \ test_ ## testnum: \ li TESTNUM, testnum; \ la a0, test_ ## testnum ## _data ;\ @@ -471,62 +476,67 @@ test_ ## testnum: \ fld f2, 16(a0); \ ld a3, 24(a0); \ code; \ + fsflags a1, x0; \ + li a2, flags; \ bne a0, a3, fail; \ - b 1f; \ + bne a1, a2, fail; \ + j 2f; \ + .data; \ .align 3; \ test_ ## testnum ## _data: \ .double val1; \ .double val2; \ .double val3; \ .result; \ -1: + .text; \ +2: #define TEST_FCVT_S_D( testnum, result, val1 ) \ - TEST_FP_OP_D_INTERNAL( testnum, double result, val1, 0.0, 0.0, \ + TEST_FP_OP_D_INTERNAL( testnum, 0, double result, val1, 0.0, 0.0, \ fcvt.s.d f3, f0; fcvt.d.s f3, f3; fmv.x.d a0, f3) #define TEST_FCVT_D_S( testnum, result, val1 ) \ - TEST_FP_OP_S_INTERNAL( testnum, float result, val1, 0.0, 0.0, \ + 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, float result, val1, 0.0, 0.0, \ + TEST_FP_OP_S_INTERNAL( testnum, 0, 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, double result, val1, 0.0, 0.0, \ + TEST_FP_OP_D_INTERNAL( testnum, 0, double result, val1, 0.0, 0.0, \ inst f3, f0; fmv.x.d a0, f3) -#define TEST_FP_OP2_S( testnum, inst, result, val1, val2 ) \ - TEST_FP_OP_S_INTERNAL( testnum, float result, val1, val2, 0.0, \ +#define TEST_FP_OP2_S( testnum, inst, flags, result, val1, val2 ) \ + TEST_FP_OP_S_INTERNAL( testnum, flags, float result, val1, val2, 0.0, \ inst f3, f0, f1; fmv.x.s a0, f3) -#define TEST_FP_OP2_D( testnum, inst, result, val1, val2 ) \ - TEST_FP_OP_D_INTERNAL( testnum, double result, val1, val2, 0.0, \ +#define TEST_FP_OP2_D( testnum, inst, flags, result, val1, val2 ) \ + TEST_FP_OP_D_INTERNAL( testnum, flags, double result, val1, val2, 0.0, \ inst f3, f0, f1; fmv.x.d a0, f3) -#define TEST_FP_OP3_S( testnum, inst, result, val1, val2, val3 ) \ - TEST_FP_OP_S_INTERNAL( testnum, float result, val1, val2, val3, \ +#define TEST_FP_OP3_S( testnum, inst, flags, result, val1, val2, val3 ) \ + TEST_FP_OP_S_INTERNAL( testnum, flags, float result, val1, val2, val3, \ inst f3, f0, f1, f2; fmv.x.s a0, f3) -#define TEST_FP_OP3_D( testnum, inst, result, val1, val2, val3 ) \ - TEST_FP_OP_D_INTERNAL( testnum, double result, val1, val2, val3, \ +#define TEST_FP_OP3_D( testnum, inst, flags, result, val1, val2, val3 ) \ + TEST_FP_OP_D_INTERNAL( testnum, flags, double result, val1, val2, val3, \ inst f3, f0, f1, f2; fmv.x.d a0, f3) -#define TEST_FP_INT_OP_S( testnum, inst, result, val1, rm ) \ - TEST_FP_OP_S_INTERNAL( testnum, word result, val1, 0.0, 0.0, \ +#define TEST_FP_INT_OP_S( testnum, inst, flags, result, val1, rm ) \ + TEST_FP_OP_S_INTERNAL( testnum, flags, word result, val1, 0.0, 0.0, \ inst a0, f0, rm) -#define TEST_FP_INT_OP_D( testnum, inst, result, val1, rm ) \ - TEST_FP_OP_D_INTERNAL( testnum, dword result, val1, 0.0, 0.0, \ +#define TEST_FP_INT_OP_D( testnum, inst, flags, result, val1, rm ) \ + TEST_FP_OP_D_INTERNAL( testnum, flags, dword result, val1, 0.0, 0.0, \ inst a0, f0, rm) #define TEST_FP_CMP_OP_S( testnum, inst, result, val1, val2 ) \ - TEST_FP_OP_S_INTERNAL( testnum, word result, val1, val2, 0.0, \ + TEST_FP_OP_S_INTERNAL( testnum, 0, word result, val1, val2, 0.0, \ inst a0, f0, f1) #define TEST_FP_CMP_OP_D( testnum, inst, result, val1, val2 ) \ - TEST_FP_OP_D_INTERNAL( testnum, dword result, val1, val2, 0.0, \ + TEST_FP_OP_D_INTERNAL( testnum, 0, dword result, val1, val2, 0.0, \ inst a0, f0, f1) #define TEST_INT_FP_OP_S( testnum, inst, result, val1 ) \ @@ -536,6 +546,7 @@ test_ ## testnum: \ lw a3, 0(a0); \ li a0, val1; \ inst f0, a0; \ + fsflags x0; \ fmv.x.s a0, f0; \ bne a0, a3, fail; \ b 1f; \ @@ -551,6 +562,7 @@ test_ ## testnum: \ ld a3, 0(a0); \ li a0, val1; \ inst f0, a0; \ + fsflags x0; \ fmv.x.d a0, f0; \ bne a0, a3, fail; \ b 1f; \ diff --git a/isa/macros/vector/test_macros.h b/isa/macros/vector/test_macros.h index 5a8f0a1..f5dd276 100644 --- a/isa/macros/vector/test_macros.h +++ b/isa/macros/vector/test_macros.h @@ -307,27 +307,27 @@ vtcode ## testnum : \ TEST_FP_OP_S_INTERNAL_NREG( testnum, 2, 4, float result, val1, 0.0, 0.0, \ fcvt.d.s f3, f0; fcvt.s.d f3, f3; fmv.x.s x1, f3) -#define TEST_FP_OP2_S( testnum, inst, result, val1, val2 ) \ +#define TEST_FP_OP2_S( testnum, inst, flags, result, val1, val2 ) \ TEST_FP_OP_S_INTERNAL_NREG( testnum, 2, 4, float result, val1, val2, 0.0, \ inst f3, f0, f1; fmv.x.s x1, f3) -#define TEST_FP_OP2_D( testnum, inst, result, val1, val2 ) \ +#define TEST_FP_OP2_D( testnum, inst, flags, result, val1, val2 ) \ TEST_FP_OP_D_INTERNAL_NREG( testnum, 2, 4, double result, val1, val2, 0.0, \ inst f3, f0, f1; fmv.x.d x1, f3) -#define TEST_FP_OP3_S( testnum, inst, result, val1, val2, val3 ) \ +#define TEST_FP_OP3_S( testnum, inst, flags, result, val1, val2, val3 ) \ TEST_FP_OP_S_INTERNAL_NREG( testnum, 2, 4, float result, val1, val2, val3, \ inst f3, f0, f1, f2; fmv.x.s x1, f3) -#define TEST_FP_OP3_D( testnum, inst, result, val1, val2, val3 ) \ +#define TEST_FP_OP3_D( testnum, inst, flags, result, val1, val2, val3 ) \ TEST_FP_OP_D_INTERNAL_NREG( testnum, 2, 4, double result, val1, val2, val3, \ inst f3, f0, f1, f2; fmv.x.d x1, f3) -#define TEST_FP_INT_OP_S( testnum, inst, result, val1, rm ) \ +#define TEST_FP_INT_OP_S( testnum, inst, flags, result, val1, rm ) \ TEST_FP_OP_S_INTERNAL_NREG( testnum, 2, 4, word result, val1, 0.0, 0.0, \ inst x1, f0, rm) -#define TEST_FP_INT_OP_D( testnum, inst, result, val1, rm ) \ +#define TEST_FP_INT_OP_D( testnum, inst, flags, result, val1, rm ) \ TEST_FP_OP_D_INTERNAL_NREG( testnum, 2, 4, dword result, val1, 0.0, 0.0, \ inst x1, f0, rm) diff --git a/isa/rv64uf/fadd.S b/isa/rv64uf/fadd.S index cced11b..f99b21b 100644 --- a/isa/rv64uf/fadd.S +++ b/isa/rv64uf/fadd.S @@ -15,29 +15,29 @@ RVTEST_CODE_BEGIN # Arithmetic tests #------------------------------------------------------------- - TEST_FP_OP2_S( 2, fadd.s, 3.5, 2.5, 1.0 ); - TEST_FP_OP2_S( 3, fadd.s, -1234, -1235.1, 1.1 ); - TEST_FP_OP2_S( 4, fadd.s, 3.14159265, 3.14159265, 0.00000001 ); + TEST_FP_OP2_S( 2, fadd.s, 0, 3.5, 2.5, 1.0 ); + TEST_FP_OP2_S( 3, fadd.s, 1, -1234, -1235.1, 1.1 ); + TEST_FP_OP2_S( 4, fadd.s, 1, 3.14159265, 3.14159265, 0.00000001 ); - TEST_FP_OP2_D( 5, fadd.d, 3.5, 2.5, 1.0 ); - TEST_FP_OP2_D( 6, fadd.d, -1234, -1235.1, 1.1 ); - TEST_FP_OP2_D( 7, fadd.d, 3.14159266, 3.14159265, 0.00000001 ); + TEST_FP_OP2_D( 5, fadd.d, 0, 3.5, 2.5, 1.0 ); + TEST_FP_OP2_D( 6, fadd.d, 1, -1234, -1235.1, 1.1 ); + TEST_FP_OP2_D( 7, fadd.d, 1, 3.14159266, 3.14159265, 0.00000001 ); - TEST_FP_OP2_S(12, fsub.s, 1.5, 2.5, 1.0 ); - TEST_FP_OP2_S(13, fsub.s, -1234, -1235.1, -1.1 ); - TEST_FP_OP2_S(14, fsub.s, 3.14159265, 3.14159265, 0.00000001 ); + TEST_FP_OP2_S(12, fsub.s, 0, 1.5, 2.5, 1.0 ); + TEST_FP_OP2_S(13, fsub.s, 1, -1234, -1235.1, -1.1 ); + TEST_FP_OP2_S(14, fsub.s, 1, 3.14159265, 3.14159265, 0.00000001 ); - TEST_FP_OP2_D(15, fsub.d, 1.5, 2.5, 1.0 ); - TEST_FP_OP2_D(16, fsub.d, -1234, -1235.1, -1.1 ); - TEST_FP_OP2_D(17, fsub.d, 3.1415926400000001, 3.14159265, 0.00000001 ); + TEST_FP_OP2_D(15, fsub.d, 0, 1.5, 2.5, 1.0 ); + TEST_FP_OP2_D(16, fsub.d, 1, -1234, -1235.1, -1.1 ); + TEST_FP_OP2_D(17, fsub.d, 1, 3.1415926400000001, 3.14159265, 0.00000001 ); - TEST_FP_OP2_S(22, fmul.s, 2.5, 2.5, 1.0 ); - TEST_FP_OP2_S(23, fmul.s, 1358.61, -1235.1, -1.1 ); - TEST_FP_OP2_S(24, fmul.s, 3.14159265e-8, 3.14159265, 0.00000001 ); + TEST_FP_OP2_S(22, fmul.s, 0, 2.5, 2.5, 1.0 ); + TEST_FP_OP2_S(23, fmul.s, 1, 1358.61, -1235.1, -1.1 ); + TEST_FP_OP2_S(24, fmul.s, 1, 3.14159265e-8, 3.14159265, 0.00000001 ); - TEST_FP_OP2_D(25, fmul.d, 2.5, 2.5, 1.0 ); - TEST_FP_OP2_D(26, fmul.d, 1358.61, -1235.1, -1.1 ); - TEST_FP_OP2_D(27, fmul.d, 3.14159265e-8, 3.14159265, 0.00000001 ); + TEST_FP_OP2_D(25, fmul.d, 0, 2.5, 2.5, 1.0 ); + TEST_FP_OP2_D(26, fmul.d, 1, 1358.61, -1235.1, -1.1 ); + TEST_FP_OP2_D(27, fmul.d, 1, 3.14159265e-8, 3.14159265, 0.00000001 ); TEST_PASSFAIL diff --git a/isa/rv64uf/fcvt_w.S b/isa/rv64uf/fcvt_w.S index 5492a09..e856c2a 100644 --- a/isa/rv64uf/fcvt_w.S +++ b/isa/rv64uf/fcvt_w.S @@ -15,61 +15,76 @@ RVTEST_CODE_BEGIN # Arithmetic tests #------------------------------------------------------------- - TEST_FP_INT_OP_S( 2, fcvt.w.s, -1, -1.1, rtz); - TEST_FP_INT_OP_S( 3, fcvt.w.s, -1, -1.0, rtz); - TEST_FP_INT_OP_S( 4, fcvt.w.s, 0, -0.9, rtz); - TEST_FP_INT_OP_S( 5, fcvt.w.s, 0, 0.9, rtz); - TEST_FP_INT_OP_S( 6, fcvt.w.s, 1, 1.0, rtz); - TEST_FP_INT_OP_S( 7, fcvt.w.s, 1, 1.1, rtz); - - TEST_FP_INT_OP_S(12, fcvt.wu.s, -1, -3.0, rtz); # invalid - TEST_FP_INT_OP_S(13, fcvt.wu.s, -1, -1.0, rtz); # invalid - TEST_FP_INT_OP_S(14, fcvt.wu.s, 0, -0.9, rtz); - TEST_FP_INT_OP_S(15, fcvt.wu.s, 0, 0.9, rtz); - TEST_FP_INT_OP_S(16, fcvt.wu.s, 1, 1.0, rtz); - TEST_FP_INT_OP_S(17, fcvt.wu.s, 1, 1.1, rtz); - - TEST_FP_INT_OP_S(22, fcvt.l.s, -1, -1.1, rtz); - TEST_FP_INT_OP_S(23, fcvt.l.s, -1, -1.0, rtz); - TEST_FP_INT_OP_S(24, fcvt.l.s, 0, -0.9, rtz); - TEST_FP_INT_OP_S(25, fcvt.l.s, 0, 0.9, rtz); - TEST_FP_INT_OP_S(26, fcvt.l.s, 1, 1.0, rtz); - TEST_FP_INT_OP_S(27, fcvt.l.s, 1, 1.1, rtz); - - TEST_FP_INT_OP_S(32, fcvt.lu.s, -1, -3.0, rtz); # invalid - TEST_FP_INT_OP_S(33, fcvt.lu.s, -1, -1.0, rtz); # invalid - TEST_FP_INT_OP_S(34, fcvt.lu.s, 0, -0.9, rtz); - TEST_FP_INT_OP_S(35, fcvt.lu.s, 0, 0.9, rtz); - TEST_FP_INT_OP_S(36, fcvt.lu.s, 1, 1.0, rtz); - TEST_FP_INT_OP_S(37, fcvt.lu.s, 1, 1.1, rtz); - - TEST_FP_INT_OP_D(42, fcvt.w.d, -1, -1.1, rtz); - TEST_FP_INT_OP_D(43, fcvt.w.d, -1, -1.0, rtz); - TEST_FP_INT_OP_D(44, fcvt.w.d, 0, -0.9, rtz); - TEST_FP_INT_OP_D(45, fcvt.w.d, 0, 0.9, rtz); - TEST_FP_INT_OP_D(46, fcvt.w.d, 1, 1.0, rtz); - TEST_FP_INT_OP_D(47, fcvt.w.d, 1, 1.1, rtz); - - TEST_FP_INT_OP_D(52, fcvt.wu.d, -1, -3.0, rtz); # invalid - TEST_FP_INT_OP_D(53, fcvt.wu.d, -1, -1.0, rtz); # invalid - TEST_FP_INT_OP_D(54, fcvt.wu.d, 0, -0.9, rtz); - TEST_FP_INT_OP_D(55, fcvt.wu.d, 0, 0.9, rtz); - TEST_FP_INT_OP_D(56, fcvt.wu.d, 1, 1.0, rtz); - TEST_FP_INT_OP_D(57, fcvt.wu.d, 1, 1.1, rtz); - - TEST_FP_INT_OP_D(62, fcvt.l.d, -1, -1.1, rtz); - TEST_FP_INT_OP_D(63, fcvt.l.d, -1, -1.0, rtz); - TEST_FP_INT_OP_D(64, fcvt.l.d, 0, -0.9, rtz); - TEST_FP_INT_OP_D(65, fcvt.l.d, 0, 0.9, rtz); - TEST_FP_INT_OP_D(66, fcvt.l.d, 1, 1.0, rtz); - TEST_FP_INT_OP_D(67, fcvt.l.d, 1, 1.1, rtz); - - TEST_FP_INT_OP_D(72, fcvt.lu.d, -1, -3.0, rtz); # invalid - TEST_FP_INT_OP_D(73, fcvt.lu.d, -1, -1.0, rtz); # invalid - TEST_FP_INT_OP_D(74, fcvt.lu.d, 0, -0.9, rtz); - TEST_FP_INT_OP_D(75, fcvt.lu.d, 0, 0.9, rtz); - TEST_FP_INT_OP_D(76, fcvt.lu.d, 1, 1.0, rtz); - TEST_FP_INT_OP_D(77, fcvt.lu.d, 1, 1.1, rtz); + TEST_FP_INT_OP_S( 2, fcvt.w.s, 0x01, -1, -1.1, rtz); + TEST_FP_INT_OP_S( 3, fcvt.w.s, 0x00, -1, -1.0, rtz); + TEST_FP_INT_OP_S( 4, fcvt.w.s, 0x01, 0, -0.9, rtz); + TEST_FP_INT_OP_S( 5, fcvt.w.s, 0x01, 0, 0.9, rtz); + TEST_FP_INT_OP_S( 6, fcvt.w.s, 0x00, 1, 1.0, rtz); + TEST_FP_INT_OP_S( 7, fcvt.w.s, 0x01, 1, 1.1, rtz); + TEST_FP_INT_OP_S( 8, fcvt.w.s, 0x10, -1<<31, -3e9, rtz); + TEST_FP_INT_OP_S( 9, fcvt.w.s, 0x10, (1<<31)-1, 3e9, rtz); + + TEST_FP_INT_OP_S(12, fcvt.wu.s, 0x10, -1, -3.0, rtz); + TEST_FP_INT_OP_S(13, fcvt.wu.s, 0x10, -1, -1.0, rtz); + TEST_FP_INT_OP_S(14, fcvt.wu.s, 0x01, 0, -0.9, rtz); + TEST_FP_INT_OP_S(15, fcvt.wu.s, 0x01, 0, 0.9, rtz); + TEST_FP_INT_OP_S(16, fcvt.wu.s, 0x00, 1, 1.0, rtz); + TEST_FP_INT_OP_S(17, fcvt.wu.s, 0x01, 1, 1.1, rtz); + TEST_FP_INT_OP_S(18, fcvt.wu.s, 0x10, -1, -3e9, rtz); + TEST_FP_INT_OP_S(19, fcvt.wu.s, 0x00, 3000000000, 3e9, rtz); + + TEST_FP_INT_OP_S(22, fcvt.l.s, 0x01, -1, -1.1, rtz); + TEST_FP_INT_OP_S(23, fcvt.l.s, 0x00, -1, -1.0, rtz); + TEST_FP_INT_OP_S(24, fcvt.l.s, 0x01, 0, -0.9, rtz); + TEST_FP_INT_OP_S(25, fcvt.l.s, 0x01, 0, 0.9, rtz); + TEST_FP_INT_OP_S(26, fcvt.l.s, 0x00, 1, 1.0, rtz); + TEST_FP_INT_OP_S(27, fcvt.l.s, 0x01, 1, 1.1, rtz); + + TEST_FP_INT_OP_S(32, fcvt.lu.s, 0x10, -1, -3.0, rtz); + TEST_FP_INT_OP_S(33, fcvt.lu.s, 0x10, -1, -1.0, rtz); + TEST_FP_INT_OP_S(34, fcvt.lu.s, 0x01, 0, -0.9, rtz); + TEST_FP_INT_OP_S(35, fcvt.lu.s, 0x01, 0, 0.9, rtz); + TEST_FP_INT_OP_S(36, fcvt.lu.s, 0x00, 1, 1.0, rtz); + TEST_FP_INT_OP_S(37, fcvt.lu.s, 0x01, 1, 1.1, rtz); + TEST_FP_INT_OP_S(38, fcvt.lu.s, 0x10, -1, -3e9, rtz); + + TEST_FP_INT_OP_D(42, fcvt.w.d, 0x01, -1, -1.1, rtz); + TEST_FP_INT_OP_D(43, fcvt.w.d, 0x00, -1, -1.0, rtz); + TEST_FP_INT_OP_D(44, fcvt.w.d, 0x01, 0, -0.9, rtz); + TEST_FP_INT_OP_D(45, fcvt.w.d, 0x01, 0, 0.9, rtz); + TEST_FP_INT_OP_D(46, fcvt.w.d, 0x00, 1, 1.0, rtz); + TEST_FP_INT_OP_D(47, fcvt.w.d, 0x01, 1, 1.1, rtz); + TEST_FP_INT_OP_D(48, fcvt.w.d, 0x10, -1<<31, -3e9, rtz); + TEST_FP_INT_OP_D(49, fcvt.w.d, 0x10, (1<<31)-1, 3e9, rtz); + + TEST_FP_INT_OP_D(52, fcvt.wu.d, 0x10, -1, -3.0, rtz); + TEST_FP_INT_OP_D(53, fcvt.wu.d, 0x10, -1, -1.0, rtz); + TEST_FP_INT_OP_D(54, fcvt.wu.d, 0x01, 0, -0.9, rtz); + TEST_FP_INT_OP_D(55, fcvt.wu.d, 0x01, 0, 0.9, rtz); + TEST_FP_INT_OP_D(56, fcvt.wu.d, 0x00, 1, 1.0, rtz); + TEST_FP_INT_OP_D(57, fcvt.wu.d, 0x01, 1, 1.1, rtz); + TEST_FP_INT_OP_D(58, fcvt.wu.d, 0x10, -1, -3e9, rtz); + TEST_FP_INT_OP_D(59, fcvt.wu.d, 0x00, 0xffffffffb2d05e00, 3e9, rtz); + + TEST_FP_INT_OP_D(62, fcvt.l.d, 0x01, -1, -1.1, rtz); + TEST_FP_INT_OP_D(63, fcvt.l.d, 0x00, -1, -1.0, rtz); + TEST_FP_INT_OP_D(64, fcvt.l.d, 0x01, 0, -0.9, rtz); + TEST_FP_INT_OP_D(65, fcvt.l.d, 0x01, 0, 0.9, rtz); + TEST_FP_INT_OP_D(66, fcvt.l.d, 0x00, 1, 1.0, rtz); + TEST_FP_INT_OP_D(67, fcvt.l.d, 0x01, 1, 1.1, rtz); + TEST_FP_INT_OP_D(68, fcvt.l.d, 0x00,-3000000000, -3e9, rtz); + TEST_FP_INT_OP_D(69, fcvt.l.d, 0x00, 3000000000, 3e9, rtz); + TEST_FP_INT_OP_D(60, fcvt.l.d, 0x10, -1<<63,-3e19, rtz); + TEST_FP_INT_OP_D(61, fcvt.l.d, 0x10, (1<<63)-1, 3e19, rtz); + + TEST_FP_INT_OP_D(72, fcvt.lu.d, 0x10, -1, -3.0, rtz); + TEST_FP_INT_OP_D(73, fcvt.lu.d, 0x10, -1, -1.0, rtz); + TEST_FP_INT_OP_D(74, fcvt.lu.d, 0x01, 0, -0.9, rtz); + TEST_FP_INT_OP_D(75, fcvt.lu.d, 0x01, 0, 0.9, rtz); + TEST_FP_INT_OP_D(76, fcvt.lu.d, 0x00, 1, 1.0, rtz); + TEST_FP_INT_OP_D(77, fcvt.lu.d, 0x01, 1, 1.1, rtz); + TEST_FP_INT_OP_D(78, fcvt.lu.d, 0x10, -1, -3e9, rtz); + TEST_FP_INT_OP_D(79, fcvt.lu.d, 0x00, 3000000000, 3e9, rtz); TEST_PASSFAIL diff --git a/isa/rv64uf/fmadd.S b/isa/rv64uf/fmadd.S index dc16ecb..fdc501d 100644 --- a/isa/rv64uf/fmadd.S +++ b/isa/rv64uf/fmadd.S @@ -15,37 +15,37 @@ RVTEST_CODE_BEGIN # Arithmetic tests #------------------------------------------------------------- - TEST_FP_OP3_S( 2, fmadd.s, 3.5, 1.0, 2.5, 1.0 ); - TEST_FP_OP3_S( 3, fmadd.s, 1236.2, -1.0, -1235.1, 1.1 ); - TEST_FP_OP3_S( 4, fmadd.s, -12.0, 2.0, -5.0, -2.0 ); + TEST_FP_OP3_S( 2, fmadd.s, 0, 3.5, 1.0, 2.5, 1.0 ); + TEST_FP_OP3_S( 3, fmadd.s, 1, 1236.2, -1.0, -1235.1, 1.1 ); + TEST_FP_OP3_S( 4, fmadd.s, 0, -12.0, 2.0, -5.0, -2.0 ); - TEST_FP_OP3_D( 5, fmadd.d, 3.5, 1.0, 2.5, 1.0 ); - TEST_FP_OP3_D( 6, fmadd.d, 1236.1999999999999, -1.0, -1235.1, 1.1 ); - TEST_FP_OP3_D( 7, fmadd.d, -12.0, 2.0, -5.0, -2.0 ); + TEST_FP_OP3_D( 5, fmadd.d, 0, 3.5, 1.0, 2.5, 1.0 ); + TEST_FP_OP3_D( 6, fmadd.d, 1, 1236.1999999999999, -1.0, -1235.1, 1.1 ); + TEST_FP_OP3_D( 7, fmadd.d, 0, -12.0, 2.0, -5.0, -2.0 ); - TEST_FP_OP3_S( 8, fnmadd.s, -3.5, 1.0, 2.5, 1.0 ); - TEST_FP_OP3_S( 9, fnmadd.s, -1236.2, -1.0, -1235.1, 1.1 ); - TEST_FP_OP3_S(10, fnmadd.s, 12.0, 2.0, -5.0, -2.0 ); + TEST_FP_OP3_S( 8, fnmadd.s, 0, -3.5, 1.0, 2.5, 1.0 ); + TEST_FP_OP3_S( 9, fnmadd.s, 1, -1236.2, -1.0, -1235.1, 1.1 ); + TEST_FP_OP3_S(10, fnmadd.s, 0, 12.0, 2.0, -5.0, -2.0 ); - TEST_FP_OP3_D(11, fnmadd.d, -3.5, 1.0, 2.5, 1.0 ); - TEST_FP_OP3_D(12, fnmadd.d, -1236.1999999999999, -1.0, -1235.1, 1.1 ); - TEST_FP_OP3_D(13, fnmadd.d, 12.0, 2.0, -5.0, -2.0 ); + TEST_FP_OP3_D(11, fnmadd.d, 0, -3.5, 1.0, 2.5, 1.0 ); + TEST_FP_OP3_D(12, fnmadd.d, 1, -1236.1999999999999, -1.0, -1235.1, 1.1 ); + TEST_FP_OP3_D(13, fnmadd.d, 0, 12.0, 2.0, -5.0, -2.0 ); - TEST_FP_OP3_S(14, fmsub.s, 1.5, 1.0, 2.5, 1.0 ); - TEST_FP_OP3_S(15, fmsub.s, 1234, -1.0, -1235.1, 1.1 ); - TEST_FP_OP3_S(16, fmsub.s, -8.0, 2.0, -5.0, -2.0 ); + TEST_FP_OP3_S(14, fmsub.s, 0, 1.5, 1.0, 2.5, 1.0 ); + TEST_FP_OP3_S(15, fmsub.s, 1, 1234, -1.0, -1235.1, 1.1 ); + TEST_FP_OP3_S(16, fmsub.s, 0, -8.0, 2.0, -5.0, -2.0 ); - TEST_FP_OP3_D(17, fmsub.d, 1.5, 1.0, 2.5, 1.0 ); - TEST_FP_OP3_D(18, fmsub.d, 1234, -1.0, -1235.1, 1.1 ); - TEST_FP_OP3_D(19, fmsub.d, -8.0, 2.0, -5.0, -2.0 ); + TEST_FP_OP3_D(17, fmsub.d, 0, 1.5, 1.0, 2.5, 1.0 ); + TEST_FP_OP3_D(18, fmsub.d, 1, 1234, -1.0, -1235.1, 1.1 ); + TEST_FP_OP3_D(19, fmsub.d, 0, -8.0, 2.0, -5.0, -2.0 ); - TEST_FP_OP3_S(20, fnmsub.s, -1.5, 1.0, 2.5, 1.0 ); - TEST_FP_OP3_S(21, fnmsub.s, -1234, -1.0, -1235.1, 1.1 ); - TEST_FP_OP3_S(22, fnmsub.s, 8.0, 2.0, -5.0, -2.0 ); + TEST_FP_OP3_S(20, fnmsub.s, 0, -1.5, 1.0, 2.5, 1.0 ); + TEST_FP_OP3_S(21, fnmsub.s, 1, -1234, -1.0, -1235.1, 1.1 ); + TEST_FP_OP3_S(22, fnmsub.s, 0, 8.0, 2.0, -5.0, -2.0 ); - TEST_FP_OP3_D(23, fnmsub.d, -1.5, 1.0, 2.5, 1.0 ); - TEST_FP_OP3_D(24, fnmsub.d, -1234, -1.0, -1235.1, 1.1 ); - TEST_FP_OP3_D(25, fnmsub.d, 8.0, 2.0, -5.0, -2.0 ); + TEST_FP_OP3_D(23, fnmsub.d, 0, -1.5, 1.0, 2.5, 1.0 ); + TEST_FP_OP3_D(24, fnmsub.d, 1, -1234, -1.0, -1235.1, 1.1 ); + TEST_FP_OP3_D(25, fnmsub.d, 0, 8.0, 2.0, -5.0, -2.0 ); TEST_PASSFAIL diff --git a/isa/rv64uf/fmin.S b/isa/rv64uf/fmin.S index f9e8dda..80eecf6 100644 --- a/isa/rv64uf/fmin.S +++ b/isa/rv64uf/fmin.S @@ -15,33 +15,33 @@ RVTEST_CODE_BEGIN # Arithmetic tests #------------------------------------------------------------- - TEST_FP_OP2_S( 2, fmin.s, 1.0, 2.5, 1.0 ); - TEST_FP_OP2_S( 3, fmin.s, -1235.1, -1235.1, 1.1 ); - TEST_FP_OP2_S( 4, fmin.s, -1235.1, 1.1, -1235.1 ); - TEST_FP_OP2_S( 5, fmin.s, -1235.1, NaN, -1235.1 ); - TEST_FP_OP2_S( 6, fmin.s, 0.00000001, 3.14159265, 0.00000001 ); - TEST_FP_OP2_S( 7, fmin.s, -2.0, -1.0, -2.0 ); - - TEST_FP_OP2_S(12, fmax.s, 2.5, 2.5, 1.0 ); - TEST_FP_OP2_S(13, fmax.s, 1.1, -1235.1, 1.1 ); - TEST_FP_OP2_S(14, fmax.s, 1.1, 1.1, -1235.1 ); - TEST_FP_OP2_S(15, fmax.s, -1235.1, NaN, -1235.1 ); - TEST_FP_OP2_S(16, fmax.s, 3.14159265, 3.14159265, 0.00000001 ); - TEST_FP_OP2_S(17, fmax.s, -1.0, -1.0, -2.0 ); - - TEST_FP_OP2_D(22, fmin.d, 1.0, 2.5, 1.0 ); - TEST_FP_OP2_D(23, fmin.d, -1235.1, -1235.1, 1.1 ); - TEST_FP_OP2_D(24, fmin.d, -1235.1, 1.1, -1235.1 ); - TEST_FP_OP2_D(25, fmin.d, -1235.1, NaN, -1235.1 ); - TEST_FP_OP2_D(26, fmin.d, 0.00000001, 3.14159265, 0.00000001 ); - TEST_FP_OP2_D(27, fmin.d, -2.0, -1.0, -2.0 ); - - TEST_FP_OP2_D(32, fmax.d, 2.5, 2.5, 1.0 ); - TEST_FP_OP2_D(33, fmax.d, 1.1, -1235.1, 1.1 ); - TEST_FP_OP2_D(34, fmax.d, 1.1, 1.1, -1235.1 ); - TEST_FP_OP2_D(35, fmax.d, -1235.1, NaN, -1235.1 ); - TEST_FP_OP2_D(36, fmax.d, 3.14159265, 3.14159265, 0.00000001 ); - TEST_FP_OP2_D(37, fmax.d, -1.0, -1.0, -2.0 ); + TEST_FP_OP2_S( 2, fmin.s, 0, 1.0, 2.5, 1.0 ); + TEST_FP_OP2_S( 3, fmin.s, 0, -1235.1, -1235.1, 1.1 ); + TEST_FP_OP2_S( 4, fmin.s, 0, -1235.1, 1.1, -1235.1 ); + TEST_FP_OP2_S( 5, fmin.s, 0, -1235.1, NaN, -1235.1 ); + TEST_FP_OP2_S( 6, fmin.s, 0, 0.00000001, 3.14159265, 0.00000001 ); + TEST_FP_OP2_S( 7, fmin.s, 0, -2.0, -1.0, -2.0 ); + + TEST_FP_OP2_S(12, fmax.s, 0, 2.5, 2.5, 1.0 ); + TEST_FP_OP2_S(13, fmax.s, 0, 1.1, -1235.1, 1.1 ); + TEST_FP_OP2_S(14, fmax.s, 0, 1.1, 1.1, -1235.1 ); + TEST_FP_OP2_S(15, fmax.s, 0, -1235.1, NaN, -1235.1 ); + TEST_FP_OP2_S(16, fmax.s, 0, 3.14159265, 3.14159265, 0.00000001 ); + TEST_FP_OP2_S(17, fmax.s, 0, -1.0, -1.0, -2.0 ); + + TEST_FP_OP2_D(22, fmin.d, 0, 1.0, 2.5, 1.0 ); + TEST_FP_OP2_D(23, fmin.d, 0, -1235.1, -1235.1, 1.1 ); + TEST_FP_OP2_D(24, fmin.d, 0, -1235.1, 1.1, -1235.1 ); + TEST_FP_OP2_D(25, fmin.d, 0, -1235.1, NaN, -1235.1 ); + TEST_FP_OP2_D(26, fmin.d, 0, 0.00000001, 3.14159265, 0.00000001 ); + TEST_FP_OP2_D(27, fmin.d, 0, -2.0, -1.0, -2.0 ); + + TEST_FP_OP2_D(32, fmax.d, 0, 2.5, 2.5, 1.0 ); + TEST_FP_OP2_D(33, fmax.d, 0, 1.1, -1235.1, 1.1 ); + TEST_FP_OP2_D(34, fmax.d, 0, 1.1, 1.1, -1235.1 ); + TEST_FP_OP2_D(35, fmax.d, 0, -1235.1, NaN, -1235.1 ); + TEST_FP_OP2_D(36, fmax.d, 0, 3.14159265, 3.14159265, 0.00000001 ); + TEST_FP_OP2_D(37, fmax.d, 0, -1.0, -1.0, -2.0 ); TEST_PASSFAIL diff --git a/isa/rv64uf/fsgnj.S b/isa/rv64uf/fsgnj.S index d405564..1c82db4 100644 --- a/isa/rv64uf/fsgnj.S +++ b/isa/rv64uf/fsgnj.S @@ -15,35 +15,35 @@ RVTEST_CODE_BEGIN # Arithmetic tests #------------------------------------------------------------- - TEST_FP_OP2_S( 2, fsgnj.s, -6.3, 6.3, -1.0 ); - TEST_FP_OP2_S( 3, fsgnj.s, 7.3, 7.3, 2.0 ); - TEST_FP_OP2_S( 4, fsgnj.s, -8.3, -8.3, -3.0 ); - TEST_FP_OP2_S( 5, fsgnj.s, 9.3, -9.3, 4.0 ); - - TEST_FP_OP2_S(12, fsgnjn.s, 6.3, 6.3, -1.0 ); - TEST_FP_OP2_S(13, fsgnjn.s, -7.3, 7.3, 2.0 ); - TEST_FP_OP2_S(14, fsgnjn.s, 8.3, -8.3, -3.0 ); - TEST_FP_OP2_S(15, fsgnjn.s, -9.3, -9.3, 4.0 ); - - TEST_FP_OP2_S(22, fsgnjx.s, -6.3, 6.3, -1.0 ); - TEST_FP_OP2_S(23, fsgnjx.s, 7.3, 7.3, 2.0 ); - TEST_FP_OP2_S(24, fsgnjx.s, 8.3, -8.3, -3.0 ); - TEST_FP_OP2_S(25, fsgnjx.s, -9.3, -9.3, 4.0 ); - - TEST_FP_OP2_D(32, fsgnj.d, -6.3, 6.3, -1.0 ); - TEST_FP_OP2_D(33, fsgnj.d, 7.3, 7.3, 2.0 ); - TEST_FP_OP2_D(34, fsgnj.d, -8.3, -8.3, -3.0 ); - TEST_FP_OP2_D(35, fsgnj.d, 9.3, -9.3, 4.0 ); - - TEST_FP_OP2_D(42, fsgnjn.d, 6.3, 6.3, -1.0 ); - TEST_FP_OP2_D(43, fsgnjn.d, -7.3, 7.3, 2.0 ); - TEST_FP_OP2_D(44, fsgnjn.d, 8.3, -8.3, -3.0 ); - TEST_FP_OP2_D(45, fsgnjn.d, -9.3, -9.3, 4.0 ); - - TEST_FP_OP2_D(52, fsgnjx.d, -6.3, 6.3, -1.0 ); - TEST_FP_OP2_D(53, fsgnjx.d, 7.3, 7.3, 2.0 ); - TEST_FP_OP2_D(54, fsgnjx.d, 8.3, -8.3, -3.0 ); - TEST_FP_OP2_D(55, fsgnjx.d, -9.3, -9.3, 4.0 ); + TEST_FP_OP2_S( 2, fsgnj.s, 0, -6.3, 6.3, -1.0 ); + TEST_FP_OP2_S( 3, fsgnj.s, 0, 7.3, 7.3, 2.0 ); + TEST_FP_OP2_S( 4, fsgnj.s, 0, -8.3, -8.3, -3.0 ); + TEST_FP_OP2_S( 5, fsgnj.s, 0, 9.3, -9.3, 4.0 ); + + TEST_FP_OP2_S(12, fsgnjn.s, 0, 6.3, 6.3, -1.0 ); + TEST_FP_OP2_S(13, fsgnjn.s, 0, -7.3, 7.3, 2.0 ); + TEST_FP_OP2_S(14, fsgnjn.s, 0, 8.3, -8.3, -3.0 ); + TEST_FP_OP2_S(15, fsgnjn.s, 0, -9.3, -9.3, 4.0 ); + + TEST_FP_OP2_S(22, fsgnjx.s, 0, -6.3, 6.3, -1.0 ); + TEST_FP_OP2_S(23, fsgnjx.s, 0, 7.3, 7.3, 2.0 ); + TEST_FP_OP2_S(24, fsgnjx.s, 0, 8.3, -8.3, -3.0 ); + TEST_FP_OP2_S(25, fsgnjx.s, 0, -9.3, -9.3, 4.0 ); + + TEST_FP_OP2_D(32, fsgnj.d, 0, -6.3, 6.3, -1.0 ); + TEST_FP_OP2_D(33, fsgnj.d, 0, 7.3, 7.3, 2.0 ); + TEST_FP_OP2_D(34, fsgnj.d, 0, -8.3, -8.3, -3.0 ); + TEST_FP_OP2_D(35, fsgnj.d, 0, 9.3, -9.3, 4.0 ); + + TEST_FP_OP2_D(42, fsgnjn.d, 0, 6.3, 6.3, -1.0 ); + TEST_FP_OP2_D(43, fsgnjn.d, 0, -7.3, 7.3, 2.0 ); + TEST_FP_OP2_D(44, fsgnjn.d, 0, 8.3, -8.3, -3.0 ); + TEST_FP_OP2_D(45, fsgnjn.d, 0, -9.3, -9.3, 4.0 ); + + TEST_FP_OP2_D(52, fsgnjx.d, 0, -6.3, 6.3, -1.0 ); + TEST_FP_OP2_D(53, fsgnjx.d, 0, 7.3, 7.3, 2.0 ); + TEST_FP_OP2_D(54, fsgnjx.d, 0, 8.3, -8.3, -3.0 ); + TEST_FP_OP2_D(55, fsgnjx.d, 0, -9.3, -9.3, 4.0 ); TEST_PASSFAIL