]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Some branch prediction for log1p
authorUlrich Drepper <drepper@gmail.com>
Mon, 9 Jan 2012 23:59:04 +0000 (18:59 -0500)
committerUlrich Drepper <drepper@gmail.com>
Mon, 9 Jan 2012 23:59:04 +0000 (18:59 -0500)
ChangeLog
sysdeps/ieee754/dbl-64/s_log1p.c

index 20358264bde3a0d9bd307db72aea8bd91987f1cc..07fd067f610e2009e8e3a896136a8f1fc8787e82 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-01-09  Ulrich Drepper  <drepper@gmail.com>
+
+       * sysdeps/ieee754/dbl-64/s_log1p.c (__log1p): Add branch prediction.
+
 2012-01-08  Ulrich Drepper  <drepper@gmail.com>
 
        * io/bits/poll2.h: Add __BEGIN/__END_DECLS.
index dc79a02bb3f09fc311cee84a87b2fdafcfda2d10..f82048f204ae84ae23b0ac87b794dd554df21e47 100644 (file)
@@ -106,11 +106,11 @@ __log1p(double x)
 
        k = 1;
        if (hx < 0x3FDA827A) {                  /* x < 0.41422  */
-           if(ax>=0x3ff00000) {                /* x <= -1.0 */
+           if(__builtin_expect(ax>=0x3ff00000, 0)) { /* x <= -1.0 */
                if(x==-1.0) return -two54/(x-x);/* log1p(-1)=+inf */
                else return (x-x)/(x-x);        /* log1p(x<-1)=NaN */
            }
-           if(ax<0x3e200000) {                 /* |x| < 2**-29 */
+           if(__builtin_expect(ax<0x3e200000, 0)) { /* |x| < 2**-29 */
                math_force_eval(two54+x);       /* raise inexact */
                if (ax<0x3c900000)              /* |x| < 2**-54 */
                    return x;
@@ -120,7 +120,7 @@ __log1p(double x)
            if(hx>0||hx<=((int32_t)0xbfd2bec3)) {
                k=0;f=x;hu=1;}  /* -0.2929<x<0.41422 */
        }
-       if (hx >= 0x7ff00000) return x+x;
+       else if (__builtin_expect(hx >= 0x7ff00000, 0)) return x+x;
        if(k!=0) {
            if(hx<0x43400000) {
                u  = 1.0+x;