[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 65/72] softfloat: Convert integer to floatx80 to FloatParts
From: |
Richard Henderson |
Subject: |
[PATCH 65/72] softfloat: Convert integer to floatx80 to FloatParts |
Date: |
Fri, 7 May 2021 18:47:55 -0700 |
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
fpu/softfloat.c | 58 +++++++++++--------------------------------------
1 file changed, 13 insertions(+), 45 deletions(-)
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index 914cf2688c..82f71896ac 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -3344,6 +3344,19 @@ float128 int32_to_float128(int32_t a, float_status
*status)
return int64_to_float128(a, status);
}
+floatx80 int64_to_floatx80(int64_t a, float_status *status)
+{
+ FloatParts128 p;
+
+ parts_sint_to_float(&p, a, 0, status);
+ return floatx80_round_pack_canonical(&p, status);
+}
+
+floatx80 int32_to_floatx80(int32_t a, float_status *status)
+{
+ return int64_to_floatx80(a, status);
+}
+
/*
* Unsigned Integer to floating-point conversions
*/
@@ -5035,51 +5048,6 @@ static float128 normalizeRoundAndPackFloat128(bool
zSign, int32_t zExp,
}
-
-/*----------------------------------------------------------------------------
-| Returns the result of converting the 32-bit two's complement integer `a'
-| to the extended double-precision floating-point format. The conversion
-| is performed according to the IEC/IEEE Standard for Binary Floating-Point
-| Arithmetic.
-*----------------------------------------------------------------------------*/
-
-floatx80 int32_to_floatx80(int32_t a, float_status *status)
-{
- bool zSign;
- uint32_t absA;
- int8_t shiftCount;
- uint64_t zSig;
-
- if ( a == 0 ) return packFloatx80( 0, 0, 0 );
- zSign = ( a < 0 );
- absA = zSign ? - a : a;
- shiftCount = clz32(absA) + 32;
- zSig = absA;
- return packFloatx80( zSign, 0x403E - shiftCount, zSig<<shiftCount );
-
-}
-
-/*----------------------------------------------------------------------------
-| Returns the result of converting the 64-bit two's complement integer `a'
-| to the extended double-precision floating-point format. The conversion
-| is performed according to the IEC/IEEE Standard for Binary Floating-Point
-| Arithmetic.
-*----------------------------------------------------------------------------*/
-
-floatx80 int64_to_floatx80(int64_t a, float_status *status)
-{
- bool zSign;
- uint64_t absA;
- int8_t shiftCount;
-
- if ( a == 0 ) return packFloatx80( 0, 0, 0 );
- zSign = ( a < 0 );
- absA = zSign ? - a : a;
- shiftCount = clz64(absA);
- return packFloatx80( zSign, 0x403E - shiftCount, absA<<shiftCount );
-
-}
-
/*----------------------------------------------------------------------------
| Returns the result of converting the single-precision floating-point value
| `a' to the extended double-precision floating-point format. The conversion
--
2.25.1
- [PATCH 47/72] softfloat: Move rount_to_uint_and_pack to softfloat-parts.c.inc, (continued)
- [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, 2021/05/07
- [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 <=
- [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
- [PATCH 59/72] softfloat: Convert floatx80_add/sub to FloatParts, Richard Henderson, 2021/05/07
- [PATCH 71/72] softfloat: Move floatN_log2 to softfloat-parts.c.inc, Richard Henderson, 2021/05/07
- [PATCH 56/72] softfloat: Introduce Floatx80RoundPrec, Richard Henderson, 2021/05/07