This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Remove unnecessary multiplication in __mpexp
- From: Carlos O'Donell <carlos at systemhalted dot org>
- To: Siddhesh Poyarekar <siddhesh at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Fri, 18 Jan 2013 00:29:24 -0500
- Subject: Re: [PATCH] Remove unnecessary multiplication in __mpexp
- References: <20130116142042.GW7894@spoyarek.pnq.redhat.com>
On 01/16/2013 09:20 AM, Siddhesh Poyarekar wrote:
> Hi,
>
> In __mpexp, B is first reduced by multiplying with RADIXI (2^-24) and
> then multiplied by 2 till it crosses 1/2. It's easier (i.e. less
> number of instructions) to just multiply by 2 till it crosses half of
> the mp_no radix (2^23). Verified that there are no regressions
> resulting from this on x86_64 and ppc64 and that it also reduces an
> instruction on x86_64 and 4 instructions on ppc64. This is just a
> micro-cleanup and hence has no noticeable performance impact. OK to
> commit?
One nit.
> Siddhesh
>
> * sysdeps/ieee754/dbl-64/mpexp.c (__mpexp): Remove unnecessary
> multiplication.
>
>
> diff --git a/sysdeps/ieee754/dbl-64/mpexp.c b/sysdeps/ieee754/dbl-64/mpexp.c
> index aca6bf6..811fb46 100644
> --- a/sysdeps/ieee754/dbl-64/mpexp.c
> +++ b/sysdeps/ieee754/dbl-64/mpexp.c
> @@ -103,14 +103,14 @@ __mpexp (mp_no *x, mp_no *y, int p)
> a *= RADIXI;
> for (; i > EX; i--)
> a *= RADIX;
> - b = X[1] * RADIXI;
> + b = X[1];
> m2 = 24 * EX;
> - for (; b < HALF; m2--)
> + for (; b < HALFRAD; m2--)
Where is HALFRAD defined?
Other than in sysdeps/ieee754/dbl-64/mpsqrt.h which doesn't
seem to be included here?
> {
> a *= TWO;
> b *= TWO;
> }
> - if (b == HALF)
> + if (b == HALFRAD)
> {
> for (i = 2; i <= p; i++)
> {
>
OK to commit if you can show where HALFRAD came from :-)
Cheers,
Carlos.