This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] Remove unnecessary multiplication in __mpexp
- From: Siddhesh Poyarekar <siddhesh at redhat dot com>
- To: libc-alpha at sourceware dot org
- Date: Wed, 16 Jan 2013 19:50:42 +0530
- Subject: [PATCH] Remove unnecessary multiplication in __mpexp
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?
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--)
{
a *= TWO;
b *= TWO;
}
- if (b == HALF)
+ if (b == HALFRAD)
{
for (i = 2; i <= p; i++)
{