From: David Hildenbrand <david@redhat.com>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: alex.bennee@linaro.org, bharata@linux.ibm.com
Subject: Re: [PATCH 5/8] softfloat: Inline pick_nan_muladd into its caller
Date: Thu, 24 Sep 2020 09:42:43 +0200 [thread overview]
Message-ID: <9f382d1d-800f-43c8-7dca-ddd961b527e2@redhat.com> (raw)
In-Reply-To: <20200924012453.659757-6-richard.henderson@linaro.org>
On 24.09.20 03:24, Richard Henderson wrote:
> Because of FloatParts, there will only ever be one caller.
> Inlining allows us to re-use abc_mask for the snan test.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> fpu/softfloat.c | 75 +++++++++++++++++++++++--------------------------
> 1 file changed, 35 insertions(+), 40 deletions(-)
>
> diff --git a/fpu/softfloat.c b/fpu/softfloat.c
> index 3e625c47cd..e038434a07 100644
> --- a/fpu/softfloat.c
> +++ b/fpu/softfloat.c
> @@ -929,45 +929,6 @@ static FloatParts pick_nan(FloatParts a, FloatParts b, float_status *s)
> return a;
> }
>
> -static FloatParts pick_nan_muladd(FloatParts a, FloatParts b, FloatParts c,
> - bool inf_zero, float_status *s)
> -{
> - int which;
> -
> - if (is_snan(a.cls) || is_snan(b.cls) || is_snan(c.cls)) {
> - s->float_exception_flags |= float_flag_invalid;
> - }
> -
> - which = pickNaNMulAdd(a.cls, b.cls, c.cls, inf_zero, s);
> -
> - if (s->default_nan_mode) {
> - /* Note that this check is after pickNaNMulAdd so that function
> - * has an opportunity to set the Invalid flag.
> - */
> - which = 3;
> - }
> -
> - switch (which) {
> - case 0:
> - break;
> - case 1:
> - a = b;
> - break;
> - case 2:
> - a = c;
> - break;
> - case 3:
> - return parts_default_nan(s);
> - default:
> - g_assert_not_reached();
> - }
> -
> - if (is_snan(a.cls)) {
> - return parts_silence_nan(a, s);
> - }
> - return a;
> -}
> -
> /*
> * Returns the result of adding or subtracting the values of the
> * floating-point values `a' and `b'. The operation is performed
> @@ -1366,7 +1327,41 @@ static FloatParts muladd_floats(FloatParts a, FloatParts b, FloatParts c,
> * off to the target-specific pick-a-NaN routine.
> */
> if (unlikely(abc_mask & float_cmask_anynan)) {
> - return pick_nan_muladd(a, b, c, inf_zero, s);
> + int which;
> +
> + if (unlikely(abc_mask & float_cmask_snan)) {
> + float_raise(float_flag_invalid, s);
> + }
> +
> + which = pickNaNMulAdd(a.cls, b.cls, c.cls, inf_zero, s);
> +
> + if (s->default_nan_mode) {
> + /*
> + * Note that this check is after pickNaNMulAdd so that function
> + * has an opportunity to set the Invalid flag for inf_zero.
> + */
> + which = 3;
> + }
> +
> + switch (which) {
> + case 0:
> + break;
> + case 1:
> + a = b;
> + break;
> + case 2:
> + a = c;
> + break;
> + case 3:
> + return parts_default_nan(s);
> + default:
> + g_assert_not_reached();
> + }
> +
> + if (is_snan(a.cls)) {
> + return parts_silence_nan(a, s);
> + }
> + return a;
> }
>
> if (unlikely(inf_zero)) {
>
Not sure if that increases readability of muladd_floats() ... sometimes
there is good reason to factor out stuff into subfunctions to improve
readability.
But the change itself looks good to me
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2020-09-24 7:48 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-24 1:24 [PATCH 0/8] softfloat: Implement float128_muladd Richard Henderson
2020-09-24 1:24 ` [PATCH 1/8] softfloat: Use mulu64 for mul64To128 Richard Henderson
2020-09-24 7:32 ` David Hildenbrand
2020-09-24 1:24 ` [PATCH 2/8] softfloat: Use int128.h for some operations Richard Henderson
2020-09-24 7:35 ` David Hildenbrand
2020-09-24 1:24 ` [PATCH 3/8] softfloat: Tidy a * b + inf return Richard Henderson
2020-09-24 7:37 ` David Hildenbrand
2020-09-24 1:24 ` [PATCH 4/8] softfloat: Add float_cmask and constants Richard Henderson
2020-09-24 7:40 ` David Hildenbrand
2020-09-24 1:24 ` [PATCH 5/8] softfloat: Inline pick_nan_muladd into its caller Richard Henderson
2020-09-24 7:42 ` David Hildenbrand [this message]
2020-09-24 1:24 ` [PATCH 6/8] softfloat: Implement float128_muladd Richard Henderson
2020-09-24 7:56 ` David Hildenbrand
2020-09-24 13:30 ` Richard Henderson
2020-09-25 9:17 ` David Hildenbrand
2020-09-24 1:24 ` [PATCH 7/8] softfloat: Use x86_64 assembly for {add,sub}{192,256} Richard Henderson
2020-09-24 1:24 ` [PATCH 8/8] softfloat: Use aarch64 " Richard Henderson
2020-09-24 8:00 ` [PATCH 0/8] softfloat: Implement float128_muladd David Hildenbrand
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=9f382d1d-800f-43c8-7dca-ddd961b527e2@redhat.com \
--to=david@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=bharata@linux.ibm.com \
--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).