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

[commits] r8874 - in /fsf/trunk/libc: ./ math/ nptl/ nptl/sysdeps/x86_64/ sysdeps/ieee754/dbl-64/wordsize-64/ sysdeps/x86_64/ sysdeps/...



Author: eglibc
Date: Tue Aug 25 19:13:16 2009
New Revision: 8874

Log:
Import glibc-mainline for 2009-08-25

Added:
    fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c
    fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_scalbn.c
    fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_trunc.c
    fsf/trunk/libc/sysdeps/x86_64/fpu/s_scalbln.c
    fsf/trunk/libc/sysdeps/x86_64/fpu/s_scalbn.c
    fsf/trunk/libc/sysdeps/x86_64/fpu/s_signbit.S
    fsf/trunk/libc/sysdeps/x86_64/fpu/s_signbitf.S
Modified:
    fsf/trunk/libc/CONFORMANCE
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/math/s_fdiml.c
    fsf/trunk/libc/nptl/ChangeLog
    fsf/trunk/libc/nptl/sysdeps/x86_64/tls.h
    fsf/trunk/libc/sysdeps/x86_64/dl-trampoline.S

Modified: fsf/trunk/libc/CONFORMANCE
==============================================================================
--- fsf/trunk/libc/CONFORMANCE (original)
+++ fsf/trunk/libc/CONFORMANCE Tue Aug 25 19:13:16 2009
@@ -125,7 +125,9 @@
 values.  This conflicts with the glibc extension where %as, %a[ and
 %aS mean to allocate the string for the data read.  A strictly
 conforming C99 program using %as, %a[ or %aS in a scanf format string
-will misbehave under glibc.
+will misbehave under glibc if it does not include <stdio.h> and
+instead declares scanf itself; if it gets the declaration of scanf
+from <stdio.h>, it will use a C99-conforming version.
 
 
 Compiler limitations
@@ -144,29 +146,21 @@
 understand the keyword _Complex before GCC 3.0.  This has the
 corresponding impact on the relevant headers.
 
-glibc's use of extern inline conflicts with C99: in C99, extern inline
-means that an external definition is generated as well as possibly an
-inline definition, but in GCC it means that no external definition is
-generated.  When GCC's C99 mode implements C99 inline semantics, this
-will break the uses of extern inline in glibc's headers.  (Actually,
-glibc uses `extern __inline', which is beyond the scope of the
-standard, but it would clearly be very confusing for `__inline' and
-plain `inline' to have different meanings in C99 mode.)
-
 glibc's <tgmath.h> implementation is arcane but thought to work
 correctly; a clean and comprehensible version requires compiler
 builtins.
 
 For most of the headers required of freestanding implementations,
 glibc relies on GCC to provide correct versions.  (At present, glibc
-provides <stdint.h>, and GCC doesn't.)
+provides <stdint.h>, and GCC doesn't before version 4.5.)
 
-Implementing MATH_ERRNO, MATH_ERREXCEPT and math_errhandling in
-<math.h> needs compiler support: see
-
-http://sources.redhat.com/ml/libc-hacker/2000-06/msg00008.html
-http://sources.redhat.com/ml/libc-hacker/2000-06/msg00014.html
-http://sources.redhat.com/ml/libc-hacker/2000-06/msg00015.html
+The definition of math_errhandling conforms so long as no translation
+unit using math_errhandling is compiled with -fno-math-errno,
+-fno-trapping-math or options such as -ffast-math that imply these
+options.  math_errhandling is only conditionally defined depending on
+__FAST_MATH__; the compiler does not provide the information needed
+for more exact definitions based on settings of -fno-math-errno and
+-fno-trapping-math, possibly for only some source files in a program.
 
 
 Issues with headers

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Tue Aug 25 19:13:16 2009
@@ -1,3 +1,23 @@
+2009-08-25  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* math/s_fdiml.c (__fdiml): Use fpclassify instead of fpclassifyl.
+
+2009-08-25  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/x86_64/fpu/s_scalbln.c: New file.
+	* sysdeps/x86_64/fpu/s_scalbn.c: New file.
+
+	* sysdeps/ieee754/dbl-64/wordsize-64/s_scalbn.c: New file.
+
+	* sysdeps/x86_64/fpu/s_signbit.S: New file.
+	* sysdeps/x86_64/fpu/s_signbitf.S: New file.
+
+	* sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c: New file.
+	* sysdeps/ieee754/dbl-64/wordsize-64/s_trunc.c: New file.
+
+	* sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): Remove
+	leftover YMM_SIZE definition.
+
 2009-08-24  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* math/math_private.h (ieee_double_shape_type): Add uint64_t word to

Modified: fsf/trunk/libc/math/s_fdiml.c
==============================================================================
--- fsf/trunk/libc/math/s_fdiml.c (original)
+++ fsf/trunk/libc/math/s_fdiml.c Tue Aug 25 19:13:16 2009
@@ -24,8 +24,8 @@
 long double
 __fdiml (long double x, long double y)
 {
-  int clsx = fpclassifyl (x);
-  int clsy = fpclassifyl (y);
+  int clsx = fpclassify (x);
+  int clsy = fpclassify (y);
 
   if (clsx == FP_NAN || clsy == FP_NAN
       || (y < 0 && clsx == FP_INFINITE && clsy == FP_INFINITE))

Modified: fsf/trunk/libc/nptl/ChangeLog
==============================================================================
--- fsf/trunk/libc/nptl/ChangeLog (original)
+++ fsf/trunk/libc/nptl/ChangeLog Tue Aug 25 19:13:16 2009
@@ -1,3 +1,10 @@
+2009-08-25  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/x86_64/tls.h (RTLD_ENABLE_FOREIGN_CALL): Store old value
+	of the field in local variables.
+	(RTLD_FINALIZE_FOREIGN_CALL): Restore rtld_must_xmm_save from local
+	variable and don't unconditionally clear it.
+
 2009-08-24  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* pthread_create.c (start_thread): Hint to the kernel that memory for

Modified: fsf/trunk/libc/nptl/sysdeps/x86_64/tls.h
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/x86_64/tls.h (original)
+++ fsf/trunk/libc/nptl/sysdeps/x86_64/tls.h Tue Aug 25 19:13:16 2009
@@ -188,7 +188,7 @@
 
    The contained asm must *not* be marked volatile since otherwise
    assignments like
-        pthread_descr self = thread_self();
+	pthread_descr self = thread_self();
    do not get optimized away.  */
 # define THREAD_SELF \
   ({ struct pthread *__self;						      \
@@ -404,7 +404,12 @@
 # define RTLD_CHECK_FOREIGN_CALL \
   (THREAD_GETMEM (THREAD_SELF, header.rtld_must_xmm_save) != 0)
 
+/* NB: Don't use the xchg operation because that would imply a lock
+   prefix which is expensive and unnecessary.  The cache line is also
+   not contested at all.  */
 #  define RTLD_ENABLE_FOREIGN_CALL \
+  int old_rtld_must_xmm_save = THREAD_GETMEM (THREAD_SELF,		      \
+					      header.rtld_must_xmm_save);     \
   THREAD_SETMEM (THREAD_SELF, header.rtld_must_xmm_save, 1)
 
 #  define RTLD_PREPARE_FOREIGN_CALL \
@@ -419,7 +424,8 @@
   do {									      \
     if (THREAD_GETMEM (THREAD_SELF, header.rtld_must_xmm_save) == 0)	      \
       _dl_x86_64_restore_sse ();					      \
-    THREAD_SETMEM (THREAD_SELF, header.rtld_must_xmm_save, 0);		      \
+    THREAD_SETMEM (THREAD_SELF, header.rtld_must_xmm_save,		      \
+		   old_rtld_must_xmm_save);				      \
   } while (0)
 # endif
 

Added: fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c (added)
+++ fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c Tue Aug 25 19:13:16 2009
@@ -1,0 +1,67 @@
+/* Round double value to long int.
+   Copyright (C) 1997, 2004, 2009 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"
+
+
+long int
+__lround (double x)
+{
+  int32_t j0;
+  int64_t i0;
+  long int result;
+  int sign;
+
+  EXTRACT_WORDS64 (i0, x);
+  j0 = ((i0 >> 52) & 0x7ff) - 0x3ff;
+  sign = i0 < 0 ? -1 : 1;
+  i0 &= UINT64_C(0xfffffffffffff);
+  i0 |= UINT64_C(0x10000000000000);
+
+  if (j0 < (int32_t) (8 * sizeof (long int)) - 1)
+    {
+      if (j0 < 0)
+	return j0 < -1 ? 0 : sign;
+      else if (j0 >= 52)
+	result = i0 << (j0 - 52);
+      else
+	{
+	  i0 += UINT64_C(0x8000000000000) >> j0;
+
+	  result = i0 >> (52 - j0);
+	}
+    }
+  else
+    {
+      /* The number is too large.  It is left implementation defined
+	 what happens.  */
+      return (long int) x;
+    }
+
+  return sign * result;
+}
+
+weak_alias (__lround, lround)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__lround, __lroundl)
+weak_alias (__lround, lroundl)
+#endif

Added: fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_scalbn.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_scalbn.c (added)
+++ fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_scalbn.c Tue Aug 25 19:13:16 2009
@@ -1,0 +1,68 @@
+/* @(#)s_scalbn.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * 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"
+
+#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
+{
+	int64_t ix;
+	int64_t k;
+	EXTRACT_WORDS64(ix,x);
+	k = (ix >> 52) & 0x7ff;			/* extract exponent */
+	if (k==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 */
+	k = k+n;
+	if (n> 50000 || k >  0x7fe)
+	  return huge*__copysign(huge,x); /* overflow  */
+	if (n< -50000) return tiny*__copysign(tiny,x); /*underflow*/
+	if (k > 0)				/* 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 (__scalbn, scalbn)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__scalbn, __scalbnl)
+weak_alias (__scalbn, scalbnl)
+#endif

Added: fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_trunc.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_trunc.c (added)
+++ fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_trunc.c Tue Aug 25 19:13:16 2009
@@ -1,0 +1,56 @@
+/* Truncate argument to nearest integral value not larger than the argument.
+   Copyright (C) 1997, 1998, 2009 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"
+
+
+double
+__trunc (double x)
+{
+  int64_t i0, j0;
+  int64_t sx;
+
+  EXTRACT_WORDS64 (i0, x);
+  sx = i0 & UINT64_C(0x8000000000000000);
+  j0 = ((i0 >> 52) & 0x7ff) - 0x3ff;
+  if (j0 < 52)
+    {
+      if (j0 < 0)
+	/* The magnitude of the number is < 1 so the result is +-0.  */
+	INSERT_WORDS64 (x, sx);
+      else
+	INSERT_WORDS64 (x, sx | (i0 & ~(UINT64_C(0x000fffffffffffff) >> j0)));
+    }
+  else
+    {
+      if (j0 == 0x400)
+	/* x is inf or NaN.  */
+	return x + x;
+    }
+
+  return x;
+}
+weak_alias (__trunc, trunc)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__trunc, __truncl)
+weak_alias (__trunc, truncl)
+#endif

Modified: fsf/trunk/libc/sysdeps/x86_64/dl-trampoline.S
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/dl-trampoline.S (original)
+++ fsf/trunk/libc/sysdeps/x86_64/dl-trampoline.S Tue Aug 25 19:13:16 2009
@@ -197,7 +197,6 @@
 	ret
 L(no_avx5):
 # endif
-# define YMM_SIZE 16
 	movdqa	%xmm0, %fs:RTLD_SAVESPACE_SSE+0*XMM_SIZE
 	movdqa	%xmm1, %fs:RTLD_SAVESPACE_SSE+1*XMM_SIZE
 	movdqa	%xmm2, %fs:RTLD_SAVESPACE_SSE+2*XMM_SIZE

Added: fsf/trunk/libc/sysdeps/x86_64/fpu/s_scalbln.c
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/fpu/s_scalbln.c (added)
+++ fsf/trunk/libc/sysdeps/x86_64/fpu/s_scalbln.c Tue Aug 25 19:13:16 2009
@@ -1,0 +1,2 @@
+/* Nothing to do.  This function is the same as scalbn.  So we define an
+   alias.  */

Added: fsf/trunk/libc/sysdeps/x86_64/fpu/s_scalbn.c
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/fpu/s_scalbn.c (added)
+++ fsf/trunk/libc/sysdeps/x86_64/fpu/s_scalbn.c Tue Aug 25 19:13:16 2009
@@ -1,0 +1,9 @@
+#define scalbln __renamed_scalbln
+#define __scalbln __renamed___scalbln
+
+#include <sysdeps/ieee754/dbl-64/wordsize-64/s_scalbn.c>
+
+#undef scalbln
+#undef __scalbln
+strong_alias (__scalbn, __scalbln)
+weak_alias (__scalbn, scalbln)

Added: fsf/trunk/libc/sysdeps/x86_64/fpu/s_signbit.S
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/fpu/s_signbit.S (added)
+++ fsf/trunk/libc/sysdeps/x86_64/fpu/s_signbit.S Tue Aug 25 19:13:16 2009
@@ -1,0 +1,27 @@
+/* Return nonzero value if number is negative.
+   Copyright (C) 2009 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@xxxxxxxxx>, 2009.
+
+   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 <sysdep.h>
+
+ENTRY(__signbit)
+	pmovmskb %xmm0, %eax
+	andl	$0x80, %eax
+	ret
+END(__signbit)

Added: fsf/trunk/libc/sysdeps/x86_64/fpu/s_signbitf.S
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/fpu/s_signbitf.S (added)
+++ fsf/trunk/libc/sysdeps/x86_64/fpu/s_signbitf.S Tue Aug 25 19:13:16 2009
@@ -1,0 +1,27 @@
+/* Return nonzero value if number is negative.
+   Copyright (C) 2009 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@xxxxxxxxx>, 2009.
+
+   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 <sysdep.h>
+
+ENTRY(__signbitf)
+	pmovmskb %xmm0, %eax
+	andl	$0x8, %eax
+	ret
+END(__signbitf)