From: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>,
"libc-alpha@sourceware.org" <libc-alpha@sourceware.org>,
"H . J . Lu" <hjl.tools@gmail.com>
Subject: Re: [PATCH v2 5/5] math: Remove the error handling wrapper from fmod and fmodf
Date: Thu, 16 Mar 2023 17:21:46 +0000 [thread overview]
Message-ID: <PAWPR08MB89825534A33C549FF27BD8AA83BC9@PAWPR08MB8982.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <20230315205910.4120377-6-adhemerval.zanella@linaro.org>
Hi Adhemerval,
> It shows an small improvement, the results for fmod:
> x86_64 (Ryzen 9) | close-exponents | 16.0244 | 13.119
> aarch64 (N1) | close-exponents | 8.21306 | 5.76138
I wouldn't call gains of 22% on Ryzen and 42% on N1 for the common case small!
> @@ -56,11 +58,13 @@ __ieee754_fmod (double x, double y)
>...
> - if (__glibc_unlikely (hy == 0 || hx >= EXPONENT_MASK || hy > EXPONENT_MASK))
> + if (__glibc_unlikely (is_nan (hx) || is_nan (hy)))
> return (x * y) / (x * y);
> + if (__glibc_unlikely (hy == 0 || is_inf (hx)))
> + return __math_edom ((x * y) / (x * y));
This now requires 4 compares rather than 2 of the previous if statement (as GCC is able
to merge the 2 tests on hy). It's better to keep that and then handle the special cases.
> @@ -59,8 +61,10 @@ __ieee754_fmodf (float x, float y)
>...
>+ if (__glibc_unlikely (hy == 0 || is_inf (hx)))
>+ return __math_edom ((x * y) / (x * y));
__math_edomf?
> diff --git a/sysdeps/ieee754/flt-32/math_config.h b/sysdeps/ieee754/flt-32/math_config.h
>...
>+attribute_hidden float __math_edom (float x);
__math_edomf?
Cheers,
Wilco
prev parent reply other threads:[~2023-03-16 17:22 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-15 20:59 [PATCH v2 0/5] Improve " Adhemerval Zanella
2023-03-15 20:59 ` [PATCH v2 1/5] benchtests: Add fmod benchmark Adhemerval Zanella
2023-03-15 20:59 ` [PATCH v2 2/5] benchtests: Add fmodf benchmark Adhemerval Zanella
2023-03-15 20:59 ` [PATCH v2 3/5] math: Improve fmod Adhemerval Zanella
2023-03-16 0:58 ` H.J. Lu
2023-03-16 14:28 ` Adhemerval Zanella Netto
2023-03-16 16:13 ` Wilco Dijkstra
2023-03-16 20:39 ` Adhemerval Zanella Netto
2023-03-17 14:55 ` Wilco Dijkstra
2023-03-17 16:07 ` H.J. Lu
2023-03-17 18:22 ` Wilco Dijkstra
2023-03-15 20:59 ` [PATCH v2 4/5] math: Improve fmodf Adhemerval Zanella
2023-03-16 18:11 ` Wilco Dijkstra
2023-03-16 18:38 ` Adhemerval Zanella Netto
2023-03-16 19:15 ` Wilco Dijkstra
2023-03-16 19:45 ` Adhemerval Zanella Netto
2023-03-15 20:59 ` [PATCH v2 5/5] math: Remove the error handling wrapper from fmod and fmodf Adhemerval Zanella
2023-03-16 17:21 ` Wilco Dijkstra [this message]
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=PAWPR08MB89825534A33C549FF27BD8AA83BC9@PAWPR08MB8982.eurprd08.prod.outlook.com \
--to=wilco.dijkstra@arm.com \
--cc=adhemerval.zanella@linaro.org \
--cc=hjl.tools@gmail.com \
--cc=libc-alpha@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).