[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 15/29] softfloat: Convert floatx80_mul to FloatParts
From: |
Richard Henderson |
Subject: |
[PULL 15/29] softfloat: Convert floatx80_mul to FloatParts |
Date: |
Thu, 3 Jun 2021 14:41:17 -0700 |
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
fpu/softfloat.c | 76 +++++++++----------------------------------------
1 file changed, 14 insertions(+), 62 deletions(-)
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index 737f5d7701..ae2e7aa274 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -1944,6 +1944,20 @@ float128_mul(float128 a, float128 b, float_status
*status)
return float128_round_pack_canonical(pr, status);
}
+floatx80 QEMU_FLATTEN
+floatx80_mul(floatx80 a, floatx80 b, float_status *status)
+{
+ FloatParts128 pa, pb, *pr;
+
+ if (!floatx80_unpack_canonical(&pa, a, status) ||
+ !floatx80_unpack_canonical(&pb, b, status)) {
+ return floatx80_default_nan(status);
+ }
+
+ pr = parts_mul(&pa, &pb, status);
+ return floatx80_round_pack_canonical(pr, status);
+}
+
/*
* Fused multiply-add
*/
@@ -5863,68 +5877,6 @@ floatx80 floatx80_round_to_int(floatx80 a, float_status
*status)
}
-/*----------------------------------------------------------------------------
-| Returns the result of multiplying the extended double-precision floating-
-| point values `a' and `b'. The operation is performed according to the
-| IEC/IEEE Standard for Binary Floating-Point Arithmetic.
-*----------------------------------------------------------------------------*/
-
-floatx80 floatx80_mul(floatx80 a, floatx80 b, float_status *status)
-{
- bool aSign, bSign, zSign;
- int32_t aExp, bExp, zExp;
- uint64_t aSig, bSig, zSig0, zSig1;
-
- if (floatx80_invalid_encoding(a) || floatx80_invalid_encoding(b)) {
- float_raise(float_flag_invalid, status);
- return floatx80_default_nan(status);
- }
- aSig = extractFloatx80Frac( a );
- aExp = extractFloatx80Exp( a );
- aSign = extractFloatx80Sign( a );
- bSig = extractFloatx80Frac( b );
- bExp = extractFloatx80Exp( b );
- bSign = extractFloatx80Sign( b );
- zSign = aSign ^ bSign;
- if ( aExp == 0x7FFF ) {
- if ( (uint64_t) ( aSig<<1 )
- || ( ( bExp == 0x7FFF ) && (uint64_t) ( bSig<<1 ) ) ) {
- return propagateFloatx80NaN(a, b, status);
- }
- if ( ( bExp | bSig ) == 0 ) goto invalid;
- return packFloatx80(zSign, floatx80_infinity_high,
- floatx80_infinity_low);
- }
- if ( bExp == 0x7FFF ) {
- if ((uint64_t)(bSig << 1)) {
- return propagateFloatx80NaN(a, b, status);
- }
- if ( ( aExp | aSig ) == 0 ) {
- invalid:
- float_raise(float_flag_invalid, status);
- return floatx80_default_nan(status);
- }
- return packFloatx80(zSign, floatx80_infinity_high,
- floatx80_infinity_low);
- }
- if ( aExp == 0 ) {
- if ( aSig == 0 ) return packFloatx80( zSign, 0, 0 );
- normalizeFloatx80Subnormal( aSig, &aExp, &aSig );
- }
- if ( bExp == 0 ) {
- if ( bSig == 0 ) return packFloatx80( zSign, 0, 0 );
- normalizeFloatx80Subnormal( bSig, &bExp, &bSig );
- }
- zExp = aExp + bExp - 0x3FFE;
- mul64To128( aSig, bSig, &zSig0, &zSig1 );
- if ( 0 < (int64_t) zSig0 ) {
- shortShift128Left( zSig0, zSig1, 1, &zSig0, &zSig1 );
- --zExp;
- }
- return roundAndPackFloatx80(status->floatx80_rounding_precision,
- zSign, zExp, zSig0, zSig1, status);
-}
-
/*----------------------------------------------------------------------------
| Returns the result of dividing the extended double-precision floating-point
| value `a' by the corresponding value `b'. The operation is performed
--
2.25.1
- [PULL 11/29] softfloat: Introduce Floatx80RoundPrec, (continued)
- [PULL 11/29] softfloat: Introduce Floatx80RoundPrec, Richard Henderson, 2021/06/03
- [PULL 13/29] tests/fp/fp-test: Reverse order of floatx80 precision tests, Richard Henderson, 2021/06/03
- [PULL 10/29] softfloat: Reduce FloatFmt, Richard Henderson, 2021/06/03
- [PULL 14/29] softfloat: Convert floatx80_add/sub to FloatParts, Richard Henderson, 2021/06/03
- [PULL 18/29] softfloat: Convert floatx80_round to FloatParts, Richard Henderson, 2021/06/03
- [PULL 19/29] softfloat: Convert floatx80_round_to_int to FloatParts, Richard Henderson, 2021/06/03
- [PULL 16/29] softfloat: Convert floatx80_div to FloatParts, Richard Henderson, 2021/06/03
- [PULL 22/29] softfloat: Convert floatx80 to integer to FloatParts, Richard Henderson, 2021/06/03
- [PULL 21/29] softfloat: Convert floatx80 float conversions to FloatParts, Richard Henderson, 2021/06/03
- [PULL 17/29] softfloat: Convert floatx80_sqrt to FloatParts, Richard Henderson, 2021/06/03
- [PULL 15/29] softfloat: Convert floatx80_mul to FloatParts,
Richard Henderson <=
- [PULL 24/29] softfloat: Convert floatx80 compare to FloatParts, Richard Henderson, 2021/06/03
- [PULL 20/29] softfloat: Convert integer to floatx80 to FloatParts, Richard Henderson, 2021/06/03
- [PULL 23/29] softfloat: Convert floatx80_scalbn to FloatParts, Richard Henderson, 2021/06/03
- [PULL 28/29] tests/fp: Enable more tests, Richard Henderson, 2021/06/03
- [PULL 29/29] softfloat: Use hard-float for {u}int64_to_float{32,64}, Richard Henderson, 2021/06/03
- [PULL 26/29] softfloat: Move floatN_log2 to softfloat-parts.c.inc, Richard Henderson, 2021/06/03
- [PULL 25/29] softfloat: Convert float32_exp2 to FloatParts, Richard Henderson, 2021/06/03
- [PULL 27/29] softfloat: Convert modrem operations to FloatParts, Richard Henderson, 2021/06/03