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

[Commits] r22235 - in /fsf/trunk/libc: ./ debug/ sysdeps/i386/fpu/ sysdeps/ieee754/dbl-64/ sysdeps/sparc/fpu/ sysdeps/unix/sysv/linux/...



Author: eglibc
Date: Fri Jan 18 16:29:08 2013
New Revision: 22235

Log:
Import glibc-mainline for 2013-01-18

Added:
    fsf/trunk/libc/debug/tst-backtrace2.c
    fsf/trunk/libc/debug/tst-backtrace3.c
    fsf/trunk/libc/debug/tst-backtrace4.c
    fsf/trunk/libc/debug/tst-backtrace5.c
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/NEWS
    fsf/trunk/libc/debug/Makefile
    fsf/trunk/libc/sysdeps/i386/fpu/fenv_private.h
    fsf/trunk/libc/sysdeps/ieee754/dbl-64/mpa.h
    fsf/trunk/libc/sysdeps/ieee754/dbl-64/mpexp.c
    fsf/trunk/libc/sysdeps/sparc/fpu/libm-test-ulps
    fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/init-first.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Fri Jan 18 16:29:08 2013
@@ -1,3 +1,63 @@
+2013-01-18  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+	    Mark Mitchell  <mark@xxxxxxxxxxxxxxxx>
+	    Tom de Vries  <tom@xxxxxxxxxxxxxxxx>
+	    Paul Pluzhnikov  <ppluzhnikov@xxxxxxxxxx>
+
+	* debug/tst-backtrace2.c: New file.
+	* debug/tst-backtrace3.c: Likewise.
+	* debug/tst-backtrace4.c: Likewise.
+	* debug/tst-backtrace5.c: Likewise.
+	* debug/Makefile (CFLAGS-tst-backtrace2.c): New variable.
+	(CFLAGS-tst-backtrace3.c): Likewise.
+	(CFLAGS-tst-backtrace4.c): Likewise.
+	(CFLAGS-tst-backtrace5.c): Likewise.
+	(LDFLAGS-tst-backtrace2): Likewise.
+	(LDFLAGS-tst-backtrace3): Likewise.
+	(LDFLAGS-tst-backtrace4): Likewise.
+	(LDFLAGS-tst-backtrace5): Likewise.
+	(tests): Add new tests tst-backtrace2, tst-backtrace3,
+	tst-backtrace4 and tst-backtrace5.
+
+2013-01-18  Anton Blanchard  <anton@xxxxxxxxx>
+	    Ryan S. Arnold  <rsa@xxxxxxxxxxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/powerpc/init-first.c: Rename
+	__kernel_vdso_get_tbfreq to __kernel_get_tbfreq.
+	* sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c: Add parameter to
+	INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK to specify return type.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
+	(INTERNAL_VSYSCALL_NCS): Change "=&r" in inline asm output regs list to
+	"+r" and remove output regs list as redundant.  Add explicit inline
+	asm to specify register of return val to work around compiler codegen
+	bug.  Remove (int) cast on return value.  Add return type parameter to
+	use in macro so that this macro does not truncate return value for
+	64-bit values.
+	(INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK): Add return type parameter and
+	pass to INTERNAL_VSYSCALL_NCS.
+	(INLINE_VSYSCALL): Add 'long int' as return type to
+	INTERNAL_VSYSCALL_NCS macro invocation.
+	(INTERNAL_VSYSCALL): Add 'long int' as return type to
+	INTERNAL_VSYSCALL_NCS macro invocation.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h: Likewise.
+
+2013-01-18  Siddhesh Poyarekar  <siddhesh@xxxxxxxxxx>
+
+	[BZ #14496]
+	* sysdeps/i386/fpu/fenv_private.h (libc_feupdateenv_test_sse):
+	Fix application of SIMD FP exception mask.
+
+	* sysdeps/ieee754/dbl-64/mpa.h (__pow_mp): New function to get an
+	mp_no from a power of two.
+	* sysdeps/ieee754/dbl-64/mpexp.c (__mpexp): Remove
+	__mpexp_twomm1.  Use __pow_mp.
+
+	* sysdeps/ieee754/dbl-64/mpexp.c (__mpexp): Remove unnecessary
+	multiplication.
+
+2013-01-17  David S. Miller  <davem@xxxxxxxxxxxxx>
+
+	* sysdeps/sparc/fpu/libm-test-ulps: Update.
+
 2013-01-17  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
 
 	[BZ #15023]

Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Fri Jan 18 16:29:08 2013
@@ -9,8 +9,8 @@
 
 * The following bugs are resolved with this release:
 
-  13951, 14200, 14317, 14327, 14964, 14981, 14982, 14985, 14994, 14996,
-  15003, 15023.
+  13951, 14200, 14317, 14327, 14496, 14964, 14981, 14982, 14985, 14994,
+  14996, 15003, 15023.
 
 
 Version 2.17

Modified: fsf/trunk/libc/debug/Makefile
==============================================================================
--- fsf/trunk/libc/debug/Makefile (original)
+++ fsf/trunk/libc/debug/Makefile Fri Jan 18 16:29:08 2013
@@ -121,10 +121,22 @@
 LDLIBS-tst-lfschk5 = -lstdc++
 LDLIBS-tst-lfschk6 = -lstdc++
 
+# backtrace_symbols only works if we link with -rdynamic.  backtrace
+# requires unwind tables on most architectures.
+CFLAGS-tst-backtrace2.c += -funwind-tables
+CFLAGS-tst-backtrace3.c += -funwind-tables
+CFLAGS-tst-backtrace4.c += -funwind-tables
+CFLAGS-tst-backtrace5.c += -funwind-tables
+LDFLAGS-tst-backtrace2 = -rdynamic
+LDFLAGS-tst-backtrace3 = -rdynamic
+LDFLAGS-tst-backtrace4 = -rdynamic
+LDFLAGS-tst-backtrace5 = -rdynamic
+
 tests = backtrace-tst tst-longjmp_chk tst-chk1 tst-chk2 tst-chk3 \
 	tst-lfschk1 tst-lfschk2 tst-lfschk3 test-strcpy_chk test-stpcpy_chk \
 	tst-chk4 tst-chk5 tst-chk6 tst-lfschk4 tst-lfschk5 tst-lfschk6 \
-	tst-longjmp_chk2
+	tst-longjmp_chk2 tst-backtrace2 tst-backtrace3 tst-backtrace4 \
+	tst-backtrace5
 
 tests-ifunc := $(stpcpy_chk strcpy_chk:%=test-%-ifunc)
 tests += $(tests-ifunc)

Added: fsf/trunk/libc/debug/tst-backtrace2.c
==============================================================================
--- fsf/trunk/libc/debug/tst-backtrace2.c (added)
+++ fsf/trunk/libc/debug/tst-backtrace2.c Fri Jan 18 16:29:08 2013
@@ -1,0 +1,111 @@
+/* Test backtrace and backtrace_symbols.
+   Copyright (C) 2009-2013 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
+   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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <execinfo.h>
+#include <search.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+static int do_test (void);
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
+
+/* Set to a non-zero value if the test fails.  */
+int ret;
+
+/* Accesses to X are used to prevent optimization.  */
+volatile int x;
+
+/* Called if the test fails.  */
+#define FAIL() \
+  do { printf ("Failure on line %d\n", __LINE__); ret = 1; } while (0)
+
+/* The backtrace should include at least f1, f2, f3, and do_test.  */
+#define NUM_FUNCTIONS 4
+
+/* Use this attribute to prevent inlining, so that all expected frames
+   are present.  */
+#define NO_INLINE __attribute__ ((noinline))
+
+NO_INLINE void
+fn1 (void)
+{
+  void *addresses[NUM_FUNCTIONS];
+  char **symbols;
+  int n;
+  int i;
+
+  /* Get the backtrace addresses.  */
+  n = backtrace (addresses, sizeof (addresses) / sizeof (addresses[0]));
+  printf ("Obtained backtrace with %d functions\n", n);
+  /*  Check that there are at least four functions.  */
+  if (n < NUM_FUNCTIONS)
+    {
+      FAIL ();
+      return;
+    }
+  /* Convert them to symbols.  */
+  symbols = backtrace_symbols (addresses, n);
+  /* Check that symbols were obtained.  */
+  if (symbols == NULL)
+    {
+      FAIL ();
+      return;
+    }
+  for (i = 0; i < n; ++i)
+    printf ("Function %d: %s\n", i, symbols[i]);
+  /* Check that the function names obtained are accurate.  */
+  if (strstr (symbols[0], "fn1") == NULL)
+    {
+      FAIL ();
+      return;
+    }
+  /* Symbol names are not available for static functions, so we do not
+     check f2.  */
+  if (strstr (symbols[2], "fn3") == NULL)
+    {
+      FAIL ();
+      return;
+    }
+  /* Symbol names are not available for static functions, so we do not
+     check do_test.  */
+}
+
+NO_INLINE static int
+fn2 (void)
+{
+  fn1 ();
+  /* Prevent tail calls.  */
+  return x;
+}
+
+NO_INLINE int
+fn3 (void)
+{
+  fn2();
+  /* Prevent tail calls.  */
+  return x;
+}
+
+NO_INLINE static int
+do_test (void)
+{
+  fn3 ();
+  return ret;
+}

Added: fsf/trunk/libc/debug/tst-backtrace3.c
==============================================================================
--- fsf/trunk/libc/debug/tst-backtrace3.c (added)
+++ fsf/trunk/libc/debug/tst-backtrace3.c Fri Jan 18 16:29:08 2013
@@ -1,0 +1,95 @@
+/* Test backtrace and backtrace_symbols for recursive calls.
+   Copyright (C) 2010-2013 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
+   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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <execinfo.h>
+#include <search.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+static int do_test (void);
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
+
+/* Set to a non-zero value if the test fails.  */
+int ret;
+
+/* Accesses to X are used to prevent optimization.  */
+volatile int x;
+
+/* Called if the test fails.  */
+#define FAIL() \
+  do { printf ("Failure on line %d\n", __LINE__); ret = 1; } while (0)
+
+/* The backtrace should include at least 3 * fn, and do_test.  */
+#define NUM_FUNCTIONS 4
+
+/* Use this attribute to prevent inlining, so that all expected frames
+   are present.  */
+#define NO_INLINE __attribute__ ((noinline))
+
+NO_INLINE int
+fn (int c)
+{
+  void *addresses[NUM_FUNCTIONS];
+  char **symbols;
+  int n;
+  int i;
+
+  if (c > 0)
+    {
+      fn (c - 1);
+      return x;
+    }
+  /* Get the backtrace addresses.  */
+  n = backtrace (addresses, sizeof (addresses) / sizeof (addresses[0]));
+  printf ("Obtained backtrace with %d functions\n", n);
+  /*  Check that there are at least four functions.  */
+  if (n < NUM_FUNCTIONS)
+    {
+      FAIL ();
+      return 1;
+    }
+  /* Convert them to symbols.  */
+  symbols = backtrace_symbols (addresses, n);
+  /* Check that symbols were obtained.  */
+  if (symbols == NULL)
+    {
+      FAIL ();
+      return 1;
+    }
+  for (i = 0; i < n; ++i)
+    printf ("Function %d: %s\n", i, symbols[i]);
+  /* Check that the function names obtained are accurate.  */
+  for (i = 0; i < n - 1; ++i)
+    if (strstr (symbols[i], "fn") == NULL)
+      {
+	FAIL ();
+	return 1;
+      }
+  /* Symbol names are not available for static functions, so we do not
+     check do_test.  */
+  return x;
+}
+
+NO_INLINE static int
+do_test (void)
+{
+  fn (2);
+  return ret;
+}

Added: fsf/trunk/libc/debug/tst-backtrace4.c
==============================================================================
--- fsf/trunk/libc/debug/tst-backtrace4.c (added)
+++ fsf/trunk/libc/debug/tst-backtrace4.c Fri Jan 18 16:29:08 2013
@@ -1,0 +1,134 @@
+/* Test backtrace and backtrace_symbols for signal frames.
+   Copyright (C) 2011-2013 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
+   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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <execinfo.h>
+#include <search.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <signal.h>
+#include <unistd.h>
+
+static int do_test (void);
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
+
+/* Set to a non-zero value if the test fails.  */
+volatile int ret;
+
+/* Accesses to X are used to prevent optimization.  */
+volatile int x;
+
+/* Called if the test fails.  */
+#define FAIL() \
+  do { printf ("Failure on line %d\n", __LINE__); ret = 1; } while (0)
+
+/* The backtrace should include at least handle_signal, a signal
+   trampoline, 3 * fn, and do_test.  */
+#define NUM_FUNCTIONS 6
+
+/* Use this attribute to prevent inlining, so that all expected frames
+   are present.  */
+#define NO_INLINE __attribute__ ((noinline))
+
+volatile int sig_handled = 0;
+
+void
+handle_signal (int signum)
+{
+  void *addresses[NUM_FUNCTIONS];
+  char **symbols;
+  int n;
+  int i;
+
+  sig_handled = 1;
+
+  /* Get the backtrace addresses.  */
+  n = backtrace (addresses, sizeof (addresses) / sizeof (addresses[0]));
+  printf ("Obtained backtrace with %d functions\n", n);
+  /*  Check that there are at least six functions.  */
+  if (n < NUM_FUNCTIONS)
+    {
+      FAIL ();
+      return;
+    }
+  /* Convert them to symbols.  */
+  symbols = backtrace_symbols (addresses, n);
+  /* Check that symbols were obtained.  */
+  if (symbols == NULL)
+    {
+      FAIL ();
+      return;
+    }
+  for (i = 0; i < n; ++i)
+    printf ("Function %d: %s\n", i, symbols[i]);
+  /* Check that the function names obtained are accurate.  */
+  if (strstr (symbols[0], "handle_signal") == NULL)
+    {
+      FAIL ();
+      return;
+    }
+  /* Do not check name for signal trampoline.  */
+  for (i = 2; i < n - 1; i++)
+    if (strstr (symbols[i], "fn") == NULL)
+      {
+	FAIL ();
+	return;
+      }
+  /* Symbol names are not available for static functions, so we do not
+     check do_test.  */
+}
+
+NO_INLINE int
+fn (int c)
+{
+  pid_t parent_pid, child_pid;
+
+  if (c > 0)
+    {
+      fn (c - 1);
+      return x;
+    }
+
+  signal (SIGUSR1, handle_signal);
+  parent_pid = getpid ();
+
+  child_pid = fork ();
+  if (child_pid == (pid_t) -1)
+    abort ();
+  else if (child_pid == 0)
+    {
+      sleep (1);
+      kill (parent_pid, SIGUSR1);
+      _exit (0);
+    }
+
+  /* In the parent.  */
+  while (sig_handled == 0)
+    ;
+
+  return 0;
+}
+
+NO_INLINE static int
+do_test (void)
+{
+  fn (2);
+  return ret;
+}

Added: fsf/trunk/libc/debug/tst-backtrace5.c
==============================================================================
--- fsf/trunk/libc/debug/tst-backtrace5.c (added)
+++ fsf/trunk/libc/debug/tst-backtrace5.c Fri Jan 18 16:29:08 2013
@@ -1,0 +1,148 @@
+/* Test backtrace and backtrace_symbols for signal frames, where a
+   system call was interrupted by a signal.
+   Copyright (C) 2011-2013 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
+   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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <execinfo.h>
+#include <search.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <signal.h>
+#include <unistd.h>
+
+static int do_test (void);
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
+
+/* Set to a non-zero value if the test fails.  */
+volatile int ret;
+
+/* Accesses to X are used to prevent optimization.  */
+volatile int x;
+
+/* Called if the test fails.  */
+#define FAIL() \
+  do { printf ("Failure on line %d\n", __LINE__); ret = 1; } while (0)
+
+/* The backtrace should include at least handle_signal, a signal
+   trampoline, read, 3 * fn, and do_test.  */
+#define NUM_FUNCTIONS 7
+
+/* Use this attribute to prevent inlining, so that all expected frames
+   are present.  */
+#define NO_INLINE __attribute__ ((noinline))
+
+void
+handle_signal (int signum)
+{
+  void *addresses[NUM_FUNCTIONS];
+  char **symbols;
+  int n;
+  int i;
+
+  /* Get the backtrace addresses.  */
+  n = backtrace (addresses, sizeof (addresses) / sizeof (addresses[0]));
+  printf ("Obtained backtrace with %d functions\n", n);
+  /*  Check that there are at least seven functions.  */
+  if (n < NUM_FUNCTIONS)
+    {
+      FAIL ();
+      return;
+    }
+  /* Convert them to symbols.  */
+  symbols = backtrace_symbols (addresses, n);
+  /* Check that symbols were obtained.  */
+  if (symbols == NULL)
+    {
+      FAIL ();
+      return;
+    }
+  for (i = 0; i < n; ++i)
+    printf ("Function %d: %s\n", i, symbols[i]);
+  /* Check that the function names obtained are accurate.  */
+  if (strstr (symbols[0], "handle_signal") == NULL)
+    {
+      FAIL ();
+      return;
+    }
+  /* Do not check name for signal trampoline.  */
+  i = 2;
+  if (strstr (symbols[i++], "read") == NULL)
+    {
+      /* Perhaps symbols[2] is __kernel_vsyscall?  */
+      if (strstr (symbols[i++], "read") == NULL)
+	{
+	  FAIL ();
+	  return;
+	}
+    }
+  for (; i < n - 1; i++)
+    if (strstr (symbols[i], "fn") == NULL)
+      {
+	FAIL ();
+	return;
+      }
+  /* Symbol names are not available for static functions, so we do not
+     check do_test.  */
+}
+
+NO_INLINE int
+fn (int c)
+{
+  pid_t parent_pid, child_pid;
+  int pipefd[2];
+  char r[1];
+  struct sigaction act;
+
+  if (c > 0)
+    {
+      fn (c - 1);
+      return x;
+    }
+
+  memset (&act, 0, sizeof (act));
+  act.sa_handler = handle_signal;
+  sigemptyset (&act.sa_mask);
+  sigaction (SIGUSR1, &act, NULL);
+  parent_pid = getpid ();
+  if (pipe (pipefd) == -1)
+    abort ();
+
+  child_pid = fork ();
+  if (child_pid == (pid_t) -1)
+    abort ();
+  else if (child_pid == 0)
+    {
+      sleep (1);
+      kill (parent_pid, SIGUSR1);
+      _exit (0);
+    }
+
+  /* In the parent.  */
+  read (pipefd[0], r, 1);
+
+  return 0;
+}
+
+NO_INLINE static int
+do_test (void)
+{
+  fn (2);
+  return ret;
+}

Modified: fsf/trunk/libc/sysdeps/i386/fpu/fenv_private.h
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/fpu/fenv_private.h (original)
+++ fsf/trunk/libc/sysdeps/i386/fpu/fenv_private.h Fri Jan 18 16:29:08 2013
@@ -176,7 +176,7 @@
 
   /* Raise SIGFPE for any new exceptions since the hold.  Expect that
      the normal environment has all exceptions masked.  */
-  if (__builtin_expect ((old_mxcsr >> 7) & cur_ex, 0))
+  if (__glibc_unlikely (~(old_mxcsr >> 7) & cur_ex))
     __feraiseexcept (cur_ex);
 
   /* Test for exceptions raised since the hold.  */

Modified: fsf/trunk/libc/sysdeps/ieee754/dbl-64/mpa.h
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/dbl-64/mpa.h (original)
+++ fsf/trunk/libc/sysdeps/ieee754/dbl-64/mpa.h Fri Jan 18 16:29:08 2013
@@ -123,3 +123,33 @@
 extern void __mpexp (mp_no *, mp_no *, int);
 extern void __c32 (mp_no *, mp_no *, mp_no *, int);
 extern int __mpranred (double, mp_no *, int);
+
+/* Given a power POW, build a multiprecision number 2^POW.  */
+static inline void
+__pow_mp (int pow, mp_no *y, int p)
+{
+  int i, rem;
+
+  /* The exponent is E such that E is a factor of 2^24.  The remainder (of the
+     form 2^x) goes entirely into the first digit of the mantissa as it is
+     always less than 2^24.  */
+  EY = pow / 24;
+  rem = pow - EY * 24;
+  EY++;
+
+  /* If the remainder is negative, it means that POW was negative since
+     |EY * 24| <= |pow|.  Adjust so that REM is positive and still less than
+     24 because of which, the mantissa digit is less than 2^24.  */
+  if (rem < 0)
+    {
+      EY--;
+      rem += 24;
+    }
+  /* The sign of any 2^x is always positive.  */
+  Y[0] = ONE;
+  Y[1] = 1 << rem;
+
+  /* Everything else is ZERO.  */
+  for (i = 2; i <= p; i++)
+    Y[i] = ZERO;
+}

Modified: fsf/trunk/libc/sysdeps/ieee754/dbl-64/mpexp.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/dbl-64/mpexp.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/dbl-64/mpexp.c Fri Jan 18 16:29:08 2013
@@ -43,7 +43,7 @@
 __mpexp (mp_no *x, mp_no *y, int p)
 {
   int i, j, k, m, m1, m2, n;
-  double a, b;
+  double b;
   static const int np[33] =
     {
       0, 0, 0, 0, 3, 3, 4, 4, 5, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, 6,
@@ -60,19 +60,6 @@
       68, 71, 74, 77,
       70, 73, 76, 78,
       81
-    };
-  /* Stored values for 2^-m, where values of m are defined in M1P above.   */
-  static const double __mpexp_twomm1[33] =
-    {
-      0x1.0p0, 0x1.0p0, 0x1.0p0, 0x1.0p0,
-      0x1.0p-17, 0x1.0p-23, 0x1.0p-23, 0x1.0p-28,
-      0x1.0p-27, 0x1.0p-38, 0x1.0p-42, 0x1.0p-39,
-      0x1.0p-43, 0x1.0p-47, 0x1.0p-43, 0x1.0p-47,
-      0x1.0p-50, 0x1.0p-54, 0x1.0p-57, 0x1.0p-60,
-      0x1.0p-64, 0x1.0p-67, 0x1.0p-71, 0x1.0p-74,
-      0x1.0p-68, 0x1.0p-71, 0x1.0p-74, 0x1.0p-77,
-      0x1.0p-70, 0x1.0p-73, 0x1.0p-76, 0x1.0p-78,
-      0x1.0p-81
     };
   static const int m1np[7][18] =
     {
@@ -98,19 +85,11 @@
   /* Choose m,n and compute a=2**(-m).  */
   n = np[p];
   m1 = m1p[p];
-  a = __mpexp_twomm1[p];
-  for (i = 0; i < EX; i++)
-    a *= RADIXI;
-  for (; i > EX; i--)
-    a *= RADIX;
-  b = X[1] * RADIXI;
+  b = X[1];
   m2 = 24 * EX;
-  for (; b < HALF; m2--)
-    {
-      a *= TWO;
-      b *= TWO;
-    }
-  if (b == HALF)
+  for (; b < HALFRAD; m2--)
+    b *= TWO;
+  if (b == HALFRAD)
     {
       for (i = 2; i <= p; i++)
 	{
@@ -118,10 +97,7 @@
 	    break;
 	}
       if (i == p + 1)
-	{
-	  m2--;
-	  a *= TWO;
-	}
+	m2--;
     }
 
   m = m1 + m2;
@@ -134,14 +110,13 @@
 	 than 2^-55.  */
       assert (p < 18);
       m = 0;
-      a = ONE;
       for (i = n - 1; i > 0; i--, n--)
 	if (m1np[i][p] + m2 > 0)
 	  break;
     }
 
   /* Compute s=x*2**(-m). Put result in mps.  */
-  __dbl_mp (a, &mpt1, p);
+  __pow_mp (-m, &mpt1, p);
   __mul (x, &mpt1, &mps, p);
 
   /* Evaluate the polynomial. Put result in mpt2.  */

Modified: fsf/trunk/libc/sysdeps/sparc/fpu/libm-test-ulps
==============================================================================
--- fsf/trunk/libc/sysdeps/sparc/fpu/libm-test-ulps (original)
+++ fsf/trunk/libc/sysdeps/sparc/fpu/libm-test-ulps Fri Jan 18 16:29:08 2013
@@ -198,6 +198,42 @@
 idouble: 1
 ildouble: 1
 ldouble: 1
+Test "Real part of: cacos (-0.5 + +0 i) == 2.094395102393195492308428922186335256131 - 0 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: cacos (-0.5 - 0 i) == 2.094395102393195492308428922186335256131 + +0 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (-0x1p500 + 1.0 i) == 3.141592653589793238462643383279502884197 - 3.472667374605326000180332928505464606058e2 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (-0x1p500 - 1.0 i) == 3.141592653589793238462643383279502884197 + 3.472667374605326000180332928505464606058e2 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (-0x1p5000 + 1.0 i) == 3.141592653589793238462643383279502884197 - 3.466429049980286492395577839412341016946e3 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (-0x1p5000 - 1.0 i) == 3.141592653589793238462643383279502884197 + 3.466429049980286492395577839412341016946e3 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: cacos (-1.0 + 0x1p50 i) == 1.570796326794897507409741391764983781004 - 3.535050620855721078027883819436759661753e1 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: cacos (-1.0 + 0x1p500 i) == 1.570796326794896619231321691639751442099 - 3.472667374605326000180332928505464606058e2 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (-1.0 + 0x1p5000 i) == 1.570796326794896619231321691639751442099 - 3.466429049980286492395577839412341016946e3 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: cacos (-1.0 - 0x1p50 i) == 1.570796326794897507409741391764983781004 + 3.535050620855721078027883819436759661753e1 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: cacos (-1.0 - 0x1p500 i) == 1.570796326794896619231321691639751442099 + 3.472667374605326000180332928505464606058e2 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (-1.0 - 0x1p5000 i) == 1.570796326794896619231321691639751442099 + 3.466429049980286492395577839412341016946e3 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: cacos (-1.5 + +0 i) == pi - 0.9624236501192068949955178268487368462704 i":
 double: 1
 float: 1
@@ -205,6 +241,11 @@
 ifloat: 1
 ildouble: 1
 ldouble: 1
+Test "Real part of: cacos (-2 - 3 i) == 2.1414491111159960199416055713254211 + 1.9833870299165354323470769028940395 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Real part of: cacos (0.5 + +0 i) == 1.047197551196597746154214461093167628066 - 0 i":
 double: 1
 idouble: 1
@@ -219,6 +260,39 @@
 float: 1
 ifloat: 1
 Test "Imaginary part of: cacos (0.75 + 1.25 i) == 1.11752014915610270578240049553777969 - 1.13239363160530819522266333696834467 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (0x1.fp1023 + 0x1.fp1023 i) == 7.853981633974483096156608458198757210493e-1 - 7.107906849659093345062145442726115449315e2 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: cacos (0x1.fp127 + 0x1.fp127 i) == 7.853981633974483096156608458198757210493e-1 - 8.973081118419833726837456344608533993585e1 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: cacos (0x1.fp16383 + 0x1.fp16383 i) == 7.853981633974483096156608458198757210493e-1 - 1.135753137836666928715489992987020363057e4 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (0x1p500 + 1.0 i) == 3.054936363499604682051979393213617699789e-151 - 3.472667374605326000180332928505464606058e2 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (0x1p500 - 1.0 i) == 3.054936363499604682051979393213617699789e-151 + 3.472667374605326000180332928505464606058e2 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (0x1p5000 + 1.0 i) == 7.079811261048172892385615158694057552948e-1506 - 3.466429049980286492395577839412341016946e3 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (0x1p5000 - 1.0 i) == 7.079811261048172892385615158694057552948e-1506 + 3.466429049980286492395577839412341016946e3 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (1.0 + 0x1p500 i) == 1.570796326794896619231321691639751442099 - 3.472667374605326000180332928505464606058e2 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (1.0 + 0x1p5000 i) == 1.570796326794896619231321691639751442099 - 3.466429049980286492395577839412341016946e3 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (1.0 - 0x1p500 i) == 1.570796326794896619231321691639751442099 + 3.472667374605326000180332928505464606058e2 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (1.0 - 0x1p5000 i) == 1.570796326794896619231321691639751442099 + 3.466429049980286492395577839412341016946e3 i":
 ildouble: 1
 ldouble: 1
 Test "Imaginary part of: cacos (1.5 + +0 i) == +0 - 0.9624236501192068949955178268487368462704 i":

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c Fri Jan 18 16:29:08 2013
@@ -41,7 +41,8 @@
   /* If we can use the vDSO to obtain the timebase even better.  */
 #ifdef SHARED
   INTERNAL_SYSCALL_DECL (err);
-  timebase_freq = INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK (get_tbfreq, err, 0);
+  timebase_freq =
+    INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK (get_tbfreq, err, hp_timing_t, 0);
   if (INTERNAL_SYSCALL_ERROR_P (timebase_freq, err)
       && INTERNAL_SYSCALL_ERRNO (timebase_freq, err) == ENOSYS)
 #endif

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/init-first.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/init-first.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/init-first.c Fri Jan 18 16:29:08 2013
@@ -41,7 +41,7 @@
 
   __vdso_clock_getres = _dl_vdso_vsym ("__kernel_clock_getres", &linux2615);
 
-  __vdso_get_tbfreq = _dl_vdso_vsym ("__kernel_vdso_get_tbfreq", &linux2615);
+  __vdso_get_tbfreq = _dl_vdso_vsym ("__kernel_get_tbfreq", &linux2615);
 
   __vdso_getcpu = _dl_vdso_vsym ("__kernel_getcpu", &linux2615);
 }

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h Fri Jan 18 16:29:08 2013
@@ -60,7 +60,8 @@
 									      \
     if (__vdso_##name != NULL)						      \
       {									      \
-	sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, nr, ##args);   \
+	sc_ret =							      \
+	  INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, long int, nr, ##args);\
 	if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err))			      \
 	  goto out;							      \
 	if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS)		      \
@@ -90,7 +91,8 @@
 									      \
     if (__vdso_##name != NULL)						      \
       {									      \
-	v_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args);	      \
+	v_ret =								      \
+	  INTERNAL_VSYSCALL_NCS (__vdso_##name, err, long int, nr, ##args);   \
 	if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err)			      \
 	    || INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS)		      \
 	  goto out;							      \
@@ -104,12 +106,12 @@
   INTERNAL_SYSCALL (name, err, nr, ##args)
 # endif
 
-# define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, nr, args...)	      \
-  ({									      \
-    long int sc_ret = ENOSYS;						      \
+# define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, type, nr, args...)  \
+  ({									      \
+    type sc_ret = ENOSYS;						      \
 									      \
     if (__vdso_##name != NULL)						      \
-      sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args);	      \
+      sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, type, nr, ##args);  \
     else								      \
       err = 1 << 28;							      \
     sc_ret;								      \
@@ -126,7 +128,7 @@
    function call, with the exception of LR (which is needed for the
    "sc; bnslr+" sequence) and CR (where only CR0.SO is clobbered to signal
    an error return status).  */
-# define INTERNAL_VSYSCALL_NCS(funcptr, err, nr, args...) \
+# define INTERNAL_VSYSCALL_NCS(funcptr, err, type, nr, args...) \
   ({									      \
     register void *r0  __asm__ ("r0");					      \
     register long int r3  __asm__ ("r3");				      \
@@ -139,18 +141,18 @@
     register long int r10 __asm__ ("r10");				      \
     register long int r11 __asm__ ("r11");				      \
     register long int r12 __asm__ ("r12");				      \
+    register type rval  __asm__ ("r3");					      \
     LOADARGS_##nr (funcptr, args);					      \
     __asm__ __volatile__						      \
       ("mtctr %0\n\t"							      \
        "bctrl\n\t"							      \
        "mfcr %0"							      \
-       : "=&r" (r0),							      \
-	 "=&r" (r3), "=&r" (r4), "=&r" (r5),  "=&r" (r6),  "=&r" (r7),	      \
-	 "=&r" (r8), "=&r" (r9), "=&r" (r10), "=&r" (r11), "=&r" (r12)	      \
-       : ASM_INPUT_##nr							      \
-       : "cr0", "ctr", "lr", "memory");					      \
+       : "+r" (r0), "+r" (r3), "+r" (r4), "+r" (r5),  "+r" (r6),  "+r" (r7),  \
+	 "+r" (r8), "+r" (r9), "+r" (r10), "+r" (r11), "+r" (r12)	      \
+       : : "cr0", "ctr", "lr", "memory");				      \
     err = (long int) r0;						      \
-    (int) r3;								      \
+    __asm__ __volatile__ ("" : "=r" (rval) : "r" (r3), "r" (r4));	      \
+    rval;								      \
   })
 
 # undef INLINE_SYSCALL
@@ -191,7 +193,7 @@
     register long int r10 __asm__ ("r10");				\
     register long int r11 __asm__ ("r11");				\
     register long int r12 __asm__ ("r12");				\
-    LOADARGS_##nr(name, args);					\
+    LOADARGS_##nr(name, args);						\
     __asm__ __volatile__						\
       ("sc   \n\t"							\
        "mfcr %0"							\

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h Fri Jan 18 16:29:08 2013
@@ -75,7 +75,8 @@
 									      \
     if (__vdso_##name != NULL)						      \
       {									      \
-	sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, nr, ##args);   \
+	sc_ret =							      \
+	  INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, long int, nr, ##args);\
 	if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err))			      \
 	  goto out;							      \
 	if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS)		      \
@@ -105,7 +106,8 @@
 									      \
     if (__vdso_##name != NULL)						      \
       {									      \
-	v_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args);	      \
+	v_ret =								      \
+	  INTERNAL_VSYSCALL_NCS (__vdso_##name, err, long int, nr, ##args);   \
 	if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err)			      \
 	    || INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS)		      \
 	  goto out;							      \
@@ -121,12 +123,12 @@
 
 /* This version is for internal uses when there is no desire
    to set errno */
-#define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, nr, args...)	      \
+#define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, type, nr, args...)   \
   ({									      \
-    long int sc_ret = ENOSYS;						      \
+    type sc_ret = ENOSYS;						      \
 									      \
     if (__vdso_##name != NULL)						      \
-      sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args);	      \
+      sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, type, nr, ##args);  \
     else								      \
       err = 1 << 28;							      \
     sc_ret;								      \
@@ -142,7 +144,7 @@
    gave back in the non-error (CR0.SO cleared) case, otherwise (CR0.SO set)
    the negation of the return value in the kernel gets reverted.  */
 
-#define INTERNAL_VSYSCALL_NCS(funcptr, err, nr, args...) \
+#define INTERNAL_VSYSCALL_NCS(funcptr, err, type, nr, args...) \
   ({									\
     register void *r0  __asm__ ("r0");					\
     register long int r3  __asm__ ("r3");				\
@@ -151,20 +153,19 @@
     register long int r6  __asm__ ("r6");				\
     register long int r7  __asm__ ("r7");				\
     register long int r8  __asm__ ("r8");				\
+    register type rval  __asm__ ("r3");				        \
     LOADARGS_##nr (funcptr, args);					\
     __asm__ __volatile__						\
       ("mtctr %0\n\t"							\
        "bctrl\n\t"							\
        "mfcr  %0\n\t"							\
        "0:"								\
-       : "=&r" (r0),							\
-         "=&r" (r3), "=&r" (r4), "=&r" (r5),				\
-         "=&r" (r6), "=&r" (r7), "=&r" (r8)				\
-       : ASM_INPUT_##nr							\
-       : "r9", "r10", "r11", "r12",					\
-         "cr0", "ctr", "lr", "memory");					\
-	  err = (long int) r0;						\
-    r3;								\
+       : "+r" (r0), "+r" (r3), "+r" (r4), "+r" (r5),  "+r" (r6),        \
+         "+r" (r7), "+r" (r8)						\
+       : : "r9", "r10", "r11", "r12", "cr0", "ctr", "lr", "memory");	\
+    err = (long int) r0;						\
+    __asm__ __volatile__ ("" : "=r" (rval) : "r" (r3));		        \
+    rval;								\
   })
 
 #undef INLINE_SYSCALL

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