[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 28/28] softfloat: Use hard-float for {u}int64_to_float{32, 64}
From: |
Richard Henderson |
Subject: |
[PATCH v2 28/28] softfloat: Use hard-float for {u}int64_to_float{32, 64} |
Date: |
Tue, 25 May 2021 08:07:06 -0700 |
For the normal case of no additional scaling, this reduces the
profile contribution of int64_to_float64 to the testcase in the
linked issue from 0.81% to 0.04%.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/134
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
fpu/softfloat.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index b0df5b6dc5..79b2205070 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -3559,6 +3559,13 @@ float32 int64_to_float32_scalbn(int64_t a, int scale,
float_status *status)
{
FloatParts64 p;
+ /* Without scaling, there are no overflow concerns. */
+ if (likely(scale == 0) && can_use_fpu(status)) {
+ union_float32 ur;
+ ur.h = a;
+ return ur.s;
+ }
+
parts64_sint_to_float(&p, a, scale, status);
return float32_round_pack_canonical(&p, status);
}
@@ -3592,6 +3599,13 @@ float64 int64_to_float64_scalbn(int64_t a, int scale,
float_status *status)
{
FloatParts64 p;
+ /* Without scaling, there are no overflow concerns. */
+ if (likely(scale == 0) && can_use_fpu(status)) {
+ union_float64 ur;
+ ur.h = a;
+ return ur.s;
+ }
+
parts_sint_to_float(&p, a, scale, status);
return float64_round_pack_canonical(&p, status);
}
@@ -3726,6 +3740,13 @@ float32 uint64_to_float32_scalbn(uint64_t a, int scale,
float_status *status)
{
FloatParts64 p;
+ /* Without scaling, there are no overflow concerns. */
+ if (likely(scale == 0) && can_use_fpu(status)) {
+ union_float32 ur;
+ ur.h = a;
+ return ur.s;
+ }
+
parts_uint_to_float(&p, a, scale, status);
return float32_round_pack_canonical(&p, status);
}
@@ -3759,6 +3780,13 @@ float64 uint64_to_float64_scalbn(uint64_t a, int scale,
float_status *status)
{
FloatParts64 p;
+ /* Without scaling, there are no overflow concerns. */
+ if (likely(scale == 0) && can_use_fpu(status)) {
+ union_float64 ur;
+ ur.h = a;
+ return ur.s;
+ }
+
parts_uint_to_float(&p, a, scale, status);
return float64_round_pack_canonical(&p, status);
}
--
2.25.1
- [PATCH v2 12/28] tests/fp/fp-test: Reverse order of floatx80 precision tests, (continued)
- [PATCH v2 12/28] tests/fp/fp-test: Reverse order of floatx80 precision tests, Richard Henderson, 2021/05/25
- [PATCH v2 11/28] softfloat: Adjust parts_uncanon_normal for floatx80, Richard Henderson, 2021/05/25
- [PATCH v2 09/28] softfloat: Reduce FloatFmt, Richard Henderson, 2021/05/25
- [PATCH v2 08/28] softfloat: Split out parts_uncanon_normal, Richard Henderson, 2021/05/25
- [PATCH v2 10/28] softfloat: Introduce Floatx80RoundPrec, Richard Henderson, 2021/05/25
- [PATCH v2 15/28] softfloat: Convert floatx80_div to FloatParts, Richard Henderson, 2021/05/25
- [PATCH v2 18/28] softfloat: Convert floatx80_round_to_int to FloatParts, Richard Henderson, 2021/05/25
- [PATCH v2 17/28] softfloat: Convert floatx80_round to FloatParts, Richard Henderson, 2021/05/25
- [PATCH v2 21/28] softfloat: Convert floatx80 to integer to FloatParts, Richard Henderson, 2021/05/25
- [PATCH v2 20/28] softfloat: Convert floatx80 float conversions to FloatParts, Richard Henderson, 2021/05/25
- [PATCH v2 28/28] softfloat: Use hard-float for {u}int64_to_float{32, 64},
Richard Henderson <=
- [PATCH v2 27/28] tests/fp: Enable more tests, Richard Henderson, 2021/05/25
- [PATCH v2 14/28] softfloat: Convert floatx80_mul to FloatParts, Richard Henderson, 2021/05/25
- [PATCH v2 13/28] softfloat: Convert floatx80_add/sub to FloatParts, Richard Henderson, 2021/05/25
- [PATCH v2 22/28] softfloat: Convert floatx80_scalbn to FloatParts, Richard Henderson, 2021/05/25
- [PATCH v2 16/28] softfloat: Convert floatx80_sqrt to FloatParts, Richard Henderson, 2021/05/25
- [PATCH v2 25/28] softfloat: Move floatN_log2 to softfloat-parts.c.inc, Richard Henderson, 2021/05/25
- [PATCH v2 24/28] softfloat: Convert float32_exp2 to FloatParts, Richard Henderson, 2021/05/25
- [PATCH v2 19/28] softfloat: Convert integer to floatx80 to FloatParts, Richard Henderson, 2021/05/25
- [PATCH v2 23/28] softfloat: Convert floatx80 compare to FloatParts, Richard Henderson, 2021/05/25
- [PATCH v2 26/28] softfloat: Convert modrem operations to FloatParts, Richard Henderson, 2021/05/25