This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Remove unnecessary multiplication in __mpexp


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]