]> sourceware.org Git - glibc.git/commitdiff
Use an intermediate variable to sum exponents in powerpc __mul and __sqr
authorSiddhesh Poyarekar <siddhesh@redhat.com>
Thu, 7 Mar 2013 07:48:56 +0000 (13:18 +0530)
committerSiddhesh Poyarekar <siddhesh@redhat.com>
Thu, 7 Mar 2013 07:48:56 +0000 (13:18 +0530)
ChangeLog
sysdeps/powerpc/powerpc32/power4/fpu/mpa.c
sysdeps/powerpc/powerpc64/power4/fpu/mpa.c

index f10a14684b87f5c372c03a7ae9f3cf5677ee0408..75841387ff03e0a6d8670ad6aed56a3be86c956d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2013-03-07  Siddhesh Poyarekar  <siddhesh@redhat.com>
 
+       * sysdeps/powerpc/powerpc32/power4/fpu/mpa.c (__mul): Use
+       intermediate variable to calculate exponent.
+       (__sqr): Likewise.
+       * sysdeps/powerpc/powerpc64/power4/fpu/mpa.c (__mul):
+       Likewise.
+       (__sqr): Likewise.
+
        * sysdeps/ieee754/dbl-64/mpa.c [!NO__MUL]: Define __mul.
        [!NO__SQR]: Define __sqr.
        * sysdeps/powerpc/powerpc32/power4/fpu/mpa.c: define NO__MUL
index ef7ada749a7962320957aab8ed375767170b6f41..1858c974070bd47e1815d86eb2b1ad57e44e1e66 100644 (file)
@@ -99,16 +99,16 @@ __mul (const mp_no *x, const mp_no *y, mp_no *z, int p)
     }
   Z[k] = zk;
 
+  int e = EX + EY;
   /* Is there a carry beyond the most significant digit?  */
   if (Z[1] == ZERO)
     {
       for (i = 1; i <= p2; i++)
        Z[i] = Z[i + 1];
-      EZ = EX + EY - 1;
+      e--;
     }
-  else
-    EZ = EX + EY;
 
+  EZ = e;
   Z[0] = X[0] * Y[0];
 }
 
@@ -202,12 +202,13 @@ __sqr (const mp_no *x, mp_no *y, int p)
   /* Squares are always positive.  */
   Y[0] = 1.0;
 
-  EY = 2 * EX;
+  int e = EX * 2;
   /* Is there a carry beyond the most significant digit?  */
   if (__glibc_unlikely (Y[1] == ZERO))
     {
       for (i = 1; i <= p; i++)
        Y[i] = Y[i + 1];
-      EY--;
+      e--;
     }
+  EY = e;
 }
index ef7ada749a7962320957aab8ed375767170b6f41..1858c974070bd47e1815d86eb2b1ad57e44e1e66 100644 (file)
@@ -99,16 +99,16 @@ __mul (const mp_no *x, const mp_no *y, mp_no *z, int p)
     }
   Z[k] = zk;
 
+  int e = EX + EY;
   /* Is there a carry beyond the most significant digit?  */
   if (Z[1] == ZERO)
     {
       for (i = 1; i <= p2; i++)
        Z[i] = Z[i + 1];
-      EZ = EX + EY - 1;
+      e--;
     }
-  else
-    EZ = EX + EY;
 
+  EZ = e;
   Z[0] = X[0] * Y[0];
 }
 
@@ -202,12 +202,13 @@ __sqr (const mp_no *x, mp_no *y, int p)
   /* Squares are always positive.  */
   Y[0] = 1.0;
 
-  EY = 2 * EX;
+  int e = EX * 2;
   /* Is there a carry beyond the most significant digit?  */
   if (__glibc_unlikely (Y[1] == ZERO))
     {
       for (i = 1; i <= p; i++)
        Y[i] = Y[i + 1];
-      EY--;
+      e--;
     }
+  EY = e;
 }
This page took 0.130281 seconds and 5 git commands to generate.