This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Eliminate redundant sign extensions in pow()
- From: Anton Blanchard <anton at samba dot org>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: <tuliom at linux dot vnet dot ibm dot com>, <cseo at linux dot vnet dot ibm dot com>, <sjmunroe at us dot ibm dot com>, <libc-alpha at sourceware dot org>
- Date: Fri, 20 Nov 2015 23:37:00 +1100
- Subject: Re: [PATCH] Eliminate redundant sign extensions in pow()
- Authentication-results: sourceware.org; auth=none
- References: <20151116214413 dot 26babb5f at kryten> <alpine dot DEB dot 2 dot 10 dot 1511161056170 dot 25844 at digraph dot polyomino dot org dot uk>
> OK with a ChangeLog entry if you've done the usual testing with the
> testsuite without any new ulps for pow appearing (you didn't say).
Thanks Joseph.
--
When looking at the code generated for pow() on ppc64 I noticed quite
a few sign extensions. Making the array indices unsigned reduces the
number of sign extensions from 24 to 7.
Tested for powerpc64le and x86_64.
2015-11-20 Anton Blanchard <anton@samba.org>
* sysdeps/ieee754/dbl-64/e_pow.c (log1): Use unsigned int
for array indices.
* sysdeps/ieee754/dbl-64/e_pow.c (my_log2): Likewise.
diff --git a/sysdeps/ieee754/dbl-64/e_pow.c b/sysdeps/ieee754/dbl-64/e_pow.c
index 3b0bbe3..adbd5b8 100644
--- a/sysdeps/ieee754/dbl-64/e_pow.c
+++ b/sysdeps/ieee754/dbl-64/e_pow.c
@@ -245,7 +245,8 @@ static double
SECTION
log1 (double x, double *delta, double *error)
{
- int i, j, m;
+ unsigned int i, j;
+ int m;
double uu, vv, eps, nx, e, e1, e2, t, t1, t2, res, add = 0;
mynumber u, v;
#ifdef BIG_ENDI
@@ -344,7 +345,8 @@ static double
SECTION
my_log2 (double x, double *delta, double *error)
{
- int i, j, m;
+ unsigned int i, j;
+ int m;
double uu, vv, eps, nx, e, e1, e2, t, t1, t2, res, add = 0;
double ou1, ou2, lu1, lu2, ov, lv1, lv2, a, a1, a2;
double y, yy, z, zz, j1, j2, j7, j8;