[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 60/72] softfloat: Convert floatx80_mul to FloatParts
From: |
Richard Henderson |
Subject: |
[PATCH 60/72] softfloat: Convert floatx80_mul to FloatParts |
Date: |
Fri, 7 May 2021 18:47:50 -0700 |
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 3c6751e4d0..4454219f8a 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -1943,6 +1943,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
*/
@@ -5865,68 +5879,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
- Re: [PATCH 45/72] softfloat: Move round_to_int to softfloat-parts.c.inc, (continued)
- [PATCH 46/72] softfloat: Move rount_to_int_and_pack to softfloat-parts.c.inc, Richard Henderson, 2021/05/07
- [PATCH 47/72] softfloat: Move rount_to_uint_and_pack to softfloat-parts.c.inc, Richard Henderson, 2021/05/07
- [PATCH 50/72] softfloat: Move minmax_flags to softfloat-parts.c.inc, Richard Henderson, 2021/05/07
- [PATCH 51/72] softfloat: Move compare_floats to softfloat-parts.c.inc, Richard Henderson, 2021/05/07
- [PATCH 52/72] softfloat: Move scalbn_decomposed to softfloat-parts.c.inc, Richard Henderson, 2021/05/07
- [PATCH 53/72] softfloat: Move sqrt_float to softfloat-parts.c.inc, Richard Henderson, 2021/05/07
- [PATCH 60/72] softfloat: Convert floatx80_mul to FloatParts,
Richard Henderson <=
- [PATCH 62/72] softfloat: Convert floatx80_sqrt to FloatParts, Richard Henderson, 2021/05/07
- [PATCH 57/72] softfloat: Adjust parts_uncanon_normal for floatx80, Richard Henderson, 2021/05/07
- [PATCH 65/72] softfloat: Convert integer to floatx80 to FloatParts, Richard Henderson, 2021/05/07
- [PATCH 68/72] softfloat: Convert floatx80_scalbn to FloatParts, Richard Henderson, 2021/05/07
- [PATCH 66/72] softfloat: Convert floatx80 float conversions to FloatParts, Richard Henderson, 2021/05/07
- [PATCH 70/72] softfloat: Convert float32_exp2 to FloatParts, Richard Henderson, 2021/05/07
- [PATCH 55/72] softfloat: Reduce FloatFmt, Richard Henderson, 2021/05/07
- [PATCH 58/72] tests/fp/fp-test: Reverse order of floatx80 precision tests, Richard Henderson, 2021/05/07
- [PATCH 61/72] softfloat: Convert floatx80_div to FloatParts, Richard Henderson, 2021/05/07