[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commits] r15533 - in /fsf/trunk/libc: ./ sysdeps/ieee754/dbl-64/ sysdeps/ieee754/dbl-64/wordsize-64/ wcsmbs/



Author: eglibc
Date: Tue Oct 25 00:03:01 2011
New Revision: 15533

Log:
Import glibc-mainline for 2011-10-25

Added:
    fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/e_fmod.c
    fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/sysdeps/ieee754/dbl-64/doasin.c
    fsf/trunk/libc/sysdeps/ieee754/dbl-64/dosincos.c
    fsf/trunk/libc/sysdeps/ieee754/dbl-64/e_atan2.c
    fsf/trunk/libc/sysdeps/ieee754/dbl-64/e_fmod.c
    fsf/trunk/libc/sysdeps/ieee754/dbl-64/e_log.c
    fsf/trunk/libc/sysdeps/ieee754/dbl-64/e_pow.c
    fsf/trunk/libc/sysdeps/ieee754/dbl-64/halfulp.c
    fsf/trunk/libc/sysdeps/ieee754/dbl-64/s_atan.c
    fsf/trunk/libc/sysdeps/ieee754/dbl-64/s_tan.c
    fsf/trunk/libc/wcsmbs/wcslen.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Tue Oct 25 00:03:01 2011
@@ -1,4 +1,27 @@
+2011-10-24  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	* sysdeps/ieee754/dbl-64/doasin.c: Adjust for DLA_FMA -> DLA_FMS
+	rename.
+	* sysdeps/ieee754/dbl-64/dosincos.c: Likewise.
+	* sysdeps/ieee754/dbl-64/dosincos.c: Likewise.
+	* sysdeps/ieee754/dbl-64/e_atan2.c: Likewise.
+	* sysdeps/ieee754/dbl-64/e_log.c: Likewise.
+	* sysdeps/ieee754/dbl-64/e_pow.c: Likewise.
+	* sysdeps/ieee754/dbl-64/halfulp.c: Likewise.
+	* sysdeps/ieee754/dbl-64/s_atan.c: Likewise.
+	* sysdeps/ieee754/dbl-64/s_tan.c: Likewise.
+
+2011-10-24  Andreas Schwab  <schwab@xxxxxxxxxx>
+
+	* wcsmbs/wcslen.c: Don't define WCSLEN, reverse logic.
+
 2011-10-23  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	* sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c: New file.
+
+	* sysdeps/ieee754/dbl-64/e_fmod.c (__ieee754_fmod): Add some branch
+	prediction.
+	* sysdeps/ieee754/dbl-64/wordsize-64/e_fmod.c: New file.
 
 	* string/strnlen.c: Don't define STRNLEN, reverse logic.
 	Remove unused variable magic_bits.

Modified: fsf/trunk/libc/sysdeps/ieee754/dbl-64/doasin.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/dbl-64/doasin.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/dbl-64/doasin.c Tue Oct 25 00:03:01 2011
@@ -53,7 +53,7 @@
 
   double xx,p,pp,u,uu,r,s;
   double tc,tcc;
-#ifndef DLA_FMA
+#ifndef DLA_FMS
   double hx,tx,hy,ty,tp,tq;
 #endif
 

Modified: fsf/trunk/libc/sysdeps/ieee754/dbl-64/dosincos.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/dbl-64/dosincos.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/dbl-64/dosincos.c Tue Oct 25 00:03:01 2011
@@ -50,7 +50,7 @@
 void __dubsin(double x, double dx, double v[]) {
   double r,s,c,cc,d,dd,d2,dd2,e,ee,
     sn,ssn,cs,ccs,ds,dss,dc,dcc;
-#ifndef DLA_FMA
+#ifndef DLA_FMS
   double p,hx,tx,hy,ty,q;
 #endif
 #if 0
@@ -104,7 +104,7 @@
 void __dubcos(double x, double dx, double v[]) {
   double r,s,c,cc,d,dd,d2,dd2,e,ee,
     sn,ssn,cs,ccs,ds,dss,dc,dcc;
-#ifndef DLA_FMA
+#ifndef DLA_FMS
   double p,hx,tx,hy,ty,q;
 #endif
 #if 0

Modified: fsf/trunk/libc/sysdeps/ieee754/dbl-64/e_atan2.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/dbl-64/e_atan2.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/dbl-64/e_atan2.c Tue Oct 25 00:03:01 2011
@@ -64,7 +64,7 @@
   static const int pr[MM]={6,8,10,20,32};
   double ax,ay,u,du,u9,ua,v,vv,dv,t1,t2,t3,t7,t8,
 	 z,zz,cor,s1,ss1,s2,ss2;
-#ifndef DLA_FMA
+#ifndef DLA_FMS
   double t4,t5,t6;
 #endif
 #if 0

Modified: fsf/trunk/libc/sysdeps/ieee754/dbl-64/e_fmod.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/dbl-64/e_fmod.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/dbl-64/e_fmod.c Tue Oct 25 00:03:01 2011
@@ -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 @@
 	}
 
     /* 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 @@
 	} 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 @@
 	} 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 @@
 		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 @@
 	    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 */

Modified: fsf/trunk/libc/sysdeps/ieee754/dbl-64/e_log.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/dbl-64/e_log.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/dbl-64/e_log.c Tue Oct 25 00:03:01 2011
@@ -58,7 +58,7 @@
 	 sij,ssij,ttij,A,B,B0,y,y1,y2,polI,polII,sa,sb,
 	 t1,t2,t7,t8,t,ra,rb,ww,
 	 a0,aa0,s1,s2,ss2,s3,ss3,a1,aa1,a,aa,b,bb,c;
-#ifndef DLA_FMA
+#ifndef DLA_FMS
   double t3,t4,t5,t6;
 #endif
   number num;

Modified: fsf/trunk/libc/sysdeps/ieee754/dbl-64/e_pow.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/dbl-64/e_pow.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/dbl-64/e_pow.c Tue Oct 25 00:03:01 2011
@@ -284,7 +284,7 @@
 #endif
   double ou1,ou2,lu1,lu2,ov,lv1,lv2,a,a1,a2;
   double y,yy,z,zz,j1,j2,j7,j8;
-#ifndef DLA_FMA
+#ifndef DLA_FMS
   double j3,j4,j5,j6;
 #endif
   mynumber u,v;

Modified: fsf/trunk/libc/sysdeps/ieee754/dbl-64/halfulp.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/dbl-64/halfulp.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/dbl-64/halfulp.c Tue Oct 25 00:03:01 2011
@@ -51,7 +51,7 @@
 {
   mynumber v;
   double z,u,uu;
-#ifndef DLA_FMA
+#ifndef DLA_FMS
   double j1,j2,j3,j4,j5;
 #endif
   int4 k,l,m,n;

Modified: fsf/trunk/libc/sysdeps/ieee754/dbl-64/s_atan.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/dbl-64/s_atan.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/dbl-64/s_atan.c Tue Oct 25 00:03:01 2011
@@ -54,7 +54,7 @@
 
   double cor,s1,ss1,s2,ss2,t1,t2,t3,t7,t8,t9,t10,u,u2,u3,
 	 v,vv,w,ww,y,yy,z,zz;
-#ifndef DLA_FMA
+#ifndef DLA_FMS
   double t4,t5,t6;
 #endif
 #if 0

Modified: fsf/trunk/libc/sysdeps/ieee754/dbl-64/s_tan.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/dbl-64/s_tan.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/dbl-64/s_tan.c Tue Oct 25 00:03:01 2011
@@ -51,7 +51,7 @@
   int ux,i,n;
   double a,da,a2,b,db,c,dc,c1,cc1,c2,cc2,c3,cc3,fi,ffi,gi,pz,s,sy,
   t,t1,t2,t3,t4,t7,t8,t9,t10,w,x2,xn,xx2,y,ya,yya,z0,z,zz,z2,zz2;
-#ifndef DLA_FMA
+#ifndef DLA_FMS
   double t5,t6;
 #endif
   int p;

Added: fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/e_fmod.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/e_fmod.c (added)
+++ fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/e_fmod.c Tue Oct 25 00:03:01 2011
@@ -1,0 +1,104 @@
+/* Rewritten for 64-bit machines by Ulrich Drepper <drepper@xxxxxxxxx>.  */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * __ieee754_fmod(x,y)
+ * Return x mod y in exact arithmetic
+ * Method: shift and subtract
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+static const double one = 1.0, Zero[] = {0.0, -0.0,};
+
+double
+__ieee754_fmod (double x, double y)
+{
+	int32_t n,i,ix,iy;
+	int64_t hx,hy,hz,sx;
+
+	EXTRACT_WORDS64(hx,x);
+	EXTRACT_WORDS64(hy,y);
+	sx = hx&UINT64_C(0x8000000000000000);	/* sign of x */
+	hx ^=sx;				/* |x| */
+	hy &= UINT64_C(0x7fffffffffffffff);	/* |y| */
+
+    /* purge off exception values */
+	if(__builtin_expect(hy==0
+			    || hx >= UINT64_C(0x7ff0000000000000)
+			    || hy > UINT64_C(0x7ff0000000000000), 0))
+	  /* y=0,or x not finite or y is NaN */
+	    return (x*y)/(x*y);
+	if(__builtin_expect(hx<=hy, 0)) {
+	    if(hx<hy) return x;	/* |x|<|y| return x */
+	    return Zero[(uint64_t)sx>>63];	/* |x|=|y| return x*0*/
+	}
+
+    /* determine ix = ilogb(x) */
+	if(__builtin_expect(hx<UINT64_C(0x0010000000000000), 0)) {
+	  /* subnormal x */
+	  for (ix = -1022,i=(hx<<11); i>0; i<<=1) ix -=1;
+	} else ix = (hx>>52)-1023;
+
+    /* determine iy = ilogb(y) */
+	if(__builtin_expect(hy<UINT64_C(0x0010000000000000), 0)) {	/* subnormal y */
+	  for (iy = -1022,i=(hy<<11); i>0; i<<=1) iy -=1;
+	} else iy = (hy>>52)-1023;
+
+    /* set up hx, hy and align y to x */
+	if(__builtin_expect(ix >= -1022, 1))
+	    hx = UINT64_C(0x0010000000000000)|(UINT64_C(0x000fffffffffffff)&hx);
+	else {		/* subnormal x, shift x to normal */
+	    n = -1022-ix;
+	    hx<<=n;
+	}
+	if(__builtin_expect(iy >= -1022, 1))
+	    hy = UINT64_C(0x0010000000000000)|(UINT64_C(0x000fffffffffffff)&hy);
+	else {		/* subnormal y, shift y to normal */
+	    n = -1022-iy;
+	    hy<<=n;
+	}
+
+    /* fix point fmod */
+	n = ix - iy;
+	while(n--) {
+	    hz=hx-hy;
+	    if(hz<0){hx = hx+hx;}
+	    else {
+		if(hz==0)		/* return sign(x)*0 */
+		    return Zero[(uint64_t)sx>>63];
+		hx = hz+hz;
+	    }
+	}
+	hz=hx-hy;
+	if(hz>=0) {hx=hz;}
+
+    /* convert back to floating value and restore the sign */
+	if(hx==0)			/* return sign(x)*0 */
+	    return Zero[(uint64_t)sx>>63];
+	while(hx<UINT64_C(0x0010000000000000)) {	/* normalize x */
+	    hx = hx+hx;
+	    iy -= 1;
+	}
+	if(__builtin_expect(iy>= -1022, 1)) {	/* normalize output */
+	  hx = ((hx-UINT64_C(0x0010000000000000))|((uint64_t)(iy+1023)<<52));
+	    INSERT_WORDS64(x,hx|sx);
+	} else {		/* subnormal output */
+	    n = -1022 - iy;
+	    hx>>=n;
+	    INSERT_WORDS64(x,hx|sx);
+	    x *= one;		/* create necessary signal */
+	}
+	return x;		/* exact output */
+}
+strong_alias (__ieee754_fmod, __fmod_finite)

Added: fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c (added)
+++ fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c Tue Oct 25 00:03:01 2011
@@ -1,0 +1,112 @@
+/* Compute remainder and a congruent to the quotient.
+   Copyright (C) 1997, 2011 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <math.h>
+
+#include "math_private.h"
+
+
+static const double zero = 0.0;
+
+
+double
+__remquo (double x, double y, int *quo)
+{
+  int64_t hx, hy;
+  uint64_t sx, qs;
+  int cquo;
+
+  EXTRACT_WORDS64 (hx, x);
+  EXTRACT_WORDS64 (hy, y);
+  sx = hx & UINT64_C(0x8000000000000000);
+  qs = sx ^ (hy & UINT64_C(0x8000000000000000));
+  hy &= UINT64_C(0x7fffffffffffffff);
+  hx &= UINT64_C(0x7fffffffffffffff);
+
+  /* Purge off exception values.  */
+  if (__builtin_expect (hy == 0, 0))
+    return (x * y) / (x * y);			/* y = 0 */
+  if (__builtin_expect (hx >= UINT64_C(0x7ff0000000000000) /* x not finite */
+			|| hy > UINT64_C(0x7ff0000000000000), 0))/* y is NaN */
+    return (x * y) / (x * y);
+
+  if (hy <= UINT64_C(0x7fbfffffffffffff))
+    x = __ieee754_fmod (x, 8 * y);		/* now x < 8y */
+
+  if (__builtin_expect (hx == hy, 0))
+    {
+      *quo = qs ? -1 : 1;
+      return zero * x;
+    }
+
+  INSERT_WORDS64 (x, hx);
+  INSERT_WORDS64 (y, hy);
+  cquo = 0;
+
+  if (x >= 4 * y)
+    {
+      x -= 4 * y;
+      cquo += 4;
+    }
+  if (x >= 2 * y)
+    {
+      x -= 2 * y;
+      cquo += 2;
+    }
+
+  if (hy < UINT64_C(0x0020000000000000))
+    {
+      if (x + x > y)
+	{
+	  x -= y;
+	  ++cquo;
+	  if (x + x >= y)
+	    {
+	      x -= y;
+	      ++cquo;
+	    }
+	}
+    }
+  else
+    {
+      double y_half = 0.5 * y;
+      if (x > y_half)
+	{
+	  x -= y;
+	  ++cquo;
+	  if (x >= y_half)
+	    {
+	      x -= y;
+	      ++cquo;
+	    }
+	}
+    }
+
+  *quo = qs ? -cquo : cquo;
+
+  if (sx)
+    x = -x;
+  return x;
+}
+weak_alias (__remquo, remquo)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__remquo, __remquol)
+weak_alias (__remquo, remquol)
+#endif

Modified: fsf/trunk/libc/wcsmbs/wcslen.c
==============================================================================
--- fsf/trunk/libc/wcsmbs/wcslen.c (original)
+++ fsf/trunk/libc/wcsmbs/wcslen.c Tue Oct 25 00:03:01 2011
@@ -20,12 +20,12 @@
 #include <wchar.h>
 
 /* Return length of string S.  */
-#ifndef WCSLEN
-# define WCSLEN __wcslen
+#ifdef WCSLEN
+# define __wcslen WCSLEN
 #endif
 
 size_t
-WCSLEN (s)
+__wcslen (s)
      const wchar_t *s;
 {
   size_t len = 0;

_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits