From 53c656424b3749101d3bc347f99e14134c893431 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 3 May 2020 19:00:27 +0300 Subject: [PATCH] CPU tester fixes: FREM and FMOD use current rounding mode. FSCALE didn't round if early exit. FSINH/FCOSH didn't set INEX if too large result. --- softfloat/softfloat.cpp | 13 ++++++++----- softfloat/softfloat_fpsp.cpp | 8 ++++++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/softfloat/softfloat.cpp b/softfloat/softfloat.cpp index cb12b973..801261d9 100644 --- a/softfloat/softfloat.cpp +++ b/softfloat/softfloat.cpp @@ -2976,8 +2976,8 @@ floatx80 floatx80_rem( floatx80 a, floatx80 b, uint64_t *q, flag *s, float_statu ++*q; } return - normalizeRoundAndPackFloatx80( - 80, zSign, bExp + expDiff, aSig0, aSig1, status ); + normalizeRoundAndPackFloatx80(status->floatx80_rounding_precision, + zSign, bExp + expDiff, aSig0, aSig1, status ); } #endif // End of modification @@ -3070,8 +3070,8 @@ floatx80 floatx80_mod( floatx80 a, floatx80 b, uint64_t *q, flag *s, float_statu *q += qTemp; } return - normalizeRoundAndPackFloatx80( - 80, zSign, bExp + expDiff, aSig0, aSig1, status ); + normalizeRoundAndPackFloatx80(status->floatx80_rounding_precision, + zSign, bExp + expDiff, aSig0, aSig1, status ); } #endif // end of addition for Previous @@ -3246,7 +3246,10 @@ floatx80 floatx80_scale(floatx80 a, floatx80 b, float_status *status) normalizeFloatx80Subnormal( aSig, &aExp, &aSig ); } - if ( bExp < 0x3FFF ) return a; + if (bExp < 0x3FFF) { + return roundAndPackFloatx80( + status->floatx80_rounding_precision, aSign, aExp, aSig, 0, status); + } if ( 0x400F < bExp ) { aExp = bSign ? -0x6001 : 0xE000; diff --git a/softfloat/softfloat_fpsp.cpp b/softfloat/softfloat_fpsp.cpp index 7753cf01..d2811185 100644 --- a/softfloat/softfloat_fpsp.cpp +++ b/softfloat/softfloat_fpsp.cpp @@ -625,7 +625,9 @@ floatx80 floatx80_cosh(floatx80 a, float_status *status) if (compact > 0x400CB167) { if (compact > 0x400CB2B3) { RESET_PREC; - return roundAndPackFloatx80(status->floatx80_rounding_precision, 0, 0x8000, one_sig, 0, status); + a = roundAndPackFloatx80(status->floatx80_rounding_precision, 0, 0x8000, one_sig, 0, status); + float_raise(float_flag_inexact, status); + return a; } else { fp0 = packFloatx80(0, aExp, aSig); fp0 = floatx80_sub(fp0, float64_to_floatx80(LIT64(0x40C62D38D3D64634), status), status); @@ -1608,7 +1610,9 @@ floatx80 floatx80_sinh(floatx80 a, float_status *status) if (compact > 0x400CB2B3) { RESET_PREC; - return roundAndPackFloatx80(status->floatx80_rounding_precision, aSign, 0x8000, aSig, 0, status); + a = roundAndPackFloatx80(status->floatx80_rounding_precision, aSign, 0x8000, aSig, 0, status); + float_raise(float_flag_inexact, status); + return a; } else { fp0 = floatx80_abs(a, status); // Y = |X| fp0 = floatx80_sub(fp0, float64_to_floatx80(LIT64(0x40C62D38D3D64634), status), status); // (|X|-16381LOG2_LEAD) -- 2.47.3