summary refs log tree commit diff
path: root/sysdeps/ieee754/dbl-64/e_fmod.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-10-23 20:55:26 -0400
committerUlrich Drepper <drepper@gmail.com>2011-10-23 20:55:26 -0400
commit0275fff8a105d5963df43b27df769487adac25ac (patch)
tree2896c1ef127f15491afc3f4c8ab87cf75558fea4 /sysdeps/ieee754/dbl-64/e_fmod.c
parent10d005f77f0dfb5b7abaf4e78b875964ceaa7ed4 (diff)
downloadglibc-0275fff8a105d5963df43b27df769487adac25ac.tar.gz
glibc-0275fff8a105d5963df43b27df769487adac25ac.tar.xz
glibc-0275fff8a105d5963df43b27df769487adac25ac.zip
Optimize f_mod
Branch prediction for the 32-bit implementation and a new optimized
64-bit implementation.
Diffstat (limited to 'sysdeps/ieee754/dbl-64/e_fmod.c')
-rw-r--r--sysdeps/ieee754/dbl-64/e_fmod.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/sysdeps/ieee754/dbl-64/e_fmod.c b/sysdeps/ieee754/dbl-64/e_fmod.c
index a575f616bc..0328b011d2 100644
--- a/sysdeps/ieee754/dbl-64/e_fmod.c
+++ b/sysdeps/ieee754/dbl-64/e_fmod.c
@@ -1,4 +1,3 @@
-/* @(#)e_fmod.c 5.1 93/09/24 */
 /*
  * ====================================================
  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
@@ -44,7 +43,7 @@ __ieee754_fmod (double x, double y)
 	}
 
     /* determine ix = ilogb(x) */
-	if(hx<0x00100000) {	/* subnormal x */
+	if(__builtin_expect(hx<0x00100000, 0)) {	/* subnormal x */
 	    if(hx==0) {
 		for (ix = -1043, i=lx; i>0; i<<=1) ix -=1;
 	    } else {
@@ -53,7 +52,7 @@ __ieee754_fmod (double x, double y)
 	} else ix = (hx>>20)-1023;
 
     /* determine iy = ilogb(y) */
-	if(hy<0x00100000) {	/* subnormal y */
+	if(__builtin_expect(hy<0x00100000, 0)) {	/* subnormal y */
 	    if(hy==0) {
 		for (iy = -1043, i=ly; i>0; i<<=1) iy -=1;
 	    } else {
@@ -62,7 +61,7 @@ __ieee754_fmod (double x, double y)
 	} else iy = (hy>>20)-1023;
 
     /* set up {hx,lx}, {hy,ly} and align y to x */
-	if(ix >= -1022)
+	if(__builtin_expect(ix >= -1022, 1))
 	    hx = 0x00100000|(0x000fffff&hx);
 	else {		/* subnormal x, shift x to normal */
 	    n = -1022-ix;
@@ -74,7 +73,7 @@ __ieee754_fmod (double x, double y)
 		lx = 0;
 	    }
 	}
-	if(iy >= -1022)
+	if(__builtin_expect(iy >= -1022, 1))
 	    hy = 0x00100000|(0x000fffff&hy);
 	else {		/* subnormal y, shift y to normal */
 	    n = -1022-iy;
@@ -108,7 +107,7 @@ __ieee754_fmod (double x, double y)
 	    hx = hx+hx+(lx>>31); lx = lx+lx;
 	    iy -= 1;
 	}
-	if(iy>= -1022) {	/* normalize output */
+	if(__builtin_expect(iy>= -1022, 1)) {	/* normalize output */
 	    hx = ((hx-0x00100000)|((iy+1023)<<20));
 	    INSERT_WORDS(x,hx|sx,lx);
 	} else {		/* subnormal output */