From: "Alex Bennée" <alex.bennee@linaro.org>
To: "Emilio G. Cota" <cota@braap.org>
Cc: qemu-devel@nongnu.org, Richard Henderson <richard.henderson@linaro.org>
Subject: Re: [Qemu-devel] [PATCH v6 09/13] hardfloat: implement float32/64 multiplication
Date: Wed, 05 Dec 2018 10:10:46 +0000 [thread overview]
Message-ID: <878t142sih.fsf@linaro.org> (raw)
In-Reply-To: <20181124235553.17371-10-cota@braap.org>
Emilio G. Cota <cota@braap.org> writes:
> Performance results for fp-bench:
>
> 1. Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
> - before:
> mul-single: 126.91 MFlops
> mul-double: 118.28 MFlops
> - after:
> mul-single: 258.02 MFlops
> mul-double: 197.96 MFlops
>
> 2. ARM Aarch64 A57 @ 2.4GHz
> - before:
> mul-single: 37.42 MFlops
> mul-double: 38.77 MFlops
> - after:
> mul-single: 73.41 MFlops
> mul-double: 76.93 MFlops
>
> 3. IBM POWER8E @ 2.1 GHz
> - before:
> mul-single: 58.40 MFlops
> mul-double: 59.33 MFlops
> - after:
> mul-single: 60.25 MFlops
> mul-double: 94.79 MFlops
>
> Signed-off-by: Emilio G. Cota <cota@braap.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
> ---
> fpu/softfloat.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++--
> 1 file changed, 52 insertions(+), 2 deletions(-)
>
> diff --git a/fpu/softfloat.c b/fpu/softfloat.c
> index cc500b1618..58e67d9b80 100644
> --- a/fpu/softfloat.c
> +++ b/fpu/softfloat.c
> @@ -1232,7 +1232,8 @@ float16 QEMU_FLATTEN float16_mul(float16 a, float16 b, float_status *status)
> return float16_round_pack_canonical(pr, status);
> }
>
> -float32 QEMU_FLATTEN float32_mul(float32 a, float32 b, float_status *status)
> +static float32 QEMU_SOFTFLOAT_ATTR
> +soft_f32_mul(float32 a, float32 b, float_status *status)
> {
> FloatParts pa = float32_unpack_canonical(a, status);
> FloatParts pb = float32_unpack_canonical(b, status);
> @@ -1241,7 +1242,8 @@ float32 QEMU_FLATTEN float32_mul(float32 a, float32 b, float_status *status)
> return float32_round_pack_canonical(pr, status);
> }
>
> -float64 QEMU_FLATTEN float64_mul(float64 a, float64 b, float_status *status)
> +static float64 QEMU_SOFTFLOAT_ATTR
> +soft_f64_mul(float64 a, float64 b, float_status *status)
> {
> FloatParts pa = float64_unpack_canonical(a, status);
> FloatParts pb = float64_unpack_canonical(b, status);
> @@ -1250,6 +1252,54 @@ float64 QEMU_FLATTEN float64_mul(float64 a, float64 b, float_status *status)
> return float64_round_pack_canonical(pr, status);
> }
>
> +static float hard_f32_mul(float a, float b)
> +{
> + return a * b;
> +}
> +
> +static double hard_f64_mul(double a, double b)
> +{
> + return a * b;
> +}
> +
> +static bool f32_mul_fast_test(union_float32 a, union_float32 b)
> +{
> + return float32_is_zero(a.s) || float32_is_zero(b.s);
> +}
> +
> +static bool f64_mul_fast_test(union_float64 a, union_float64 b)
> +{
> + return float64_is_zero(a.s) || float64_is_zero(b.s);
> +}
> +
> +static float32 f32_mul_fast_op(float32 a, float32 b, float_status *s)
> +{
> + bool signbit = float32_is_neg(a) ^ float32_is_neg(b);
> +
> + return float32_set_sign(float32_zero, signbit);
> +}
> +
> +static float64 f64_mul_fast_op(float64 a, float64 b, float_status *s)
> +{
> + bool signbit = float64_is_neg(a) ^ float64_is_neg(b);
> +
> + return float64_set_sign(float64_zero, signbit);
> +}
> +
> +float32 QEMU_FLATTEN
> +float32_mul(float32 a, float32 b, float_status *s)
> +{
> + return float32_gen2(a, b, s, hard_f32_mul, soft_f32_mul,
> + f32_is_zon2, NULL, f32_mul_fast_test, f32_mul_fast_op);
> +}
> +
> +float64 QEMU_FLATTEN
> +float64_mul(float64 a, float64 b, float_status *s)
> +{
> + return float64_gen2(a, b, s, hard_f64_mul, soft_f64_mul,
> + f64_is_zon2, NULL, f64_mul_fast_test, f64_mul_fast_op);
> +}
> +
> /*
> * Returns the result of multiplying the floating-point values `a' and
> * `b' then adding 'c', with no intermediate rounding step after the
--
Alex Bennée
next prev parent reply other threads:[~2018-12-05 10:10 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-24 23:55 [Qemu-devel] [PATCH v6 00/13] hardfloat Emilio G. Cota
2018-11-24 23:55 ` [Qemu-devel] [PATCH v6 01/13] fp-test: pick TARGET_ARM to get its specialization Emilio G. Cota
2018-12-03 12:13 ` Alex Bennée
2018-11-24 23:55 ` [Qemu-devel] [PATCH v6 02/13] softfloat: add float{32, 64}_is_{de, }normal Emilio G. Cota
2018-11-24 23:55 ` [Qemu-devel] [PATCH v6 03/13] target/tricore: use float32_is_denormal Emilio G. Cota
2018-11-24 23:55 ` [Qemu-devel] [PATCH v6 04/13] softfloat: rename canonicalize to sf_canonicalize Emilio G. Cota
2018-12-03 14:16 ` Alex Bennée
2018-11-24 23:55 ` [Qemu-devel] [PATCH v6 05/13] softfloat: add float{32, 64}_is_zero_or_normal Emilio G. Cota
2018-12-03 14:16 ` Alex Bennée
2018-11-24 23:55 ` [Qemu-devel] [PATCH v6 06/13] tests/fp: add fp-bench Emilio G. Cota
2018-12-03 14:29 ` Alex Bennée
2018-11-24 23:55 ` [Qemu-devel] [PATCH v6 07/13] fpu: introduce hardfloat Emilio G. Cota
2018-11-25 0:25 ` Aleksandar Markovic
2018-11-25 1:25 ` Emilio G. Cota
2018-12-04 12:28 ` Alex Bennée
2018-12-04 13:33 ` Richard Henderson
2018-12-04 13:52 ` Alex Bennée
2018-12-04 17:31 ` Emilio G. Cota
2018-12-04 19:08 ` Alex Bennée
2018-11-24 23:55 ` [Qemu-devel] [PATCH v6 08/13] hardfloat: implement float32/64 addition and subtraction Emilio G. Cota
2018-12-04 18:34 ` Alex Bennée
2018-12-04 20:07 ` Emilio G. Cota
2018-11-24 23:55 ` [Qemu-devel] [PATCH v6 09/13] hardfloat: implement float32/64 multiplication Emilio G. Cota
2018-12-05 10:10 ` Alex Bennée [this message]
2018-11-24 23:55 ` [Qemu-devel] [PATCH v6 10/13] hardfloat: implement float32/64 division Emilio G. Cota
2018-12-05 10:11 ` Alex Bennée
2018-11-24 23:55 ` [Qemu-devel] [PATCH v6 11/13] hardfloat: implement float32/64 fused multiply-add Emilio G. Cota
2018-12-05 12:25 ` Alex Bennée
2018-11-24 23:55 ` [Qemu-devel] [PATCH v6 12/13] hardfloat: implement float32/64 square root Emilio G. Cota
2018-12-05 12:26 ` Alex Bennée
2018-11-24 23:55 ` [Qemu-devel] [PATCH v6 13/13] hardfloat: implement float32/64 comparison Emilio G. Cota
2018-12-05 12:36 ` Alex Bennée
2018-11-27 17:24 ` [Qemu-devel] [PATCH v6 00/13] hardfloat no-reply
2018-11-27 17:52 ` Emilio G. Cota
2018-11-27 17:32 ` no-reply
2018-12-05 12:41 ` Alex Bennée
2018-12-05 16:47 ` Emilio G. Cota
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878t142sih.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=cota@braap.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).