Skip to content

Commit

Permalink
Eliminate redundant sign extensions in pow()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Anton Blanchard authored and Tulio Magno Quites Machado Filho committed Jan 4, 2016
1 parent 1979f3c commit 0a1f1e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2016-01-04 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.

2016-01-04 Joseph Myers <joseph@codesourcery.com>

* NEWS: Update copyright dates.
Expand Down
6 changes: 4 additions & 2 deletions sysdeps/ieee754/dbl-64/e_pow.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 0a1f1e7

Please sign in to comment.