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

[Commits] r24045 - in /fsf/trunk/libc: ./ elf/ ports/ ports/sysdeps/mips/ ports/sysdeps/mips/bits/ ports/sysdeps/mips/mips64/soft-fp/ ...



Author: eglibc
Date: Thu Sep 19 00:02:06 2013
New Revision: 24045

Log:
Import glibc-mainline for 2013-09-19

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/config.h.in
    fsf/trunk/libc/elf/cache.c
    fsf/trunk/libc/elf/elf.h
    fsf/trunk/libc/ports/ChangeLog.mips
    fsf/trunk/libc/ports/sysdeps/mips/bits/nan.h
    fsf/trunk/libc/ports/sysdeps/mips/configure
    fsf/trunk/libc/ports/sysdeps/mips/configure.in
    fsf/trunk/libc/ports/sysdeps/mips/dl-machine.h
    fsf/trunk/libc/ports/sysdeps/mips/fpu_control.h
    fsf/trunk/libc/ports/sysdeps/mips/math_private.h
    fsf/trunk/libc/ports/sysdeps/mips/mips64/soft-fp/sfp-machine.h
    fsf/trunk/libc/ports/sysdeps/mips/shlib-versions
    fsf/trunk/libc/ports/sysdeps/mips/soft-fp/sfp-machine.h
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/Makefile
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/configure
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/configure.in
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/dl-cache.h
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/readelflib.c
    fsf/trunk/libc/sysdeps/generic/ldconfig.h
    fsf/trunk/libc/sysdeps/ieee754/dbl-64/sincos32.c
    fsf/trunk/libc/sysdeps/powerpc/fpu_control.h
    fsf/trunk/libc/sysdeps/powerpc/powerpc32/Makefile
    fsf/trunk/libc/sysdeps/powerpc/powerpc32/__longjmp-common.S
    fsf/trunk/libc/sysdeps/powerpc/powerpc32/setjmp-common.S

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Thu Sep 19 00:02:06 2013
@@ -1,3 +1,52 @@
+2013-09-18  Maciej W. Rozycki  <macro@xxxxxxxxxxxxxxxx>
+
+	* config.h.in (HAVE_MIPS_NAN2008): New macro.
+	* elf/elf.h (EF_MIPS_NAN2008): Likewise.
+	* sysdeps/generic/ldconfig.h (FLAG_MIPS_LIB32_NAN2008): Likewise.
+	(FLAG_MIPS64_LIBN32_NAN2008): Likewise.
+	(FLAG_MIPS64_LIBN64_NAN2008): Likewise.
+	* elf/cache.c (print_entry): Handle the new cache flags.
+
+2013-09-18  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+	    Aldy Hernandez  <aldyh@xxxxxxxxxx>
+
+	* sysdeps/powerpc/fpu_control.h [_SOFT_FLOAT || __NO_FPRS__]:
+	Change condition to [_SOFT_FLOAT].
+	[__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_RC_NEAREST): New macro.
+	[__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_RC_DOWN): Likewise.
+	[__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_RC_UP): Likewise.
+	[__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_RC_ZERO): Likewise.
+	[__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_MASK_ZM): Likewise.
+	[__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_MASK_OM): Likewise.
+	[__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_MASK_UM): Likewise.
+	[__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_MASK_XM): Likewise.
+	[__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_MASK_IM): Likewise.
+	[__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_RESERVED): Likewise.
+	[__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_DEFAULT): Likewise.
+	[__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_IEEE): Likewise.
+	[__NO_FPRS__ && !_SOFT_FLOAT] (fpu_control_t): New typedef.
+	[__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_GETCW): New macro.
+	[__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_SETCW): Likewise.
+	[__NO_FPRS__ && !_SOFT_FLOAT] (__fpu_control): New variable
+	declaration.
+
+2013-09-18  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* sysdeps/powerpc/powerpc32/__longjmp-common.S (LOAD_GP): Define
+	macro conditional on [__SPE__ || (__NO_FPRS__ && !_SOFT_FLOAT)].
+	(__longjmp): Use LOAD_GP to load saved GPRs.
+	* sysdeps/powerpc/powerpc32/setjmp-common.S (SAVE_GP): Define
+	macro conditional on [__SPE__ || (__NO_FPRS__ && !_SOFT_FLOAT)].
+	(__sigsetjmp): Use SAVE_GP to save GPRs.
+
+	* sysdeps/powerpc/powerpc32/Makefile [$(with-fp) = no] (+cflags):
+	Do not append -msoft-float.
+	[$(with-fp) = no] (sysdep-LDFLAGS): Likewise.
+
+2013-09-18  Siddhesh Poyarekar  <siddhesh@xxxxxxxxxx>
+
+	* sysdeps/ieee754/dbl-64/sincos32.c: Fix code formatting.
+
 2013-09-17  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
 
 	[BZ #15966]

Modified: fsf/trunk/libc/config.h.in
==============================================================================
--- fsf/trunk/libc/config.h.in (original)
+++ fsf/trunk/libc/config.h.in Thu Sep 19 00:02:06 2013
@@ -238,4 +238,8 @@
 /* The pt_chown binary is being built and used by grantpt.  */
 #undef HAVE_PT_CHOWN
 
-#endif
+/* ports/sysdeps/mips/configure.in  */
+/* Define if using the IEEE 754-2008 NaN encoding on the MIPS target.  */
+#undef HAVE_MIPS_NAN2008
+
+#endif

Modified: fsf/trunk/libc/elf/cache.c
==============================================================================
--- fsf/trunk/libc/elf/cache.c (original)
+++ fsf/trunk/libc/elf/cache.c Thu Sep 19 00:02:06 2013
@@ -104,6 +104,15 @@
     /* Uses the ARM soft-float ABI.  */
     case FLAG_ARM_LIBSF:
       fputs (",soft-float", stdout);
+      break;
+    case FLAG_MIPS_LIB32_NAN2008:
+      fputs (",nan2008", stdout);
+      break;
+    case FLAG_MIPS64_LIBN32_NAN2008:
+      fputs (",N32,nan2008", stdout);
+      break;
+    case FLAG_MIPS64_LIBN64_NAN2008:
+      fputs (",64bit,nan2008", stdout);
       break;
     case 0:
       break;

Modified: fsf/trunk/libc/elf/elf.h
==============================================================================
--- fsf/trunk/libc/elf/elf.h (original)
+++ fsf/trunk/libc/elf/elf.h Thu Sep 19 00:02:06 2013
@@ -1383,6 +1383,7 @@
 #define EF_MIPS_64BIT_WHIRL	16
 #define EF_MIPS_ABI2		32
 #define EF_MIPS_ABI_ON32	64
+#define EF_MIPS_NAN2008	1024  /* Uses IEEE 754-2008 NaN encoding.  */
 #define EF_MIPS_ARCH		0xf0000000 /* MIPS architecture level.  */
 
 /* Legal values for MIPS architecture level.  */

Modified: fsf/trunk/libc/ports/ChangeLog.mips
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.mips (original)
+++ fsf/trunk/libc/ports/ChangeLog.mips Thu Sep 19 00:02:06 2013
@@ -1,3 +1,71 @@
+2013-09-18  Maciej W. Rozycki  <macro@xxxxxxxxxxxxxxxx>
+            Thomas Schwinge  <thomas@xxxxxxxxxxxxxxxx>
+
+	* sysdeps/mips/dl-machine.h (ELF_MACHINE_NAN2008): New macro.
+	(elf_machine_matches_host): Reject objects that use a different
+	NaN encoding convention.
+	* sysdeps/mips/fpu_control.h: Document IEEE 754-2008 feature
+	control bits.
+	(_FPU_ABS2008, _FPU_NAN2008): New macros.
+	(_FPU_RESERVED): Clear bits #20 and #19.
+	(_FPU_DEFAULT) [__mips_nan2008]: Set bit #18.
+	(_FPU_IEEE) [__mips_nan2008]: Likewise.
+	* sysdeps/mips/math_private.h [__mips_nan2008]
+	(HIGH_ORDER_BIT_IS_SET_FOR_SNAN): Don't define.
+	* sysdeps/mips/bits/nan.h [__mips_nan2008] (__qnan_bytes): Define
+	appropriately.
+	* sysdeps/mips/mips64/soft-fp/sfp-machine.h [__mips_nan2008]
+	(_FP_NANFRAC_S, _FP_NANFRAC_D, _FP_NANFRAC_Q): Define 2008-NaN
+	payloads.
+	(_FP_QNANNEGATEDP): Set to 0.
+	* sysdeps/mips/soft-fp/sfp-machine.h [__mips_nan2008]
+	(_FP_NANFRAC_S, _FP_NANFRAC_D, _FP_NANFRAC_Q): Define 2008-NaN
+	payloads.
+	(_FP_QNANNEGATEDP): Set to 0.
+	* sysdeps/unix/sysv/linux/mips/dl-cache.h (_DL_CACHE_DEFAULT_ID):
+	Define 2008 NaN encoding values.
+	* sysdeps/unix/sysv/linux/mips/readelflib.c (process_elf_file):
+	Handle 2008-NaN libraries.
+	* sysdeps/mips/shlib-versions [HAVE_MIPS_NAN2008]: Set
+	ld=ld-linux-mipsn8.so.1.
+	* sysdeps/mips/configure.in: Define HAVE_MIPS_NAN2008 if the
+	2008 NaN encoding is used.
+	* sysdeps/unix/sysv/linux/mips/Makefile (abi-variants): Add
+	2008-NaN ABI variants.
+	(abi-o32_soft-options, abi-o32_soft-condition): Update with the
+	__mips_nan2008 macro.
+	(abi-o32_hard-options, abi-o32_hard-condition): Likewise.
+	(abi-n32_soft-options, abi-n32_soft-condition): Likewise.
+	(abi-n32_hard-options, abi-n32_hard-condition): Likewise.
+	(abi-n64_soft-options, abi-n64_soft-condition): Likewise.
+	(abi-n64_hard-options, abi-n64_hard-condition): Likewise.
+	(abi-o32_soft-ld-soname, abi-o32_hard-ld-soname): New macros.
+	(abi-n32_soft-ld-soname, abi-n32_hard-ld-soname): Likewise.
+	(abi-n64_soft-ld-soname, abi-n64_hard-ld-soname): Likewise.
+	(abi-o32_soft_2008-options): Likewise.
+	(abi-o32_soft_2008-condition): Likewise.
+	(abi-o32_hard_2008-options): Likewise.
+	(abi-o32_hard_2008-condition): Likewise.
+	(abi-n32_soft_2008-options): Likewise.
+	(abi-n32_soft_2008-condition): Likewise.
+	(abi-n32_hard_2008-options): Likewise.
+	(abi-n32_hard_2008-condition): Likewise.
+	(abi-n64_soft_2008-options): Likewise.
+	(abi-n64_soft_2008-condition): Likewise.
+	(abi-n64_hard_2008-options): Likewise.
+	(abi-n64_hard_2008-condition): Likewise.
+	(abi-o32_soft_2008-ld-soname): Likewise.
+	(abi-o32_hard_2008-ld-soname): Likewise.
+	(abi-n32_soft_2008-ld-soname): Likewise.
+	(abi-n32_hard_2008-ld-soname): Likewise.
+	(abi-n64_soft_2008-ld-soname): Likewise.
+	(abi-n64_hard_2008-ld-soname): Likewise.
+	* sysdeps/unix/sysv/linux/mips/configure.in: Include the NaN
+	encoding selection in default-abi.  Set arch_minimum_kernel to
+	10.0.0 if 2008 NaN encoding is used.
+	* sysdeps/mips/configure: Regenerate.
+	* sysdeps/unix/sysv/linux/mips/configure: Regenerate.
+
 2013-08-30   OndÃÂej BÃÂlka  <neleai@xxxxxxxxx>
 
 	* sysdeps/mips/memcpy.S: Fix then/than typos.

Modified: fsf/trunk/libc/ports/sysdeps/mips/bits/nan.h
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/mips/bits/nan.h (original)
+++ fsf/trunk/libc/ports/sysdeps/mips/bits/nan.h Thu Sep 19 00:02:06 2013
@@ -22,16 +22,19 @@
 
 
 /* IEEE Not A Number.  */
-/* Note that MIPS has the qNaN and sNaN patterns reversed compared to most
-   other architectures.  IEEE 754-1985 left the definition of this open to
-   implementations, and for MIPS the top bit of the mantissa must be SET to
-   indicate a sNaN.  */
+/* In legacy-NaN mode MIPS has the qNaN and sNaN patterns reversed
+   compared to most other architectures.  IEEE 754-1985 left the
+   definition of this open to implementations, and for MIPS the top bit
+   of the mantissa must be SET to indicate a sNaN.  In 2008-NaN mode
+   MIPS aligned to IEEE 754-2008.  */
 
 #if __GNUC_PREREQ(3,3)
 
 # define NAN	(__builtin_nanf (""))
 
 #elif defined __GNUC__
+
+/* No 2008-NaN mode support in any GCC version before 4.9.  */
 
 # define NAN \
   (__extension__							      \
@@ -43,10 +46,18 @@
 # include <endian.h>
 
 # if __BYTE_ORDER == __BIG_ENDIAN
-#  define __qnan_bytes		{ 0x7f, 0xbf, 0xff, 0xff }
+#  ifdef __mips_nan2008
+#   define __qnan_bytes		{ 0x7f, 0xc0, 0, 0 }
+#  else
+#   define __qnan_bytes		{ 0x7f, 0xbf, 0xff, 0xff }
+#  endif
 # endif
 # if __BYTE_ORDER == __LITTLE_ENDIAN
-#  define __qnan_bytes		{ 0xff, 0xff, 0xbf, 0x7f }
+#  ifdef __mips_nan2008
+#   define __qnan_bytes		{ 0, 0, 0xc0, 0x7f }
+#  else
+#   define __qnan_bytes		{ 0xff, 0xff, 0xbf, 0x7f }
+#  endif
 # endif
 
 static union { unsigned char __c[4]; float __d; } __qnan_union

Modified: fsf/trunk/libc/ports/sysdeps/mips/configure
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/mips/configure (original)
+++ fsf/trunk/libc/ports/sysdeps/mips/configure Thu Sep 19 00:02:06 2013
@@ -1,3 +1,163 @@
 # This file is generated from configure.in by Autoconf.  DO NOT EDIT!
  # Local configure fragment for sysdeps/mips.
 
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$GREP"; then
+  ac_path_GREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in grep ggrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+  # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_GREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_GREP"; then
+    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     if test -z "$EGREP"; then
+  ac_path_EGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in egrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+  # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_EGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_EGREP"; then
+    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_EGREP=$EGREP
+fi
+
+   fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler is using the 2008 NaN encoding" >&5
+$as_echo_n "checking whether the compiler is using the 2008 NaN encoding... " >&6; }
+if ${libc_cv_mips_nan2008+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+dnl
+#ifdef __mips_nan2008
+yes
+#endif
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "yes" >/dev/null 2>&1; then :
+  libc_cv_mips_nan2008=yes
+else
+  libc_cv_mips_nan2008=no
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mips_nan2008" >&5
+$as_echo "$libc_cv_mips_nan2008" >&6; }
+if test x$libc_cv_mips_nan2008 = xyes; then
+  $as_echo "#define HAVE_MIPS_NAN2008 1" >>confdefs.h
+
+fi

Modified: fsf/trunk/libc/ports/sysdeps/mips/configure.in
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/mips/configure.in (original)
+++ fsf/trunk/libc/ports/sysdeps/mips/configure.in Thu Sep 19 00:02:06 2013
@@ -4,3 +4,12 @@
 dnl No MIPS GCC supports accessing static and hidden symbols in an
 dnl position independent way.
 dnl AC_DEFINE(PI_STATIC_AND_HIDDEN)
+
+AC_CACHE_CHECK([whether the compiler is using the 2008 NaN encoding],
+  libc_cv_mips_nan2008, [AC_EGREP_CPP(yes, [dnl
+#ifdef __mips_nan2008
+yes
+#endif], libc_cv_mips_nan2008=yes, libc_cv_mips_nan2008=no)])
+if test x$libc_cv_mips_nan2008 = xyes; then
+  AC_DEFINE(HAVE_MIPS_NAN2008)
+fi

Modified: fsf/trunk/libc/ports/sysdeps/mips/dl-machine.h
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/mips/dl-machine.h (original)
+++ fsf/trunk/libc/ports/sysdeps/mips/dl-machine.h Thu Sep 19 00:02:06 2013
@@ -73,6 +73,16 @@
        (ElfW(Addr)) (r); \
    } while (0)
 
+#if ((defined __mips_nan2008 && !defined HAVE_MIPS_NAN2008) \
+     || (!defined __mips_nan2008 && defined HAVE_MIPS_NAN2008))
+# error "Configuration inconsistency: __mips_nan2008 != HAVE_MIPS_NAN2008, overridden CFLAGS?"
+#endif
+#ifdef __mips_nan2008
+# define ELF_MACHINE_NAN2008 EF_MIPS_NAN2008
+#else
+# define ELF_MACHINE_NAN2008 0
+#endif
+
 /* Return nonzero iff ELF header is compatible with the running host.  */
 static inline int __attribute_used__
 elf_machine_matches_host (const ElfW(Ehdr) *ehdr)
@@ -82,6 +92,10 @@
   if (((ehdr->e_flags & EF_MIPS_ABI2) != 0) != (_MIPS_SIM == _ABIN32))
     return 0;
 #endif
+
+  /* Don't link 2008-NaN and legacy-NaN objects together.  */
+  if ((ehdr->e_flags & EF_MIPS_NAN2008) != ELF_MACHINE_NAN2008)
+    return 0;
 
   switch (ehdr->e_machine)
     {

Modified: fsf/trunk/libc/ports/sysdeps/mips/fpu_control.h
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/mips/fpu_control.h (original)
+++ fsf/trunk/libc/ports/sysdeps/mips/fpu_control.h Thu Sep 19 00:02:06 2013
@@ -29,7 +29,9 @@
  *           available for MIPS III and newer.
  * 23     -> Condition bit
  * 22-21  -> reserved for architecture implementers
- * 20-18  -> reserved (read as 0, write with 0)
+ * 20     -> reserved (read as 0, write with 0)
+ * 19     -> IEEE 754-2008 non-arithmetic ABS.fmt and NEG.fmt enable
+ * 18     -> IEEE 754-2008 recommended NaN encoding enable
  * 17     -> cause bit for unimplemented operation
  * 16     -> cause bit for invalid exception
  * 15     -> cause bit for division by zero exception
@@ -79,22 +81,33 @@
 /* flush denormalized numbers to zero */
 #define _FPU_FLUSH_TZ   0x1000000
 
+/* IEEE 754-2008 compliance control.  */
+#define _FPU_ABS2008    0x80000
+#define _FPU_NAN2008    0x40000
+
 /* rounding control */
 #define _FPU_RC_NEAREST 0x0     /* RECOMMENDED */
 #define _FPU_RC_ZERO    0x1
 #define _FPU_RC_UP      0x2
 #define _FPU_RC_DOWN    0x3
 
-#define _FPU_RESERVED 0xfe9c0000  /* Reserved bits in cw */
+#define _FPU_RESERVED 0xfe840000  /* Reserved bits in cw, incl NAN2008.  */
 
 
 /* The fdlibm code requires strict IEEE double precision arithmetic,
    and no interrupts for exceptions, rounding to nearest.  */
+#ifdef __mips_nan2008
+# define _FPU_DEFAULT 0x00040000
+#else
+# define _FPU_DEFAULT 0x00000000
+#endif
 
-#define _FPU_DEFAULT  0x00000000
-
-/* IEEE:  same as above, but exceptions */
-#define _FPU_IEEE     0x00000F80
+/* IEEE: same as above, but exceptions.  */
+#ifdef __mips_nan2008
+# define _FPU_IEEE    0x00040F80
+#else
+# define _FPU_IEEE    0x00000F80
+#endif
 
 /* Type of the control word.  */
 typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__SI__)));

Modified: fsf/trunk/libc/ports/sysdeps/mips/math_private.h
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/mips/math_private.h (original)
+++ fsf/trunk/libc/ports/sysdeps/mips/math_private.h Thu Sep 19 00:02:06 2013
@@ -18,9 +18,13 @@
 
 #ifndef _MATH_PRIVATE_H
 
+#ifdef __mips_nan2008
+/* MIPS aligned to IEEE 754-2008.  */
+#else
 /* One of the few architectures where the meaning of the quiet/signaling bit is
    inverse to IEEE 754-2008 (as well as common practice for IEEE 754-1985).  */
-#define HIGH_ORDER_BIT_IS_SET_FOR_SNAN
+# define HIGH_ORDER_BIT_IS_SET_FOR_SNAN
+#endif
 
 #include_next <math_private.h>
 

Modified: fsf/trunk/libc/ports/sysdeps/mips/mips64/soft-fp/sfp-machine.h
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/mips/mips64/soft-fp/sfp-machine.h (original)
+++ fsf/trunk/libc/ports/sysdeps/mips/mips64/soft-fp/sfp-machine.h Thu Sep 19 00:02:06 2013
@@ -24,15 +24,25 @@
 #define _FP_DIV_MEAT_D(R,X,Y)	_FP_DIV_MEAT_1_udiv_norm(D,R,X,Y)
 #define _FP_DIV_MEAT_Q(R,X,Y)	_FP_DIV_MEAT_2_udiv(Q,R,X,Y)
 
-#define _FP_NANFRAC_S		(_FP_QNANBIT_S - 1)
-#define _FP_NANFRAC_D		(_FP_QNANBIT_D - 1)
-#define _FP_NANFRAC_Q		(_FP_QNANBIT_Q - 1), -1
+#ifdef __mips_nan2008
+# define _FP_NANFRAC_S		((_FP_QNANBIT_S << 1) - 1)
+# define _FP_NANFRAC_D		((_FP_QNANBIT_D << 1) - 1)
+# define _FP_NANFRAC_Q		((_FP_QNANBIT_Q << 1) - 1), -1
+#else
+# define _FP_NANFRAC_S		(_FP_QNANBIT_S - 1)
+# define _FP_NANFRAC_D		(_FP_QNANBIT_D - 1)
+# define _FP_NANFRAC_Q		(_FP_QNANBIT_Q - 1), -1
+#endif
 #define _FP_NANSIGN_S		0
 #define _FP_NANSIGN_D		0
 #define _FP_NANSIGN_Q		0
 
 #define _FP_KEEPNANFRACP 1
-#define _FP_QNANNEGATEDP 1
+#ifdef __mips_nan2008
+# define _FP_QNANNEGATEDP 0
+#else
+# define _FP_QNANNEGATEDP 1
+#endif
 
 /* From my experiments it seems X is chosen unless one of the
    NaNs is sNaN,  in which case the result is NANSIGN/NANFRAC.  */

Modified: fsf/trunk/libc/ports/sysdeps/mips/shlib-versions
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/mips/shlib-versions (original)
+++ fsf/trunk/libc/ports/sysdeps/mips/shlib-versions Thu Sep 19 00:02:06 2013
@@ -3,7 +3,11 @@
 # Working mips versions were never released between 2.0 and 2.2.
 mips.*-.*-linux.*	libc=6			GLIBC_2.0 GLIBC_2.2
 
+%ifdef HAVE_MIPS_NAN2008
+mips.*-.*-linux.*	ld=ld-linux-mipsn8.so.1	GLIBC_2.0 GLIBC_2.2
+%else
 mips.*-.*-linux.*	ld=ld.so.1		GLIBC_2.0 GLIBC_2.2
+%endif
 mips.*-.*-linux.*	libdl=2			GLIBC_2.0 GLIBC_2.2
 
 mips.*-.*-linux.*	libresolv=2		GLIBC_2.0 GLIBC_2.2

Modified: fsf/trunk/libc/ports/sysdeps/mips/soft-fp/sfp-machine.h
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/mips/soft-fp/sfp-machine.h (original)
+++ fsf/trunk/libc/ports/sysdeps/mips/soft-fp/sfp-machine.h Thu Sep 19 00:02:06 2013
@@ -21,15 +21,25 @@
 #define _FP_DIV_MEAT_D(R,X,Y)	_FP_DIV_MEAT_2_udiv(D,R,X,Y)
 #define _FP_DIV_MEAT_Q(R,X,Y)	_FP_DIV_MEAT_4_udiv(Q,R,X,Y)
 
-#define _FP_NANFRAC_S		(_FP_QNANBIT_S - 1)
-#define _FP_NANFRAC_D		(_FP_QNANBIT_D - 1), -1
-#define _FP_NANFRAC_Q		(_FP_QNANBIT_Q - 1), -1, -1, -1
+#ifdef __mips_nan2008
+# define _FP_NANFRAC_S		((_FP_QNANBIT_S << 1) - 1)
+# define _FP_NANFRAC_D		((_FP_QNANBIT_D << 1) - 1), -1
+# define _FP_NANFRAC_Q		((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1
+#else
+# define _FP_NANFRAC_S		(_FP_QNANBIT_S - 1)
+# define _FP_NANFRAC_D		(_FP_QNANBIT_D - 1), -1
+# define _FP_NANFRAC_Q		(_FP_QNANBIT_Q - 1), -1, -1, -1
+#endif
 #define _FP_NANSIGN_S		0
 #define _FP_NANSIGN_D		0
 #define _FP_NANSIGN_Q		0
 
 #define _FP_KEEPNANFRACP 1
-#define _FP_QNANNEGATEDP 1
+#ifdef __mips_nan2008
+# define _FP_QNANNEGATEDP 0
+#else
+# define _FP_QNANNEGATEDP 1
+#endif
 
 /* From my experiments it seems X is chosen unless one of the
    NaNs is sNaN,  in which case the result is NANSIGN/NANFRAC.  */

Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/Makefile
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/Makefile (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/Makefile Thu Sep 19 00:02:06 2013
@@ -8,7 +8,9 @@
 sysdep_headers += sys/cachectl.h sys/sysmips.h sys/tas.h
 endif
 
-abi-variants := o32_soft o32_hard n32_soft n32_hard n64_soft n64_hard
+abi-variants := o32_soft o32_hard o32_soft_2008 o32_hard_2008
+abi-variants += n32_soft n32_hard n32_soft_2008 n32_hard_2008
+abi-variants += n64_soft n64_hard n64_soft_2008 n64_hard_2008
 
 ifeq (,$(filter $(default-abi),$(abi-variants)))
 Unknown ABI, must be one of $(abi-variants)
@@ -18,29 +20,89 @@
 
 # _MIPS_SIM_ABI32 == 1, _MIPS_SIM_NABI32 == 2, _MIPS_SIM_ABI64 == 3
 abi-o32_soft-options := -U_MIPS_SIM -D_MIPS_SIM=1 \
-			-D__mips_soft_float -U__mips_hard_float
-abi-o32_soft-condition := defined(__mips_soft_float) \
-			   && (_MIPS_SIM == _MIPS_SIM_ABI32)
+			-D__mips_soft_float -U__mips_hard_float \
+			-U__mips_nan2008
+abi-o32_soft-condition := !defined(__mips_nan2008) \
+			  && defined(__mips_soft_float) \
+			  && (_MIPS_SIM == _MIPS_SIM_ABI32)
+abi-o32_soft-ld-soname := ld.so.1
 abi-o32_hard-options := -U_MIPS_SIM -D_MIPS_SIM=1 \
-			-D__mips_hard_float -U__mips_soft_float
-abi-o32_hard-condition := defined(__mips_hard_float) \
+			-D__mips_hard_float -U__mips_soft_float \
+			-U__mips_nan2008
+abi-o32_hard-condition := !defined(__mips_nan2008) \
+			  && defined(__mips_hard_float) \
 			  && (_MIPS_SIM == _MIPS_SIM_ABI32)
+abi-o32_hard-ld-soname := ld.so.1
+abi-o32_soft_2008-options := -U_MIPS_SIM -D_MIPS_SIM=1 \
+			     -D__mips_soft_float -U__mips_hard_float \
+			     -D__mips_nan2008
+abi-o32_soft_2008-condition := defined(__mips_nan2008) \
+			       && defined(__mips_soft_float) \
+			       && (_MIPS_SIM == _MIPS_SIM_ABI32)
+abi-o32_soft_2008-ld-soname := ld-linux-mipsn8.so.1
+abi-o32_hard_2008-options := -U_MIPS_SIM -D_MIPS_SIM=1 \
+			     -D__mips_hard_float -U__mips_soft_float \
+			     -D__mips_nan2008
+abi-o32_hard_2008-condition := defined(__mips_nan2008) \
+			       && defined(__mips_hard_float) \
+			       && (_MIPS_SIM == _MIPS_SIM_ABI32)
+abi-o32_hard_2008-ld-soname := ld-linux-mipsn8.so.1
 abi-n32_soft-options := -U_MIPS_SIM -D_MIPS_SIM=2 \
-			-D__mips_soft_float -U__mips_hard_float
-abi-n32_soft-condition := defined(__mips_soft_float) \
+			-D__mips_soft_float -U__mips_hard_float \
+			-U__mips_nan2008
+abi-n32_soft-condition := !defined(__mips_nan2008) \
+			  && defined(__mips_soft_float) \
 			  && (_MIPS_SIM == _MIPS_SIM_NABI32)
+abi-n32_soft-ld-soname := ld.so.1
 abi-n32_hard-options := -U_MIPS_SIM -D_MIPS_SIM=2 \
-			-D__mips_hard_float -U__mips_soft_float
-abi-n32_hard-condition := defined(__mips_hard_float) \
+			-D__mips_hard_float -U__mips_soft_float \
+			-U__mips_nan2008
+abi-n32_hard-condition := !defined(__mips_nan2008) \
+			  && defined(__mips_hard_float) \
 			  && (_MIPS_SIM == _MIPS_SIM_NABI32)
+abi-n32_hard-ld-soname := ld.so.1
+abi-n32_soft_2008-options := -U_MIPS_SIM -D_MIPS_SIM=2 \
+			     -D__mips_soft_float -U__mips_hard_float \
+			     -D__mips_nan2008
+abi-n32_soft_2008-condition := defined(__mips_nan2008) \
+			       && defined(__mips_soft_float) \
+			       && (_MIPS_SIM == _MIPS_SIM_NABI32)
+abi-n32_soft_2008-ld-soname := ld-linux-mipsn8.so.1
+abi-n32_hard_2008-options := -U_MIPS_SIM -D_MIPS_SIM=2 \
+			     -D__mips_hard_float -U__mips_soft_float \
+			     -D__mips_nan2008
+abi-n32_hard_2008-condition := defined(__mips_nan2008) \
+			       && defined(__mips_hard_float) \
+			       && (_MIPS_SIM == _MIPS_SIM_NABI32)
+abi-n32_hard_2008-ld-soname := ld-linux-mipsn8.so.1
 abi-n64_soft-options := -U_MIPS_SIM -D_MIPS_SIM=3 \
-			-D__mips_soft_float -U__mips_hard_float
-abi-n64_soft-condition := defined(__mips_soft_float) \
+			-D__mips_soft_float -U__mips_hard_float \
+			-U__mips_nan2008
+abi-n64_soft-condition := !defined(__mips_nan2008) \
+			  && defined(__mips_soft_float) \
 			  && (_MIPS_SIM == _MIPS_SIM_ABI64)
+abi-n64_soft-ld-soname := ld.so.1
 abi-n64_hard-options := -U_MIPS_SIM -D_MIPS_SIM=3 \
-			-D__mips_hard_float -U__mips_soft_float
-abi-n64_hard-condition := defined(__mips_hard_float) \
+			-D__mips_hard_float -U__mips_soft_float \
+			-U__mips_nan2008
+abi-n64_hard-condition := !defined(__mips_nan2008) \
+			  && defined(__mips_hard_float) \
 			  && (_MIPS_SIM == _MIPS_SIM_ABI64)
+abi-n64_hard-ld-soname := ld.so.1
+abi-n64_soft_2008-options := -U_MIPS_SIM -D_MIPS_SIM=3 \
+			     -D__mips_soft_float -U__mips_hard_float \
+			     -D__mips_nan2008
+abi-n64_soft_2008-condition := defined(__mips_nan2008) \
+			       && defined(__mips_soft_float) \
+			       && (_MIPS_SIM == _MIPS_SIM_ABI64)
+abi-n64_soft_2008-ld-soname := ld-linux-mipsn8.so.1
+abi-n64_hard_2008-options := -U_MIPS_SIM -D_MIPS_SIM=3 \
+			     -D__mips_hard_float -U__mips_soft_float \
+			     -D__mips_nan2008
+abi-n64_hard_2008-condition := defined(__mips_nan2008) \
+			       && defined(__mips_hard_float) \
+			       && (_MIPS_SIM == _MIPS_SIM_ABI64)
+abi-n64_hard_2008-ld-soname := ld-linux-mipsn8.so.1
 
 ifeq ($(subdir),elf)
 ifeq ($(build-shared),yes)

Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/configure
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/configure (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/configure Thu Sep 19 00:02:06 2013
@@ -105,8 +105,168 @@
   as_fn_error $? "could not determine if compiler is using hard or soft floating point ABI" "$LINENO" 5
 fi
 
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$GREP"; then
+  ac_path_GREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in grep ggrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+  # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_GREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_GREP"; then
+    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     if test -z "$EGREP"; then
+  ac_path_EGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in egrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+  # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_EGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_EGREP"; then
+    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_EGREP=$EGREP
+fi
+
+   fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler is using the 2008 NaN encoding" >&5
+$as_echo_n "checking whether the compiler is using the 2008 NaN encoding... " >&6; }
+if ${libc_cv_mips_nan2008+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+dnl
+#ifdef __mips_nan2008
+yes
+#endif
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "yes" >/dev/null 2>&1; then :
+  libc_cv_mips_nan2008=yes
+else
+  libc_cv_mips_nan2008=no
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mips_nan2008" >&5
+$as_echo "$libc_cv_mips_nan2008" >&6; }
+
+libc_mips_nan=
+if test x"$libc_cv_mips_nan2008" = xyes; then
+  libc_mips_nan=_2008
+fi
+
 config_vars="$config_vars
-default-abi = ${libc_mips_abi}_${libc_mips_float}"
+default-abi = ${libc_mips_abi}_${libc_mips_float}${libc_mips_nan}"
 
 case "$prefix" in
 /usr | /usr/)
@@ -138,3 +298,12 @@
 esac
 
 libc_cv_gcc_unwind_find_fde=yes
+
+if test -z "$arch_minimum_kernel"; then
+  if test x$libc_cv_mips_nan2008 = xyes; then
+    # FIXME: Adjust this setting to the actual first upstream kernel
+    # version to support the 2008 NaN encoding and then remove this
+    # comment.
+    arch_minimum_kernel=10.0.0
+  fi
+fi

Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/configure.in
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/configure.in (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/configure.in Thu Sep 19 00:02:06 2013
@@ -44,7 +44,19 @@
   AC_MSG_ERROR([could not determine if compiler is using hard or soft floating point ABI])
 fi
 
-LIBC_CONFIG_VAR([default-abi], [${libc_mips_abi}_${libc_mips_float}])
+AC_CACHE_CHECK([whether the compiler is using the 2008 NaN encoding],
+  libc_cv_mips_nan2008, [AC_EGREP_CPP(yes, [dnl
+#ifdef __mips_nan2008
+yes
+#endif], libc_cv_mips_nan2008=yes, libc_cv_mips_nan2008=no)])
+
+libc_mips_nan=
+if test x"$libc_cv_mips_nan2008" = xyes; then
+  libc_mips_nan=_2008
+fi
+
+LIBC_CONFIG_VAR([default-abi],
+  [${libc_mips_abi}_${libc_mips_float}${libc_mips_nan}])
 
 case "$prefix" in
 /usr | /usr/)
@@ -76,3 +88,12 @@
 esac
 
 libc_cv_gcc_unwind_find_fde=yes
+
+if test -z "$arch_minimum_kernel"; then
+  if test x$libc_cv_mips_nan2008 = xyes; then
+    # FIXME: Adjust this setting to the actual first upstream kernel
+    # version to support the 2008 NaN encoding and then remove this
+    # comment.
+    arch_minimum_kernel=10.0.0
+  fi
+fi

Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/dl-cache.h
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/dl-cache.h (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/dl-cache.h Thu Sep 19 00:02:06 2013
@@ -18,11 +18,27 @@
 
 #include <ldconfig.h>
 
-/* Redefine the cache ID for new ABIs; o32 keeps using the generic check.  */
-#if _MIPS_SIM == _ABI64
-# define _DL_CACHE_DEFAULT_ID	(FLAG_MIPS64_LIBN64 | FLAG_ELF_LIBC6)
-#elif _MIPS_SIM == _ABIN32
-# define _DL_CACHE_DEFAULT_ID	(FLAG_MIPS64_LIBN32 | FLAG_ELF_LIBC6)
+#if ((defined __mips_nan2008 && !defined HAVE_MIPS_NAN2008) \
+     || (!defined __mips_nan2008 && defined HAVE_MIPS_NAN2008))
+# error "Configuration inconsistency: __mips_nan2008 != HAVE_MIPS_NAN2008, overridden CFLAGS?"
+#endif
+
+/* Redefine the cache ID for new ABIs and 2008 NaN support; legacy o32
+   keeps using the generic check.  */
+#ifdef __mips_nan2008
+# if _MIPS_SIM == _ABIO32
+#  define _DL_CACHE_DEFAULT_ID	(FLAG_MIPS_LIB32_NAN2008 | FLAG_ELF_LIBC6)
+# elif _MIPS_SIM == _ABI64
+#  define _DL_CACHE_DEFAULT_ID	(FLAG_MIPS64_LIBN64_NAN2008 | FLAG_ELF_LIBC6)
+# elif _MIPS_SIM == _ABIN32
+#  define _DL_CACHE_DEFAULT_ID	(FLAG_MIPS64_LIBN32_NAN2008 | FLAG_ELF_LIBC6)
+# endif
+#else
+# if _MIPS_SIM == _ABI64
+#  define _DL_CACHE_DEFAULT_ID	(FLAG_MIPS64_LIBN64 | FLAG_ELF_LIBC6)
+# elif _MIPS_SIM == _ABIN32
+#  define _DL_CACHE_DEFAULT_ID	(FLAG_MIPS64_LIBN32 | FLAG_ELF_LIBC6)
+# endif
 #endif
 
 #ifdef _DL_CACHE_DEFAULT_ID

Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/readelflib.c
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/readelflib.c (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/readelflib.c Thu Sep 19 00:02:06 2013
@@ -33,19 +33,32 @@
 		  unsigned int *osversion, char **soname, void *file_contents,
 		  size_t file_length)
 {
-  ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
+  union
+    {
+      Elf64_Ehdr *eh64;
+      Elf32_Ehdr *eh32;
+      ElfW(Ehdr) *eh;
+    }
+  elf_header;
   int ret;
 
-  if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
+  elf_header.eh = file_contents;
+  if (elf_header.eh->e_ident [EI_CLASS] == ELFCLASS32)
     {
-      Elf32_Ehdr *elf32_header = (Elf32_Ehdr *) elf_header;
-
       ret = process_elf32_file (file_name, lib, flag, osversion, soname,
 				file_contents, file_length);
+      if (!ret)
+	{
+	  Elf32_Word flags = elf_header.eh32->e_flags;
+	  int nan2008 = (flags & EF_MIPS_NAN2008) != 0;
 
-      /* n32 libraries are always libc.so.6+.  */
-      if (!ret && (elf32_header->e_flags & EF_MIPS_ABI2) != 0)
-	*flag = FLAG_MIPS64_LIBN32|FLAG_ELF_LIBC6;
+	  /* n32 libraries are always libc.so.6+, o32 only if 2008 NaN.  */
+	  if ((flags & EF_MIPS_ABI2) != 0)
+	    *flag = (nan2008 ? FLAG_MIPS64_LIBN32_NAN2008
+		     : FLAG_MIPS64_LIBN32) | FLAG_ELF_LIBC6;
+	  else if (nan2008)
+	    *flag = FLAG_MIPS_LIB32_NAN2008 | FLAG_ELF_LIBC6;
+	}
     }
   else
     {
@@ -53,7 +66,13 @@
 				file_contents, file_length);
       /* n64 libraries are always libc.so.6+.  */
       if (!ret)
-	*flag = FLAG_MIPS64_LIBN64|FLAG_ELF_LIBC6;
+	{
+	  Elf64_Word flags = elf_header.eh64->e_flags;
+	  int nan2008 = (flags & EF_MIPS_NAN2008) != 0;
+
+	  *flag = (nan2008 ? FLAG_MIPS64_LIBN64_NAN2008
+		   : FLAG_MIPS64_LIBN64) | FLAG_ELF_LIBC6;
+	}
     }
 
   return ret;

Modified: fsf/trunk/libc/sysdeps/generic/ldconfig.h
==============================================================================
--- fsf/trunk/libc/sysdeps/generic/ldconfig.h (original)
+++ fsf/trunk/libc/sysdeps/generic/ldconfig.h Thu Sep 19 00:02:06 2013
@@ -21,24 +21,27 @@
 
 #include <stdint.h>
 
-#define FLAG_ANY		-1
-#define FLAG_TYPE_MASK		0x00ff
-#define FLAG_LIBC4		0x0000
-#define FLAG_ELF		0x0001
-#define FLAG_ELF_LIBC5		0x0002
-#define FLAG_ELF_LIBC6		0x0003
-#define FLAG_REQUIRED_MASK	0xff00
-#define FLAG_SPARC_LIB64	0x0100
-#define FLAG_IA64_LIB64		0x0200
-#define FLAG_X8664_LIB64	0x0300
-#define FLAG_S390_LIB64		0x0400
-#define FLAG_POWERPC_LIB64	0x0500
-#define FLAG_MIPS64_LIBN32	0x0600
-#define FLAG_MIPS64_LIBN64	0x0700
-#define FLAG_X8664_LIBX32	0x0800
-#define FLAG_ARM_LIBHF		0x0900
-#define FLAG_AARCH64_LIB64	0x0a00
-#define FLAG_ARM_LIBSF		0x0b00
+#define FLAG_ANY			-1
+#define FLAG_TYPE_MASK			0x00ff
+#define FLAG_LIBC4			0x0000
+#define FLAG_ELF			0x0001
+#define FLAG_ELF_LIBC5			0x0002
+#define FLAG_ELF_LIBC6			0x0003
+#define FLAG_REQUIRED_MASK		0xff00
+#define FLAG_SPARC_LIB64		0x0100
+#define FLAG_IA64_LIB64			0x0200
+#define FLAG_X8664_LIB64		0x0300
+#define FLAG_S390_LIB64			0x0400
+#define FLAG_POWERPC_LIB64		0x0500
+#define FLAG_MIPS64_LIBN32		0x0600
+#define FLAG_MIPS64_LIBN64		0x0700
+#define FLAG_X8664_LIBX32		0x0800
+#define FLAG_ARM_LIBHF			0x0900
+#define FLAG_AARCH64_LIB64		0x0a00
+#define FLAG_ARM_LIBSF			0x0b00
+#define FLAG_MIPS_LIB32_NAN2008		0x0c00
+#define FLAG_MIPS64_LIBN32_NAN2008	0x0d00
+#define FLAG_MIPS64_LIBN64_NAN2008	0x0e00
 
 /* Name of auxiliary cache.  */
 #define _PATH_LDCONFIG_AUX_CACHE "/var/cache/ldconfig/aux-cache"

Modified: fsf/trunk/libc/sysdeps/ieee754/dbl-64/sincos32.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/dbl-64/sincos32.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/dbl-64/sincos32.c Thu Sep 19 00:02:06 2013
@@ -48,312 +48,330 @@
 # define SECTION
 #endif
 
-/****************************************************************/
-/* Compute Multi-Precision sin() function for given p.  Receive */
-/* Multi  Precision number x and result stored at y             */
-/****************************************************************/
+/* Compute Multi-Precision sin() function for given p.  Receive Multi Precision
+   number x and result stored at y.  */
 static void
 SECTION
-ss32(mp_no *x, mp_no *y, int p) {
+ss32 (mp_no *x, mp_no *y, int p)
+{
   int i;
   double a;
-  mp_no mpt1,x2,gor,sum ,mpk={1,{1.0}};
-  for (i=1;i<=p;i++) mpk.d[i]=0;
-
-  __sqr(x,&x2,p);
-  __cpy(&oofac27,&gor,p);
-  __cpy(&gor,&sum,p);
-  for (a=27.0;a>1.0;a-=2.0) {
-    mpk.d[1]=a*(a-1.0);
-    __mul(&gor,&mpk,&mpt1,p);
-    __cpy(&mpt1,&gor,p);
-    __mul(&x2,&sum,&mpt1,p);
-    __sub(&gor,&mpt1,&sum,p);
-  }
-  __mul(x,&sum,y,p);
-}
-
-/**********************************************************************/
-/* Compute Multi-Precision cos() function for given p. Receive Multi  */
-/* Precision number x and result stored at y                          */
-/**********************************************************************/
+  mp_no mpt1, x2, gor, sum, mpk = {1, {1.0}};
+  for (i = 1; i <= p; i++)
+    mpk.d[i] = 0;
+
+  __sqr (x, &x2, p);
+  __cpy (&oofac27, &gor, p);
+  __cpy (&gor, &sum, p);
+  for (a = 27.0; a > 1.0; a -= 2.0)
+    {
+      mpk.d[1] = a * (a - 1.0);
+      __mul (&gor, &mpk, &mpt1, p);
+      __cpy (&mpt1, &gor, p);
+      __mul (&x2, &sum, &mpt1, p);
+      __sub (&gor, &mpt1, &sum, p);
+    }
+  __mul (x, &sum, y, p);
+}
+
+/* Compute Multi-Precision cos() function for given p. Receive Multi Precision
+   number x and result stored at y.  */
 static void
 SECTION
-cc32(mp_no *x, mp_no *y, int p) {
+cc32 (mp_no *x, mp_no *y, int p)
+{
   int i;
   double a;
-  mp_no mpt1,x2,gor,sum ,mpk={1,{1.0}};
-  for (i=1;i<=p;i++) mpk.d[i]=0;
-
-  __sqr(x,&x2,p);
-  mpk.d[1]=27.0;
-  __mul(&oofac27,&mpk,&gor,p);
-  __cpy(&gor,&sum,p);
-  for (a=26.0;a>2.0;a-=2.0) {
-    mpk.d[1]=a*(a-1.0);
-    __mul(&gor,&mpk,&mpt1,p);
-    __cpy(&mpt1,&gor,p);
-    __mul(&x2,&sum,&mpt1,p);
-    __sub(&gor,&mpt1,&sum,p);
-  }
-  __mul(&x2,&sum,y,p);
-}
-
-/***************************************************************************/
-/* c32()   computes both sin(x), cos(x) as Multi precision numbers         */
-/***************************************************************************/
+  mp_no mpt1, x2, gor, sum, mpk = {1, {1.0}};
+  for (i = 1; i <= p; i++)
+    mpk.d[i] = 0;
+
+  __sqr (x, &x2, p);
+  mpk.d[1] = 27.0;
+  __mul (&oofac27, &mpk, &gor, p);
+  __cpy (&gor, &sum, p);
+  for (a = 26.0; a > 2.0; a -= 2.0)
+    {
+      mpk.d[1] = a * (a - 1.0);
+      __mul (&gor, &mpk, &mpt1, p);
+      __cpy (&mpt1, &gor, p);
+      __mul (&x2, &sum, &mpt1, p);
+      __sub (&gor, &mpt1, &sum, p);
+    }
+  __mul (&x2, &sum, y, p);
+}
+
+/* Compute both sin(x), cos(x) as Multi precision numbers.  */
 void
 SECTION
-__c32(mp_no *x, mp_no *y, mp_no *z, int p) {
-  mp_no u,t,t1,t2,c,s;
+__c32 (mp_no *x, mp_no *y, mp_no *z, int p)
+{
+  mp_no u, t, t1, t2, c, s;
   int i;
-  __cpy(x,&u,p);
-  u.e=u.e-1;
-  cc32(&u,&c,p);
-  ss32(&u,&s,p);
-  for (i=0;i<24;i++) {
-    __mul(&c,&s,&t,p);
-    __sub(&s,&t,&t1,p);
-    __add(&t1,&t1,&s,p);
-    __sub(&mptwo,&c,&t1,p);
-    __mul(&t1,&c,&t2,p);
-    __add(&t2,&t2,&c,p);
-  }
-  __sub(&mpone,&c,y,p);
-  __cpy(&s,z,p);
-}
-
-/************************************************************************/
-/*Routine receive double x and two double results of sin(x) and return  */
-/*result which is more accurate                                         */
-/*Computing sin(x) with multi precision routine c32                     */
-/************************************************************************/
-double
-SECTION
-__sin32(double x, double res, double res1) {
-  int p;
-  mp_no a,b,c;
-  p=32;
-  __dbl_mp(res,&a,p);
-  __dbl_mp(0.5*(res1-res),&b,p);
-  __add(&a,&b,&c,p);
-  if (x>0.8)
-  { __sub(&hp,&c,&a,p);
-    __c32(&a,&b,&c,p);
-  }
-  else __c32(&c,&a,&b,p);     /* b=sin(0.5*(res+res1))  */
-  __dbl_mp(x,&c,p);           /* c = x                  */
-  __sub(&b,&c,&a,p);
-  /* if a>0 return min(res,res1), otherwise return max(res,res1) */
-  if (a.d[0]>0)  return (res<res1)?res:res1;
-  else  return (res>res1)?res:res1;
-}
-
-/************************************************************************/
-/*Routine receive double x and two double results of cos(x) and return  */
-/*result which is more accurate                                         */
-/*Computing cos(x) with multi precision routine c32                     */
-/************************************************************************/
-double
-SECTION
-__cos32(double x, double res, double res1) {
-  int p;
-  mp_no a,b,c;
-  p=32;
-  __dbl_mp(res,&a,p);
-  __dbl_mp(0.5*(res1-res),&b,p);
-  __add(&a,&b,&c,p);
-  if (x>2.4)
-  { __sub(&pi,&c,&a,p);
-    __c32(&a,&b,&c,p);
-    b.d[0]=-b.d[0];
-  }
-  else if (x>0.8)
-       { __sub(&hp,&c,&a,p);
-	 __c32(&a,&c,&b,p);
-       }
-  else __c32(&c,&b,&a,p);     /* b=cos(0.5*(res+res1))  */
-  __dbl_mp(x,&c,p);    /* c = x                  */
-  __sub(&b,&c,&a,p);
-	     /* if a>0 return max(res,res1), otherwise return min(res,res1) */
-  if (a.d[0]>0)  return (res>res1)?res:res1;
-  else  return (res<res1)?res:res1;
-}
-
-/*******************************************************************/
-/*Compute sin(x+dx) as Multi Precision number and return result as */
-/* double                                                          */
-/*******************************************************************/
-double
-SECTION
-__mpsin(double x, double dx) {
+  __cpy (x, &u, p);
+  u.e = u.e - 1;
+  cc32 (&u, &c, p);
+  ss32 (&u, &s, p);
+  for (i = 0; i < 24; i++)
+    {
+      __mul (&c, &s, &t, p);
+      __sub (&s, &t, &t1, p);
+      __add (&t1, &t1, &s, p);
+      __sub (&mptwo, &c, &t1, p);
+      __mul (&t1, &c, &t2, p);
+      __add (&t2, &t2, &c, p);
+    }
+  __sub (&mpone, &c, y, p);
+  __cpy (&s, z, p);
+}
+
+/* Receive double x and two double results of sin(x) and return result which is
+   more accurate, computing sin(x) with multi precision routine c32.  */
+double
+SECTION
+__sin32 (double x, double res, double res1)
+{
+  int p;
+  mp_no a, b, c;
+  p = 32;
+  __dbl_mp (res, &a, p);
+  __dbl_mp (0.5 * (res1 - res), &b, p);
+  __add (&a, &b, &c, p);
+  if (x > 0.8)
+    {
+      __sub (&hp, &c, &a, p);
+      __c32 (&a, &b, &c, p);
+    }
+  else
+    __c32 (&c, &a, &b, p);	/* b=sin(0.5*(res+res1))  */
+  __dbl_mp (x, &c, p);		/* c = x  */
+  __sub (&b, &c, &a, p);
+  /* if a > 0 return min (res, res1), otherwise return max (res, res1).  */
+  if (a.d[0] > 0)
+    return (res < res1) ? res : res1;
+  else
+    return (res > res1) ? res : res1;
+}
+
+/* Receive double x and two double results of cos(x) and return result which is
+   more accurate, computing cos(x) with multi precision routine c32.  */
+double
+SECTION
+__cos32 (double x, double res, double res1)
+{
+  int p;
+  mp_no a, b, c;
+  p = 32;
+  __dbl_mp (res, &a, p);
+  __dbl_mp (0.5 * (res1 - res), &b, p);
+  __add (&a, &b, &c, p);
+  if (x > 2.4)
+    {
+      __sub (&pi, &c, &a, p);
+      __c32 (&a, &b, &c, p);
+      b.d[0] = -b.d[0];
+    }
+  else if (x > 0.8)
+    {
+      __sub (&hp, &c, &a, p);
+      __c32 (&a, &c, &b, p);
+    }
+  else
+    __c32 (&c, &b, &a, p);	/* b=cos(0.5*(res+res1))  */
+  __dbl_mp (x, &c, p);		/* c = x                  */
+  __sub (&b, &c, &a, p);
+  /* if a > 0 return max (res, res1), otherwise return min (res, res1).  */
+  if (a.d[0] > 0)
+    return (res > res1) ? res : res1;
+  else
+    return (res < res1) ? res : res1;
+}
+
+/* Compute sin(x+dx) as Multi Precision number and return result as double.  */
+double
+SECTION
+__mpsin (double x, double dx)
+{
   int p;
   double y;
-  mp_no a,b,c;
-  p=32;
-  __dbl_mp(x,&a,p);
-  __dbl_mp(dx,&b,p);
-  __add(&a,&b,&c,p);
-  if (x>0.8) { __sub(&hp,&c,&a,p); __c32(&a,&b,&c,p); }
-  else __c32(&c,&a,&b,p);     /* b = sin(x+dx)     */
-  __mp_dbl(&b,&y,p);
+  mp_no a, b, c;
+  p = 32;
+  __dbl_mp (x, &a, p);
+  __dbl_mp (dx, &b, p);
+  __add (&a, &b, &c, p);
+  if (x > 0.8)
+    {
+      __sub (&hp, &c, &a, p);
+      __c32 (&a, &b, &c, p);
+    }
+  else
+    __c32 (&c, &a, &b, p);	/* b = sin(x+dx)  */
+  __mp_dbl (&b, &y, p);
   return y;
 }
 
-/*******************************************************************/
-/* Compute cos()of double-length number (x+dx) as Multi Precision  */
-/* number and return result as double                              */
-/*******************************************************************/
-double
-SECTION
-__mpcos(double x, double dx) {
+/* Compute cos() of double-length number (x+dx) as Multi Precision number and
+   return result as double.  */
+double
+SECTION
+__mpcos (double x, double dx)
+{
   int p;
   double y;
-  mp_no a,b,c;
-  p=32;
-  __dbl_mp(x,&a,p);
-  __dbl_mp(dx,&b,p);
-  __add(&a,&b,&c,p);
-  if (x>0.8)
-  { __sub(&hp,&c,&b,p);
-    __c32(&b,&c,&a,p);
-  }
-  else __c32(&c,&a,&b,p);     /* a = cos(x+dx)     */
-  __mp_dbl(&a,&y,p);
+  mp_no a, b, c;
+  p = 32;
+  __dbl_mp (x, &a, p);
+  __dbl_mp (dx, &b, p);
+  __add (&a, &b, &c, p);
+  if (x > 0.8)
+    {
+      __sub (&hp, &c, &b, p);
+      __c32 (&b, &c, &a, p);
+    }
+  else
+    __c32 (&c, &a, &b, p);	/* a = cos(x+dx)     */
+  __mp_dbl (&a, &y, p);
   return y;
 }
 
-/******************************************************************/
-/* mpranred() performs range reduction of a double number x into  */
-/* multi precision number y, such that y=x-n*pi/2, abs(y)<pi/4,   */
-/* n=0,+-1,+-2,....                                               */
-/* Return int which indicates in which quarter of circle x is     */
-/******************************************************************/
+/* Perform range reduction of a double number x into multi precision number y,
+   such that y = x - n * pi / 2, abs (y) < pi / 4, n = 0, +-1, +-2, ...
+   Return int which indicates in which quarter of circle x is.  */
 int
 SECTION
-__mpranred(double x, mp_no *y, int p)
+__mpranred (double x, mp_no *y, int p)
 {
   number v;
-  double t,xn;
-  int i,k,n;
-  mp_no a,b,c;
-
-  if (ABS(x) < 2.8e14) {
-    t = (x*hpinv.d + toint.d);
-    xn = t - toint.d;
-    v.d = t;
-    n =v.i[LOW_HALF]&3;
-    __dbl_mp(xn,&a,p);
-    __mul(&a,&hp,&b,p);
-    __dbl_mp(x,&c,p);
-    __sub(&c,&b,y,p);
-    return n;
-  }
-  else {                      /* if x is very big more precision required */
-    __dbl_mp(x,&a,p);
-    a.d[0]=1.0;
-    k = a.e-5;
-    if (k < 0) k=0;
-    b.e = -k;
-    b.d[0] = 1.0;
-    for (i=0;i<p;i++) b.d[i+1] = toverp[i+k];
-    __mul(&a,&b,&c,p);
-    t = c.d[c.e];
-    for (i=1;i<=p-c.e;i++) c.d[i]=c.d[i+c.e];
-    for (i=p+1-c.e;i<=p;i++) c.d[i]=0;
-    c.e=0;
-    if (c.d[1] >= HALFRAD)
-    { t +=1.0;
-      __sub(&c,&mpone,&b,p);
-      __mul(&b,&hp,y,p);
-    }
-    else __mul(&c,&hp,y,p);
-    n = (int) t;
-    if (x < 0) { y->d[0] = - y->d[0]; n = -n; }
-    return (n&3);
-  }
-}
-
-/*******************************************************************/
-/* Multi-Precision sin() function subroutine, for p=32.  It is     */
-/* based on the routines mpranred() and c32().                     */
-/*******************************************************************/
-double
-SECTION
-__mpsin1(double x)
+  double t, xn;
+  int i, k, n;
+  mp_no a, b, c;
+
+  if (ABS (x) < 2.8e14)
+    {
+      t = (x * hpinv.d + toint.d);
+      xn = t - toint.d;
+      v.d = t;
+      n = v.i[LOW_HALF] & 3;
+      __dbl_mp (xn, &a, p);
+      __mul (&a, &hp, &b, p);
+      __dbl_mp (x, &c, p);
+      __sub (&c, &b, y, p);
+      return n;
+    }
+  else
+    {
+      /* If x is very big more precision required.  */
+      __dbl_mp (x, &a, p);
+      a.d[0] = 1.0;
+      k = a.e - 5;
+      if (k < 0)
+	k = 0;
+      b.e = -k;
+      b.d[0] = 1.0;
+      for (i = 0; i < p; i++)
+	b.d[i + 1] = toverp[i + k];
+      __mul (&a, &b, &c, p);
+      t = c.d[c.e];
+      for (i = 1; i <= p - c.e; i++)
+	c.d[i] = c.d[i + c.e];
+      for (i = p + 1 - c.e; i <= p; i++)
+	c.d[i] = 0;
+      c.e = 0;
+      if (c.d[1] >= HALFRAD)
+	{
+	  t += 1.0;
+	  __sub (&c, &mpone, &b, p);
+	  __mul (&b, &hp, y, p);
+	}
+      else
+	__mul (&c, &hp, y, p);
+      n = (int) t;
+      if (x < 0)
+	{
+	  y->d[0] = -y->d[0];
+	  n = -n;
+	}
+      return (n & 3);
+    }
+}
+
+/* Multi-Precision sin() function subroutine, for p = 32.  It is based on the
+   routines mpranred() and c32().  */
+double
+SECTION
+__mpsin1 (double x)
 {
   int p;
   int n;
-  mp_no u,s,c;
+  mp_no u, s, c;
   double y;
-  p=32;
-  n=__mpranred(x,&u,p);               /* n is 0, 1, 2 or 3 */
-  __c32(&u,&c,&s,p);
-  switch (n) {                      /* in which quarter of unit circle y is*/
-  case 0:
-    __mp_dbl(&s,&y,p);
-    return y;
-    break;
-
-  case 2:
-    __mp_dbl(&s,&y,p);
-    return -y;
-    break;
-
-  case 1:
-    __mp_dbl(&c,&y,p);
-    return y;
-    break;
-
-  case 3:
-    __mp_dbl(&c,&y,p);
-    return -y;
-    break;
-
-  }
-  return 0;                     /* unreachable, to make the compiler happy */
-}
-
-/*****************************************************************/
-/* Multi-Precision cos() function subroutine, for p=32.  It is   */
-/* based  on the routines mpranred() and c32().                  */
-/*****************************************************************/
-
-double
-SECTION
-__mpcos1(double x)
+  p = 32;
+  n = __mpranred (x, &u, p);	/* n is 0, 1, 2 or 3.  */
+  __c32 (&u, &c, &s, p);
+  /* Convert result based on which quarter of unit circle y is in.  */
+  switch (n)
+    {
+    case 0:
+      __mp_dbl (&s, &y, p);
+      return y;
+      break;
+
+    case 2:
+      __mp_dbl (&s, &y, p);
+      return -y;
+      break;
+
+    case 1:
+      __mp_dbl (&c, &y, p);
+      return y;
+      break;
+
+    case 3:
+      __mp_dbl (&c, &y, p);
+      return -y;
+      break;
+    }
+  /* Unreachable, to make the compiler happy.  */
+  return 0;
+}
+
+/* Multi-Precision cos() function subroutine, for p = 32.  It is based on the
+   routines mpranred() and c32().  */
+double
+SECTION
+__mpcos1 (double x)
 {
   int p;
   int n;
-  mp_no u,s,c;
+  mp_no u, s, c;
   double y;
 
-  p=32;
-  n=__mpranred(x,&u,p);              /* n is 0, 1, 2 or 3 */
-  __c32(&u,&c,&s,p);
-  switch (n) {                     /* in what quarter of unit circle y is*/
-
-  case 0:
-    __mp_dbl(&c,&y,p);
-    return y;
-    break;
-
-  case 2:
-    __mp_dbl(&c,&y,p);
-    return -y;
-    break;
-
-  case 1:
-    __mp_dbl(&s,&y,p);
-    return -y;
-    break;
-
-  case 3:
-    __mp_dbl(&s,&y,p);
-    return y;
-    break;
-
-  }
-  return 0;                     /* unreachable, to make the compiler happy */
-}
-/******************************************************************/
+  p = 32;
+  n = __mpranred (x, &u, p);	/* n is 0, 1, 2 or 3.  */
+  __c32 (&u, &c, &s, p);
+  /* Convert result based on which quarter of unit circle y is in.  */
+  switch (n)
+    {
+    case 0:
+      __mp_dbl (&c, &y, p);
+      return y;
+      break;
+
+    case 2:
+      __mp_dbl (&c, &y, p);
+      return -y;
+      break;
+
+    case 1:
+      __mp_dbl (&s, &y, p);
+      return -y;
+      break;
+
+    case 3:
+      __mp_dbl (&s, &y, p);
+      return y;
+      break;
+    }
+  /* Unreachable, to make the compiler happy.  */
+  return 0;
+}

Modified: fsf/trunk/libc/sysdeps/powerpc/fpu_control.h
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/fpu_control.h (original)
+++ fsf/trunk/libc/sysdeps/powerpc/fpu_control.h Thu Sep 19 00:02:06 2013
@@ -19,13 +19,50 @@
 #ifndef _FPU_CONTROL_H
 #define _FPU_CONTROL_H
 
-#if defined _SOFT_FLOAT || defined __NO_FPRS__
+#ifdef _SOFT_FLOAT
 
 # define _FPU_RESERVED 0xffffffff
 # define _FPU_DEFAULT  0x00000000 /* Default value.  */
 typedef unsigned int fpu_control_t;
 # define _FPU_GETCW(cw) (cw) = 0
 # define _FPU_SETCW(cw) (void) (cw)
+extern fpu_control_t __fpu_control;
+
+#elif defined __NO_FPRS__ /* e500 */
+
+/* rounding control */
+# define _FPU_RC_NEAREST 0x00   /* RECOMMENDED */
+# define _FPU_RC_DOWN    0x03
+# define _FPU_RC_UP      0x02
+# define _FPU_RC_ZERO    0x01
+
+/* masking of interrupts */
+# define _FPU_MASK_ZM  0x10 /* zero divide */
+# define _FPU_MASK_OM  0x40 /* overflow */
+# define _FPU_MASK_UM  0x80 /* underflow */
+# define _FPU_MASK_XM  0x40 /* inexact */
+# define _FPU_MASK_IM  0x20 /* invalid operation */
+
+# define _FPU_RESERVED 0xff3fff7f /* These bits are reserved and not changed. */
+
+/* The fdlibm code requires no interrupts for exceptions.  */
+# define _FPU_DEFAULT  0x00000000 /* Default value.  */
+
+/* IEEE:  same as above, but (some) exceptions;
+   we leave the 'inexact' exception off.
+ */
+# define _FPU_IEEE     0x000003c0
+
+/* Type of the control word.  */
+typedef unsigned int fpu_control_t;
+
+/* Macros for accessing the hardware control word.  */
+# define _FPU_GETCW(cw) \
+  __asm__ volatile ("mfspefscr %0" : "=r" (cw))
+# define _FPU_SETCW(cw) \
+  __asm__ volatile ("mtspefscr %0" : : "r" (cw))
+
+/* Default control word set at startup.  */
 extern fpu_control_t __fpu_control;
 
 #else /* PowerPC 6xx floating-point.  */

Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/Makefile
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/Makefile (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/Makefile Thu Sep 19 00:02:06 2013
@@ -1,9 +1,4 @@
 # Powerpc32 specific build options.
-
-ifeq ($(with-fp),no)
-+cflags += -msoft-float
-sysdep-LDFLAGS += -msoft-float
-endif
 
 ifeq ($(subdir),gmon)
 sysdep_routines += ppc-mcount compat-ppc-mcount

Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/__longjmp-common.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/__longjmp-common.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/__longjmp-common.S Thu Sep 19 00:02:06 2013
@@ -24,6 +24,12 @@
 # include <jmpbuf-offsets.h>
 #endif
 
+#if defined __SPE__ || (defined __NO_FPRS__ && !defined _SOFT_FLOAT)
+# define LOAD_GP(N)	evldd r##N,((JB_FPRS+((N)-14)*2)*4)(r3)
+#else
+# define LOAD_GP(N)	lwz r##N,((JB_GPRS+(N)-14)*4)(r3)
+#endif
+
 ENTRY (__longjmp)
 
 #if defined PTR_DEMANGLE || defined CHECK_SP
@@ -39,13 +45,13 @@
 	lwz r1,(JB_GPR1*4)(r3)
 #endif
 	lwz r0,(JB_LR*4)(r3)
-	lwz r14,((JB_GPRS+0)*4)(r3)
-	lwz r15,((JB_GPRS+1)*4)(r3)
-	lwz r16,((JB_GPRS+2)*4)(r3)
-	lwz r17,((JB_GPRS+3)*4)(r3)
-	lwz r18,((JB_GPRS+4)*4)(r3)
-	lwz r19,((JB_GPRS+5)*4)(r3)
-	lwz r20,((JB_GPRS+6)*4)(r3)
+	LOAD_GP (14)
+	LOAD_GP (15)
+	LOAD_GP (16)
+	LOAD_GP (17)
+	LOAD_GP (18)
+	LOAD_GP (19)
+	LOAD_GP (20)
 #ifdef PTR_DEMANGLE
 # ifndef CHECK_SP
 	PTR_DEMANGLE3 (r1, r24, r25)
@@ -53,19 +59,19 @@
 	PTR_DEMANGLE2 (r0, r25)
 #endif
 	mtlr r0
-	lwz r21,((JB_GPRS+7)*4)(r3)
-	lwz r22,((JB_GPRS+8)*4)(r3)
+	LOAD_GP (21)
+	LOAD_GP (22)
 	lwz r0,(JB_CR*4)(r3)
-	lwz r23,((JB_GPRS+9)*4)(r3)
-	lwz r24,((JB_GPRS+10)*4)(r3)
-	lwz r25,((JB_GPRS+11)*4)(r3)
+	LOAD_GP (23)
+	LOAD_GP (24)
+	LOAD_GP (25)
 	mtcrf 0xFF,r0
-	lwz r26,((JB_GPRS+12)*4)(r3)
-	lwz r27,((JB_GPRS+13)*4)(r3)
-	lwz r28,((JB_GPRS+14)*4)(r3)
-	lwz r29,((JB_GPRS+15)*4)(r3)
-	lwz r30,((JB_GPRS+16)*4)(r3)
-	lwz r31,((JB_GPRS+17)*4)(r3)
+	LOAD_GP (26)
+	LOAD_GP (27)
+	LOAD_GP (28)
+	LOAD_GP (29)
+	LOAD_GP (30)
+	LOAD_GP (31)
 	mr r3,r4
 	blr
 END (__longjmp)

Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/setjmp-common.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/setjmp-common.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/setjmp-common.S Thu Sep 19 00:02:06 2013
@@ -24,6 +24,11 @@
 # include <jmpbuf-offsets.h>
 #endif
 
+#if defined __SPE__ || (defined __NO_FPRS__ && !defined _SOFT_FLOAT)
+# define SAVE_GP(N)	evstdd r##N,((JB_FPRS+((N)-14)*2)*4)(3)
+#else
+# define SAVE_GP(N)	stw r##N,((JB_GPRS+(N)-14)*4)(3)
+#endif
 
 ENTRY (__sigsetjmp)
 
@@ -35,31 +40,31 @@
 	stw  r1,(JB_GPR1*4)(3)
 #endif
 	mflr r0
-	stw  r14,((JB_GPRS+0)*4)(3)
+	SAVE_GP (14)
 #ifdef PTR_MANGLE
 	PTR_MANGLE2 (r0, r10)
 	li   r10,0
 #endif
 	stw  r0,(JB_LR*4)(3)
-	stw  r15,((JB_GPRS+1)*4)(3)
+	SAVE_GP (15)
 	mfcr r0
-	stw  r16,((JB_GPRS+2)*4)(3)
+	SAVE_GP (16)
 	stw  r0,(JB_CR*4)(3)
-	stw  r17,((JB_GPRS+3)*4)(3)
-	stw  r18,((JB_GPRS+4)*4)(3)
-	stw  r19,((JB_GPRS+5)*4)(3)
-	stw  r20,((JB_GPRS+6)*4)(3)
-	stw  r21,((JB_GPRS+7)*4)(3)
-	stw  r22,((JB_GPRS+8)*4)(3)
-	stw  r23,((JB_GPRS+9)*4)(3)
-	stw  r24,((JB_GPRS+10)*4)(3)
-	stw  r25,((JB_GPRS+11)*4)(3)
-	stw  r26,((JB_GPRS+12)*4)(3)
-	stw  r27,((JB_GPRS+13)*4)(3)
-	stw  r28,((JB_GPRS+14)*4)(3)
-	stw  r29,((JB_GPRS+15)*4)(3)
-	stw  r30,((JB_GPRS+16)*4)(3)
-	stw  r31,((JB_GPRS+17)*4)(3)
+	SAVE_GP (17)
+	SAVE_GP (18)
+	SAVE_GP (19)
+	SAVE_GP (20)
+	SAVE_GP (21)
+	SAVE_GP (22)
+	SAVE_GP (23)
+	SAVE_GP (24)
+	SAVE_GP (25)
+	SAVE_GP (26)
+	SAVE_GP (27)
+	SAVE_GP (28)
+	SAVE_GP (29)
+	SAVE_GP (30)
+	SAVE_GP (31)
 #if defined NOT_IN_libc && defined IS_IN_rtld
 	li   r3,0
 	blr

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