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

[Commits] r16641 - in /fsf/trunk/libc: ./ math/bits/ nptl/ nptl/sysdeps/pthread/ sysdeps/ieee754/dbl-64/ sysdeps/ieee754/dbl-64/wordsi...



Author: eglibc
Date: Thu Jan 12 00:02:05 2012
New Revision: 16641

Log:
Import glibc-mainline for 2012-01-12

Added:
    fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_modf.c
    fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_scalbln.c
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/NEWS
    fsf/trunk/libc/math/bits/math-finite.h
    fsf/trunk/libc/math/bits/mathcalls.h
    fsf/trunk/libc/nptl/ChangeLog
    fsf/trunk/libc/nptl/forward.c
    fsf/trunk/libc/nptl/pthreadP.h
    fsf/trunk/libc/nptl/sysdeps/pthread/pthread-functions.h
    fsf/trunk/libc/nptl/sysdeps/pthread/pthread.h
    fsf/trunk/libc/sysdeps/ieee754/dbl-64/s_modf.c
    fsf/trunk/libc/sysdeps/ieee754/dbl-64/s_scalbln.c
    fsf/trunk/libc/sysdeps/ieee754/dbl-64/s_scalbn.c
    fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_scalbn.c
    fsf/trunk/libc/sysdeps/ieee754/flt-32/s_modff.c
    fsf/trunk/libc/sysdeps/ieee754/flt-32/s_scalblnf.c
    fsf/trunk/libc/sysdeps/ieee754/flt-32/s_scalbnf.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_modfl.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_scalblnl.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_scalbnl.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Thu Jan 12 00:02:05 2012
@@ -1,3 +1,27 @@
+2012-01-11  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	* sysdeps/ieee754/dbl-64/s_scalbln.c: Add branch prediction.
+	* sysdeps/ieee754/flt-32/s_scalblnf.c: Likewise.
+	* sysdeps/ieee754/ldbl-96/s_scalblnl.c: Likewise.
+	* sysdeps/ieee754/dbl-64/wordsize-64/s_scalbln.c: New file.
+
+2012-01-10  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	* sysdeps/ieee754/dbl-64/wordsize-64/s_modf.c: New file.
+
+	* sysdeps/ieee754/dbl-64/s_modf.c: Add branch prediction.
+	* sysdeps/ieee754/flt-32/s_modff.c: Likewise.
+	* sysdeps/ieee754/ldbl-96/s_modfl.c: Likewise.
+
+	* math/bits/mathcalls.h: Add const attribute to fmin and fmax.
+
+	* sysdeps/ieee754/dbl-64/s_scalbn.c: Add branch prediction.
+	* sysdeps/ieee754/flt-32/s_scalbnf.c: Likewise.
+	* sysdeps/ieee754/ldbl-96/s_scalbnl.c: Likewise.
+	* sysdeps/ieee754/dbl-64/wordsize-64/s_scalbn.c: New file.
+
+	* math/bits/math-finite.h: Add ldexp support.
+
 2012-01-10  Marek Polacek  <polacek@xxxxxxxxxx>
 
 	* locale/programs/localedef.h (show_archive_content): Add noreturn

Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Thu Jan 12 00:02:05 2012
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes.  2012-1-8
+GNU C Library NEWS -- history of user-visible changes.  2012-1-10
 Copyright (C) 1992-2009, 2010, 2011, 2012 Free Software Foundation, Inc.
 See the end for copying conditions.
 
@@ -38,6 +38,9 @@
 * Remove support for anything but ELF binary format
 
 * Checking versions of poll, ppoll added.
+  Implemented by Ulrich Drepper.
+
+* More generic and 64-bit performance optimizations to math functions.
   Implemented by Ulrich Drepper.
 
 Version 2.15

Modified: fsf/trunk/libc/math/bits/math-finite.h
==============================================================================
--- fsf/trunk/libc/math/bits/math-finite.h (original)
+++ fsf/trunk/libc/math/bits/math-finite.h Thu Jan 12 00:02:05 2012
@@ -1,5 +1,5 @@
 /* Entry points to finite-math-only compiler runs.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011, 2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -261,6 +261,13 @@
 # endif
 #endif
 
+/* ldexp.  */
+extern double __REDIRECT_NTH (ldexp, (double, int), scalbn);
+extern float __REDIRECT_NTH (ldexpf, (float, int), scalbnf);
+#ifdef __MATH_DECLARE_LDOUBLE
+extern long double __REDIRECT_NTH (ldexpl, (long double, int), scalbnl);
+#endif
+
 /* pow.  */
 extern double __REDIRECT_NTH (pow, (double, double), __pow_finite);
 extern float __REDIRECT_NTH (powf, (float, float), __powf_finite);

Modified: fsf/trunk/libc/math/bits/mathcalls.h
==============================================================================
--- fsf/trunk/libc/math/bits/mathcalls.h (original)
+++ fsf/trunk/libc/math/bits/mathcalls.h Thu Jan 12 00:02:05 2012
@@ -337,10 +337,10 @@
 __MATHCALL (fdim,, (_Mdouble_ __x, _Mdouble_ __y));
 
 /* Return maximum numeric value from X and Y.  */
-__MATHCALL (fmax,, (_Mdouble_ __x, _Mdouble_ __y));
+__MATHCALLX (fmax,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
 
 /* Return minimum numeric value from X and Y.  */
-__MATHCALL (fmin,, (_Mdouble_ __x, _Mdouble_ __y));
+__MATHCALLX (fmin,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
 
 
 /* Classify given number.  */

Modified: fsf/trunk/libc/nptl/ChangeLog
==============================================================================
--- fsf/trunk/libc/nptl/ChangeLog (original)
+++ fsf/trunk/libc/nptl/ChangeLog Thu Jan 12 00:02:05 2012
@@ -1,3 +1,16 @@
+2012-01-11  Marek Polacek  <polacek@xxxxxxxxxx>
+
+	* forward.c (FORWARD_NORETURN): Define macro.
+	(__pthread_unwind): Use FORWARD_NORETURN macro to avoid warning.
+	(__pthread_exit): Likewise.
+
+2012-01-10  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	* sysdeps/pthread/pthread.h: Add const attribute to pthread_equal.
+
+	* pthreadP.h: Add noreturn to __pthread_exit.
+	* sysdeps/pthread/pthread-functions.h: Likewise for ptr___pthread_exit.
+
 2011-12-30  Adhemerval Zanella  <azanella@xxxxxxxxxxxxxxxxxx>
 
 	* sysdeps/unix/sysv/linux/aio_misc.h (__aio_create_helper_thread):

Modified: fsf/trunk/libc/nptl/forward.c
==============================================================================
--- fsf/trunk/libc/nptl/forward.c (original)
+++ fsf/trunk/libc/nptl/forward.c Thu Jan 12 00:02:05 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2007, 2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
 
@@ -42,6 +42,17 @@
   return PTHFCT_CALL (ptr_##name, params);				      \
 }
 
+/* Same as FORWARD2, only without return.  */
+#define FORWARD_NORETURN(name, rettype, decl, params, defaction) \
+rettype									      \
+name decl								      \
+{									      \
+  if (!__libc_pthread_functions_init)					      \
+    defaction;								      \
+									      \
+  PTHFCT_CALL (ptr_##name, params);					      \
+}
+
 #define FORWARD(name, decl, params, defretval) \
   FORWARD2 (name, int, decl, params, return defretval)
 
@@ -160,8 +171,8 @@
 	 (thread1, thread2), 1)
 
 
-/* Use an alias to avoid warning, as pthread_exit is declared noreturn.  */
-FORWARD2 (__pthread_exit, void, (void *retval), (retval), exit (EXIT_SUCCESS))
+FORWARD_NORETURN (__pthread_exit, void, (void *retval), (retval),
+		  exit (EXIT_SUCCESS))
 strong_alias (__pthread_exit, pthread_exit);
 
 
@@ -192,8 +203,7 @@
 
 FORWARD (pthread_setcanceltype, (int type, int *oldtype), (type, oldtype), 0)
 
-#define return /* value is void */
-FORWARD2(__pthread_unwind,
+FORWARD_NORETURN(__pthread_unwind,
 	 void attribute_hidden __attribute ((noreturn)) __cleanup_fct_attribute
 	 attribute_compat_text_section,
 	 (__pthread_unwind_buf_t *buf), (buf), {
@@ -201,4 +211,3 @@
 		       INTERNAL_SYSCALL_DECL (err);
 		       INTERNAL_SYSCALL (kill, err, 1, SIGKILL);
 		     })
-#undef return

Modified: fsf/trunk/libc/nptl/pthreadP.h
==============================================================================
--- fsf/trunk/libc/nptl/pthreadP.h (original)
+++ fsf/trunk/libc/nptl/pthreadP.h Thu Jan 12 00:02:05 2012
@@ -501,7 +501,7 @@
 extern pthread_t __pthread_self (void);
 extern int __pthread_equal (pthread_t thread1, pthread_t thread2);
 extern int __pthread_kill (pthread_t threadid, int signo);
-extern void __pthread_exit (void *value);
+extern void __pthread_exit (void *value) __attribute__ ((__noreturn__));
 extern int __pthread_setcanceltype (int type, int *oldtype);
 extern int __pthread_enable_asynccancel (void) attribute_hidden;
 extern void __pthread_disable_asynccancel (int oldtype)

Modified: fsf/trunk/libc/nptl/sysdeps/pthread/pthread-functions.h
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/pthread/pthread-functions.h (original)
+++ fsf/trunk/libc/nptl/sysdeps/pthread/pthread-functions.h Thu Jan 12 00:02:05 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2005, 2006, 2007, 2011 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2007, 2011, 2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2003.
 
@@ -66,7 +66,7 @@
 					   pthread_mutex_t *,
 					   const struct timespec *);
   int (*ptr_pthread_equal) (pthread_t, pthread_t);
-  void (*ptr___pthread_exit) (void *);
+  void (*ptr___pthread_exit) (void *) __attribute__ ((__noreturn__));
   int (*ptr_pthread_getschedparam) (pthread_t, int *, struct sched_param *);
   int (*ptr_pthread_setschedparam) (pthread_t, int,
 				    const struct sched_param *);

Modified: fsf/trunk/libc/nptl/sysdeps/pthread/pthread.h
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/pthread/pthread.h (original)
+++ fsf/trunk/libc/nptl/sysdeps/pthread/pthread.h Thu Jan 12 00:02:05 2012
@@ -266,7 +266,8 @@
 extern pthread_t pthread_self (void) __THROW __attribute__ ((__const__));
 
 /* Compare two thread identifiers.  */
-extern int pthread_equal (pthread_t __thread1, pthread_t __thread2) __THROW;
+extern int pthread_equal (pthread_t __thread1, pthread_t __thread2)
+  __THROW __attribute__ ((__const__));
 
 
 /* Thread attribute handling.  */

Modified: fsf/trunk/libc/sysdeps/ieee754/dbl-64/s_modf.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/dbl-64/s_modf.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/dbl-64/s_modf.c Thu Jan 12 00:02:05 2012
@@ -1,4 +1,3 @@
-/* @(#)s_modf.c 5.1 93/09/24 */
 /*
  * ====================================================
  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
@@ -9,10 +8,6 @@
  * is preserved.
  * ====================================================
  */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: s_modf.c,v 1.8 1995/05/10 20:47:55 jtc Exp $";
-#endif
 
 /*
  * modf(double x, double *iptr)
@@ -27,18 +22,10 @@
 #include "math.h"
 #include "math_private.h"
 
-#ifdef __STDC__
 static const double one = 1.0;
-#else
-static double one = 1.0;
-#endif
 
-#ifdef __STDC__
-	double __modf(double x, double *iptr)
-#else
-	double __modf(x, iptr)
-	double x,*iptr;
-#endif
+double
+__modf(double x, double *iptr)
 {
 	int32_t i0,i1,j0;
 	u_int32_t i;
@@ -46,7 +33,7 @@
 	j0 = ((i0>>20)&0x7ff)-0x3ff;	/* exponent of x */
 	if(j0<20) {			/* integer part in high x */
 	    if(j0<0) {			/* |x|<1 */
-	        INSERT_WORDS(*iptr,i0&0x80000000,0);	/* *iptr = +-0 */
+		INSERT_WORDS(*iptr,i0&0x80000000,0);	/* *iptr = +-0 */
 		return x;
 	    } else {
 		i = (0x000fffff)>>j0;
@@ -59,7 +46,7 @@
 		    return x - *iptr;
 		}
 	    }
-	} else if (j0>51) {		/* no fraction part */
+	} else if (__builtin_expect(j0>51, 0)) { /* no fraction part */
 	    *iptr = x*one;
 	    /* We must handle NaNs separately.  */
 	    if (j0 == 0x400 && ((i0 & 0xfffff) | i1))
@@ -73,7 +60,7 @@
 		INSERT_WORDS(x,i0&0x80000000,0);	/* return +-0 */
 		return x;
 	    } else {
-	        INSERT_WORDS(*iptr,i0,i1&(~i));
+		INSERT_WORDS(*iptr,i0,i1&(~i));
 		return x - *iptr;
 	    }
 	}

Modified: fsf/trunk/libc/sysdeps/ieee754/dbl-64/s_scalbln.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/dbl-64/s_scalbln.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/dbl-64/s_scalbln.c Thu Jan 12 00:02:05 2012
@@ -1,4 +1,3 @@
-/* @(#)s_scalbn.c 5.1 93/09/24 */
 /*
  * ====================================================
  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
@@ -10,10 +9,6 @@
  * ====================================================
  */
 
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: s_scalbn.c,v 1.8 1995/05/10 20:48:08 jtc Exp $";
-#endif
-
 /*
  * scalbn (double x, int n)
  * scalbn(x,n) returns x* 2**n  computed by  exponent
@@ -24,44 +19,37 @@
 #include "math.h"
 #include "math_private.h"
 
-#ifdef __STDC__
 static const double
-#else
-static double
-#endif
 two54   =  1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
 twom54  =  5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */
 huge   = 1.0e+300,
 tiny   = 1.0e-300;
 
-#ifdef __STDC__
-	double __scalbln (double x, long int n)
-#else
-	double __scalbln (x,n)
-	double x; long int n;
-#endif
+double
+__scalbln (double x, long int n)
 {
 	int32_t k,hx,lx;
 	EXTRACT_WORDS(hx,lx,x);
-        k = (hx&0x7ff00000)>>20;		/* extract exponent */
-        if (k==0) {				/* 0 or subnormal x */
-            if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
+	k = (hx&0x7ff00000)>>20;		/* extract exponent */
+	if (__builtin_expect(k==0, 0)) {	/* 0 or subnormal x */
+	    if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
 	    x *= two54;
 	    GET_HIGH_WORD(hx,x);
 	    k = ((hx&0x7ff00000)>>20) - 54;
 	    }
-        if (k==0x7ff) return x+x;		/* NaN or Inf */
-        k = k+n;
-        if (n> 50000 || k >  0x7fe)
+	if (__builtin_expect(k==0x7ff, 0)) return x+x;	/* NaN or Inf */
+	k = k+n;
+	if (__builtin_expect(n> 50000 || k >  0x7fe, 0))
 	  return huge*__copysign(huge,x); /* overflow  */
-	if (n< -50000) return tiny*__copysign(tiny,x); /*underflow*/
-        if (k > 0) 				/* normal result */
+	if (__builtin_expect(n< -50000, 0))
+	  return tiny*__copysign(tiny,x); /*underflow*/
+	if (__builtin_expect(k > 0, 1))		/* normal result */
 	    {SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); return x;}
-        if (k <= -54)
+	if (k <= -54)
 	  return tiny*__copysign(tiny,x); 	/*underflow*/
-        k += 54;				/* subnormal result */
+	k += 54;				/* subnormal result */
 	SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20));
-        return x*twom54;
+	return x*twom54;
 }
 weak_alias (__scalbln, scalbln)
 #ifdef NO_LONG_DOUBLE

Modified: fsf/trunk/libc/sysdeps/ieee754/dbl-64/s_scalbn.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/dbl-64/s_scalbn.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/dbl-64/s_scalbn.c Thu Jan 12 00:02:05 2012
@@ -1,4 +1,3 @@
-/* @(#)s_scalbn.c 5.1 93/09/24 */
 /*
  * ====================================================
  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
@@ -10,10 +9,6 @@
  * ====================================================
  */
 
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: s_scalbn.c,v 1.8 1995/05/10 20:48:08 jtc Exp $";
-#endif
-
 /*
  * scalbn (double x, int n)
  * scalbn(x,n) returns x* 2**n  computed by  exponent
@@ -24,44 +19,37 @@
 #include "math.h"
 #include "math_private.h"
 
-#ifdef __STDC__
 static const double
-#else
-static double
-#endif
 two54   =  1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
 twom54  =  5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */
 huge   = 1.0e+300,
 tiny   = 1.0e-300;
 
-#ifdef __STDC__
-	double __scalbn (double x, int n)
-#else
-	double __scalbn (x,n)
-	double x; int n;
-#endif
+double
+__scalbn (double x, int n)
 {
 	int32_t k,hx,lx;
 	EXTRACT_WORDS(hx,lx,x);
-        k = (hx&0x7ff00000)>>20;		/* extract exponent */
-        if (k==0) {				/* 0 or subnormal x */
-            if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
+	k = (hx&0x7ff00000)>>20;		/* extract exponent */
+	if (__builtin_expect(k==0, 0)) {	/* 0 or subnormal x */
+	    if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
 	    x *= two54;
 	    GET_HIGH_WORD(hx,x);
 	    k = ((hx&0x7ff00000)>>20) - 54;
 	    }
-        if (k==0x7ff) return x+x;		/* NaN or Inf */
-        k = k+n;
-        if (n> 50000 || k >  0x7fe)
+	if (__builtin_expect(k==0x7ff, 0)) return x+x;	/* NaN or Inf */
+	k = k+n;
+	if (__builtin_expect(n> 50000 || k >  0x7fe, 0))
 	  return huge*__copysign(huge,x); /* overflow  */
-	if (n< -50000) return tiny*__copysign(tiny,x); /*underflow*/
-        if (k > 0) 				/* normal result */
+	if (__builtin_expect(n< -50000, 0))
+	  return tiny*__copysign(tiny,x); /*underflow*/
+	if (__builtin_expect(k > 0, 1))		/* normal result */
 	    {SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); return x;}
-        if (k <= -54)
+	if (k <= -54)
 	  return tiny*__copysign(tiny,x); 	/*underflow*/
-        k += 54;				/* subnormal result */
+	k += 54;				/* subnormal result */
 	SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20));
-        return x*twom54;
+	return x*twom54;
 }
 weak_alias (__scalbn, scalbn)
 #ifdef NO_LONG_DOUBLE

Added: fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_modf.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_modf.c (added)
+++ fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_modf.c Thu Jan 12 00:02:05 2012
@@ -1,0 +1,65 @@
+/* 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.
+ * ====================================================
+ */
+
+/*
+ * modf(double x, double *iptr)
+ * return fraction part of x, and return x's integral part in *iptr.
+ * Method:
+ *	Bit twiddling.
+ *
+ * Exception:
+ *	No exception.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+static const double one = 1.0;
+
+double
+__modf(double x, double *iptr)
+{
+	int64_t i0;
+	int32_t j0;
+	EXTRACT_WORDS64(i0,x);
+	j0 = ((i0>>52)&0x7ff)-0x3ff;	/* exponent of x */
+	if(j0<52) {			/* integer part in x */
+	    if(j0<0) {			/* |x|<1 */
+		/* *iptr = +-0 */
+		INSERT_WORDS64(*iptr,i0&UINT64_C(0x8000000000000000));
+		return x;
+	    } else {
+		uint64_t i = UINT64_C(0x000fffffffffffff)>>j0;
+		if((i0&i)==0) {		/* x is integral */
+		    *iptr = x;
+		    /* return +-0 */
+		    INSERT_WORDS64(x,i0&UINT64_C(0x8000000000000000));
+		    return x;
+		} else {
+		    INSERT_WORDS64(*iptr,i0&(~i));
+		    return x - *iptr;
+		}
+	    }
+	} else { /* no fraction part */
+	    *iptr = x*one;
+	    /* We must handle NaNs separately.  */
+	    if (j0 == 0x400 && (i0 & UINT64_C(0xfffffffffffff)))
+	      return x*one;
+	    INSERT_WORDS64(x,i0&UINT64_C(0x8000000000000000));	/* return +-0 */
+	    return x;
+	}
+}
+weak_alias (__modf, modf)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__modf, __modfl)
+weak_alias (__modf, modfl)
+#endif

Added: fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_scalbln.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_scalbln.c (added)
+++ fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_scalbln.c Thu Jan 12 00:02:05 2012
@@ -1,0 +1,60 @@
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+/*
+ * scalbn (double x, int n)
+ * scalbn(x,n) returns x* 2**n  computed by  exponent
+ * manipulation rather than by actually performing an
+ * exponentiation or a multiplication.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+static const double
+two54   =  1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
+twom54  =  5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */
+huge   = 1.0e+300,
+tiny   = 1.0e-300;
+
+double
+__scalbln (double x, long int n)
+{
+	int64_t ix;
+	int64_t k;
+	EXTRACT_WORDS64(ix,x);
+	k = (ix >> 52) & 0x7ff;			/* extract exponent */
+	if (__builtin_expect(k==0, 0)) {	/* 0 or subnormal x */
+	    if ((ix & UINT64_C(0xfffffffffffff))==0) return x; /* +-0 */
+	    x *= two54;
+	    EXTRACT_WORDS64(ix,x);
+	    k = ((ix >> 52) & 0x7ff) - 54;
+	    }
+	if (__builtin_expect(k==0x7ff, 0)) return x+x;	/* NaN or Inf */
+	k = k+n;
+	if (__builtin_expect(n> 50000 || k >  0x7fe, 0))
+	  return huge*__copysign(huge,x); /* overflow  */
+	if (__builtin_expect(n< -50000, 0))
+	  return tiny*__copysign(tiny,x); /*underflow*/
+	if (__builtin_expect(k > 0, 1))		/* normal result */
+	    {INSERT_WORDS64(x,(ix&UINT64_C(0x800fffffffffffff))|(k<<52));
+	      return x;}
+	if (k <= -54)
+	  return tiny*__copysign(tiny,x);	/*underflow*/
+	k += 54;				/* subnormal result */
+	INSERT_WORDS64(x,(ix&INT64_C(0x800fffffffffffff))|(k<<52));
+	return x*twom54;
+}
+weak_alias (__scalbln, scalbln)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__scalbln, __scalblnl)
+weak_alias (__scalbln, scalblnl)
+#endif

Modified: fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_scalbn.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_scalbn.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_scalbn.c Thu Jan 12 00:02:05 2012
@@ -1,4 +1,3 @@
-/* @(#)s_scalbn.c 5.1 93/09/24 */
 /*
  * ====================================================
  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
@@ -20,39 +19,32 @@
 #include "math.h"
 #include "math_private.h"
 
-#ifdef __STDC__
 static const double
-#else
-static double
-#endif
 two54   =  1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
 twom54  =  5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */
 huge   = 1.0e+300,
 tiny   = 1.0e-300;
 
-#ifdef __STDC__
-	double __scalbn (double x, int n)
-#else
-	double __scalbn (x,n)
-	double x; int n;
-#endif
+double
+__scalbn (double x, int n)
 {
 	int64_t ix;
 	int64_t k;
 	EXTRACT_WORDS64(ix,x);
 	k = (ix >> 52) & 0x7ff;			/* extract exponent */
-	if (k==0) {				/* 0 or subnormal x */
+	if (__builtin_expect(k==0, 0)) {	/* 0 or subnormal x */
 	    if ((ix & UINT64_C(0xfffffffffffff))==0) return x; /* +-0 */
 	    x *= two54;
 	    EXTRACT_WORDS64(ix,x);
 	    k = ((ix >> 52) & 0x7ff) - 54;
 	    }
-	if (k==0x7ff) return x+x;		/* NaN or Inf */
+	if (__builtin_expect(k==0x7ff, 0)) return x+x;	/* NaN or Inf */
 	k = k+n;
-	if (n> 50000 || k >  0x7fe)
+	if (__builtin_expect(n> 50000 || k >  0x7fe, 0))
 	  return huge*__copysign(huge,x); /* overflow  */
-	if (n< -50000) return tiny*__copysign(tiny,x); /*underflow*/
-	if (k > 0)				/* normal result */
+	if (__builtin_expect(n< -50000, 0))
+	  return tiny*__copysign(tiny,x); /*underflow*/
+	if (__builtin_expect(k > 0, 1))		/* normal result */
 	    {INSERT_WORDS64(x,(ix&UINT64_C(0x800fffffffffffff))|(k<<52));
 	      return x;}
 	if (k <= -54)

Modified: fsf/trunk/libc/sysdeps/ieee754/flt-32/s_modff.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/flt-32/s_modff.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/flt-32/s_modff.c Thu Jan 12 00:02:05 2012
@@ -13,33 +13,21 @@
  * ====================================================
  */
 
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: s_modff.c,v 1.4 1995/05/10 20:47:56 jtc Exp $";
-#endif
-
 #include "math.h"
 #include "math_private.h"
 
-#ifdef __STDC__
 static const float one = 1.0;
-#else
-static float one = 1.0;
-#endif
 
-#ifdef __STDC__
-	float __modff(float x, float *iptr)
-#else
-	float __modff(x, iptr)
-	float x,*iptr;
-#endif
+float
+__modff(float x, float *iptr)
 {
 	int32_t i0,j0;
 	u_int32_t i;
 	GET_FLOAT_WORD(i0,x);
 	j0 = ((i0>>23)&0xff)-0x7f;	/* exponent of x */
-	if(j0<23) {			/* integer part in x */
+	if(__builtin_expect(j0<23, 1)) {		/* integer part in x */
 	    if(j0<0) {			/* |x|<1 */
-	        SET_FLOAT_WORD(*iptr,i0&0x80000000);	/* *iptr = +-0 */
+		SET_FLOAT_WORD(*iptr,i0&0x80000000);	/* *iptr = +-0 */
 		return x;
 	    } else {
 		i = (0x007fffff)>>j0;

Modified: fsf/trunk/libc/sysdeps/ieee754/flt-32/s_scalblnf.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/flt-32/s_scalblnf.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/flt-32/s_scalblnf.c Thu Jan 12 00:02:05 2012
@@ -13,51 +13,39 @@
  * ====================================================
  */
 
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: s_scalbnf.c,v 1.4 1995/05/10 20:48:10 jtc Exp $";
-#endif
-
 #include "math.h"
 #include "math_private.h"
 
-#ifdef __STDC__
 static const float
-#else
-static float
-#endif
 two25   =  3.355443200e+07,	/* 0x4c000000 */
 twom25  =  2.9802322388e-08,	/* 0x33000000 */
 huge   = 1.0e+30,
 tiny   = 1.0e-30;
 
-#ifdef __STDC__
-	float __scalblnf (float x, long int n)
-#else
-	float __scalblnf (x,n)
-	float x; long int n;
-#endif
+float
+__scalblnf (float x, long int n)
 {
 	int32_t k,ix;
 	GET_FLOAT_WORD(ix,x);
-        k = (ix&0x7f800000)>>23;		/* extract exponent */
-        if (k==0) {				/* 0 or subnormal x */
-            if ((ix&0x7fffffff)==0) return x; /* +-0 */
+	k = (ix&0x7f800000)>>23;		/* extract exponent */
+	if (__builtin_expect(k==0, 0)) {	/* 0 or subnormal x */
+	    if ((ix&0x7fffffff)==0) return x; /* +-0 */
 	    x *= two25;
 	    GET_FLOAT_WORD(ix,x);
 	    k = ((ix&0x7f800000)>>23) - 25;
 	    }
-        if (k==0xff) return x+x;		/* NaN or Inf */
-        k = k+n;
-        if (n> 50000 || k >  0xfe)
+	if (__builtin_expect(k==0xff, 0)) return x+x;	/* NaN or Inf */
+	k = k+n;
+	if (__builtin_expect(n> 50000 || k >  0xfe, 0))
 	  return huge*copysignf(huge,x); /* overflow  */
-	if (n< -50000)
+	if (__builtin_expect(n< -50000, 0))
 	  return tiny*copysignf(tiny,x);	/*underflow*/
-        if (k > 0) 				/* normal result */
+	if (__builtin_expect(k > 0, 1))		/* normal result */
 	    {SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23)); return x;}
-        if (k <= -25)
+	if (k <= -25)
 	    return tiny*copysignf(tiny,x);	/*underflow*/
-        k += 25;				/* subnormal result */
+	k += 25;				/* subnormal result */
 	SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23));
-        return x*twom25;
+	return x*twom25;
 }
 weak_alias (__scalblnf, scalblnf)

Modified: fsf/trunk/libc/sysdeps/ieee754/flt-32/s_scalbnf.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/flt-32/s_scalbnf.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/flt-32/s_scalbnf.c Thu Jan 12 00:02:05 2012
@@ -13,51 +13,39 @@
  * ====================================================
  */
 
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: s_scalbnf.c,v 1.4 1995/05/10 20:48:10 jtc Exp $";
-#endif
-
 #include "math.h"
 #include "math_private.h"
 
-#ifdef __STDC__
 static const float
-#else
-static float
-#endif
 two25   =  3.355443200e+07,	/* 0x4c000000 */
 twom25  =  2.9802322388e-08,	/* 0x33000000 */
 huge   = 1.0e+30,
 tiny   = 1.0e-30;
 
-#ifdef __STDC__
-	float __scalbnf (float x, int n)
-#else
-	float __scalbnf (x,n)
-	float x; int n;
-#endif
+float
+__scalbnf (float x, int n)
 {
 	int32_t k,ix;
 	GET_FLOAT_WORD(ix,x);
-        k = (ix&0x7f800000)>>23;		/* extract exponent */
-        if (k==0) {				/* 0 or subnormal x */
-            if ((ix&0x7fffffff)==0) return x; /* +-0 */
+	k = (ix&0x7f800000)>>23;		/* extract exponent */
+	if (__builtin_expect(k==0, 0)) {	/* 0 or subnormal x */
+	    if ((ix&0x7fffffff)==0) return x; /* +-0 */
 	    x *= two25;
 	    GET_FLOAT_WORD(ix,x);
 	    k = ((ix&0x7f800000)>>23) - 25;
 	    }
-        if (k==0xff) return x+x;		/* NaN or Inf */
-        k = k+n;
-        if (n> 50000 || k >  0xfe)
+	if (__builtin_expect(k==0xff, 0)) return x+x;	/* NaN or Inf */
+	k = k+n;
+	if (__builtin_expect(n> 50000 || k >  0xfe, 0))
 	  return huge*__copysignf(huge,x); /* overflow  */
-	if (n< -50000)
+	if (__builtin_expect(n< -50000, 0))
 	  return tiny*__copysignf(tiny,x);	/*underflow*/
-        if (k > 0) 				/* normal result */
+	if (__builtin_expect(k > 0, 1))		/* normal result */
 	    {SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23)); return x;}
-        if (k <= -25)
+	if (k <= -25)
 	    return tiny*__copysignf(tiny,x);	/*underflow*/
-        k += 25;				/* subnormal result */
+	k += 25;				/* subnormal result */
 	SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23));
-        return x*twom25;
+	return x*twom25;
 }
 weak_alias (__scalbnf, scalbnf)

Modified: fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_modfl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_modfl.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_modfl.c Thu Jan 12 00:02:05 2012
@@ -14,10 +14,6 @@
  * ====================================================
  */
 
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
 /*
  * modfl(long double x, long double *iptr)
  * return fraction part of x, and return x's integral part in *iptr.
@@ -31,18 +27,10 @@
 #include "math.h"
 #include "math_private.h"
 
-#ifdef __STDC__
 static const long double one = 1.0;
-#else
-static long double one = 1.0;
-#endif
 
-#ifdef __STDC__
-	long double __modfl(long double x, long double *iptr)
-#else
-	long double __modfl(x, iptr)
-	long double x,*iptr;
-#endif
+long double
+__modfl(long double x, long double *iptr)
 {
 	int32_t i0,i1,j0;
 	u_int32_t i,se;
@@ -50,7 +38,7 @@
 	j0 = (se&0x7fff)-0x3fff;	/* exponent of x */
 	if(j0<32) {			/* integer part in high x */
 	    if(j0<0) {			/* |x|<1 */
-	        SET_LDOUBLE_WORDS(*iptr,se&0x8000,0,0);	/* *iptr = +-0 */
+		SET_LDOUBLE_WORDS(*iptr,se&0x8000,0,0);	/* *iptr = +-0 */
 		return x;
 	    } else {
 		i = (0x7fffffff)>>j0;
@@ -63,7 +51,7 @@
 		    return x - *iptr;
 		}
 	    }
-	} else if (j0>63) {		/* no fraction part */
+	} else if (__builtin_expect(j0>63, 0)) { /* no fraction part */
 	    *iptr = x*one;
 	    /* We must handle NaNs separately.  */
 	    if (j0 == 0x4000 && ((i0 & 0x7fffffff) | i1))

Modified: fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_scalblnl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_scalblnl.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_scalblnl.c Thu Jan 12 00:02:05 2012
@@ -14,10 +14,6 @@
  * ====================================================
  */
 
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
 /*
  * scalbnl (long double x, int n)
  * scalbnl(x,n) returns x* 2**n  computed by  exponent
@@ -28,44 +24,36 @@
 #include "math.h"
 #include "math_private.h"
 
-#ifdef __STDC__
 static const long double
-#else
-static long double
-#endif
 two63   =  4.50359962737049600000e+15,
 twom63  =  1.08420217248550443400e-19,
 huge   = 1.0e+4900L,
 tiny   = 1.0e-4900L;
 
-#ifdef __STDC__
-	long double __scalblnl (long double x, long int n)
-#else
-	long double __scalblnl (x,n)
-	long double x; long int n;
-#endif
+long double
+__scalblnl (long double x, long int n)
 {
 	int32_t k,es,hx,lx;
 	GET_LDOUBLE_WORDS(es,hx,lx,x);
-        k = es&0x7fff;				/* extract exponent */
-        if (k==0) {				/* 0 or subnormal x */
-            if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
+	k = es&0x7fff;				/* extract exponent */
+	if (__builtin_expect(k==0, 0)) {	/* 0 or subnormal x */
+	    if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
 	    x *= two63;
 	    GET_LDOUBLE_EXP(es,x);
 	    k = (hx&0x7fff) - 63;
 	    }
-        if (k==0x7fff) return x+x;		/* NaN or Inf */
-        k = k+n;
-        if (n> 50000 || k > 0x7ffe)
+	if (__builtin_expect(k==0x7fff, 0)) return x+x;	/* NaN or Inf */
+	k = k+n;
+	if (__builtin_expect(n> 50000 || k > 0x7ffe, 0))
 	  return huge*__copysignl(huge,x); /* overflow  */
-	if (n< -50000)
+	if (__builtin_expect(n< -50000, 0))
 	  return tiny*__copysignl(tiny,x);
-        if (k > 0) 				/* normal result */
+	if (__builtin_expect(k > 0, 1))		/* normal result */
 	    {SET_LDOUBLE_EXP(x,(es&0x8000)|k); return x;}
-        if (k <= -63)
+	if (k <= -63)
 	    return tiny*__copysignl(tiny,x); 	/*underflow*/
-        k += 63;				/* subnormal result */
+	k += 63;				/* subnormal result */
 	SET_LDOUBLE_EXP(x,(es&0x8000)|k);
-        return x*twom63;
+	return x*twom63;
 }
 weak_alias (__scalblnl, scalblnl)

Modified: fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_scalbnl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_scalbnl.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_scalbnl.c Thu Jan 12 00:02:05 2012
@@ -14,10 +14,6 @@
  * ====================================================
  */
 
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
 /*
  * scalbnl (long double x, int n)
  * scalbnl(x,n) returns x* 2**n  computed by  exponent
@@ -28,44 +24,36 @@
 #include "math.h"
 #include "math_private.h"
 
-#ifdef __STDC__
 static const long double
-#else
-static long double
-#endif
 two64   =  1.8446744073709551616e19L,
 twom64  =  5.421010862427522170037e-20L,
 huge   = 1.0e+4900L,
 tiny   = 1.0e-4900L;
 
-#ifdef __STDC__
-	long double __scalbnl (long double x, int n)
-#else
-	long double __scalbnl (x,n)
-	long double x; int n;
-#endif
+long double
+__scalbnl (long double x, int n)
 {
 	int32_t k,es,hx,lx;
 	GET_LDOUBLE_WORDS(es,hx,lx,x);
-        k = es&0x7fff;				/* extract exponent */
-        if (k==0) {				/* 0 or subnormal x */
-            if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
+	k = es&0x7fff;				/* extract exponent */
+	if (__builtin_expect(k==0, 0)) {	/* 0 or subnormal x */
+	    if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
 	    x *= two64;
 	    GET_LDOUBLE_EXP(hx,x);
 	    k = (hx&0x7fff) - 64;
 	    }
-        if (k==0x7fff) return x+x;		/* NaN or Inf */
-        k = k+n;
-        if (n> 50000 || k > 0x7ffe)
+	if (__builtin_expect(k==0x7fff, 0)) return x+x;	/* NaN or Inf */
+	k = k+n;
+	if (__builtin_expect(n> 50000 || k > 0x7ffe, 0))
 	  return huge*__copysignl(huge,x); /* overflow  */
-	if (n< -50000)
+	if (__builtin_expect(n< -50000, 0))
 	  return tiny*__copysignl(tiny,x);
-        if (k > 0) 				/* normal result */
+	if (__builtin_expect(k > 0, 1))		/* normal result */
 	    {SET_LDOUBLE_EXP(x,(es&0x8000)|k); return x;}
-        if (k <= -64)
+	if (k <= -64)
 	    return tiny*__copysignl(tiny,x); 	/*underflow*/
-        k += 64;				/* subnormal result */
+	k += 64;				/* subnormal result */
 	SET_LDOUBLE_EXP(x,(es&0x8000)|k);
-        return x*twom64;
+	return x*twom64;
 }
 weak_alias (__scalbnl, scalbnl)

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