From 246ec411990908950e96332213bc6d11d19a17f9 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 12 Apr 2008 00:51:34 +0000 Subject: * sysdeps/powerpc/fpu/fenv_libc.h: Add libm_hidden_proto for __fe_nomask_env. * sysdeps/powerpc/fpu/fe_nomask.c: Add libm_hidden_def. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/fe_nomask.c: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/fe_nomask.c: Likewise. * sysdeps/powerpc/bits/fenv.h: Make safe for C++. * sysdeps/unix/sysv/linux/powerpc/bits/mathinline.h: New file. * sysdeps/powerpc/fpu/fegetexcept.c (__fegetexcept): Rename function from fegetexcept and make old name weak alias. * include/fenv.h: Declare __fegetexcept. * sysdeps/powerpc/fpu/fedisblxcpt.c: Use __fegetexcept instead of fegetexcept. * sysdeps/powerpc/fpu/feenablxcpt.c: Likewise. * sysdeps/powerpc/fpu/fraiseexcpt.c (__feraiseexcept): Avoid call to fetestexcept. * sysdeps/ieee754/ldbl-128ibm/s_log1pl.c (__log1pl): Use __frexpl instead of frexpl to avoid local PLT. * math/s_significandl.c (__significandl): Use __ilogbl instead of ilogbl to avoid local PLT. * sysdeps/ieee754/ldbl-128ibm/s_expm1l.c (__expm1l): Use __ldexpl instead of ldexpl to avoid local PLT. * sysdeps/ieee754/ldbl-128ibm/e_expl.c (__ieee754_expl): Use __roundl not roundl to avoid local PLT. * sysdeps/ieee754/ldbl-128/e_j0l.c: Use function names which avoid local PLTs. Use __sincosl instead of separate sinl and cosl calls. * sysdeps/ieee754/ldbl-128/e_j1l.c: Likewise. --- sysdeps/unix/sysv/linux/configure | 191 ++++++++++++++++++--- sysdeps/unix/sysv/linux/powerpc/bits/mathinline.h | 132 ++++++++++++++ .../sysv/linux/powerpc/powerpc32/fpu/fe_nomask.c | 3 +- .../sysv/linux/powerpc/powerpc64/fpu/fe_nomask.c | 5 +- 4 files changed, 306 insertions(+), 25 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/powerpc/bits/mathinline.h (limited to 'sysdeps/unix/sysv/linux') diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure index a8a9cc4702..253e9c57ff 100644 --- a/sysdeps/unix/sysv/linux/configure +++ b/sysdeps/unix/sysv/linux/configure @@ -22,23 +22,170 @@ if test -n "$sysheaders"; then fi -echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6 -if test "${ac_cv_prog_egrep+set}" = set; then +{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 +echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } +if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' + # Extract the first word of "grep ggrep" to use in msg output +if test -z "$GREP"; then +set dummy grep ggrep; ac_prog_name=$2 +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + 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 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + 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 + ac_count=`expr $ac_count + 1` + 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 + + +fi + +GREP="$ac_cv_path_GREP" +if test -z "$GREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } fi -echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep + +else + ac_cv_path_GREP=$GREP +fi + + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +echo "${ECHO_T}$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" -echo "$as_me:$LINENO: checking installed Linux kernel header files" >&5 -echo $ECHO_N "checking installed Linux kernel header files... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + # Extract the first word of "egrep" to use in msg output +if test -z "$EGREP"; then +set dummy egrep; ac_prog_name=$2 +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + 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 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + 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 + ac_count=`expr $ac_count + 1` + 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 + + +fi + +EGREP="$ac_cv_path_EGREP" +if test -z "$EGREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_EGREP=$EGREP +fi + + + fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ echo "$as_me:$LINENO: checking installed Linux kernel header files" >&5 +echo $ECHO_N "checking installed Linux kernel header files... $ECHO_C" >&6; } if test "${libc_cv_linux2010+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -62,8 +209,8 @@ fi rm -f conftest* fi -echo "$as_me:$LINENO: result: $libc_cv_linux2010" >&5 -echo "${ECHO_T}$libc_cv_linux2010" >&6 +{ echo "$as_me:$LINENO: result: $libc_cv_linux2010" >&5 +echo "${ECHO_T}$libc_cv_linux2010" >&6; } if test "$libc_cv_linux2010" != '2.0.10 or later'; then { { echo "$as_me:$LINENO: error: GNU libc requires kernel header files from Linux 2.0.10 or later to be installed before configuring. @@ -120,7 +267,7 @@ case "$machine" in arch_minimum_kernel=2.0.10 ;; powerpc/powerpc64) - arch_minimum_kernel=2.4.19 + arch_minimum_kernel=2.4.21 ;; s390/s390-32) libc_cv_gcc_unwind_find_fde=yes @@ -166,8 +313,8 @@ else fi if test -n "$minimum_kernel"; then - echo "$as_me:$LINENO: checking for kernel header at least $minimum_kernel" >&5 -echo $ECHO_N "checking for kernel header at least $minimum_kernel... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking for kernel header at least $minimum_kernel" >&5 +echo $ECHO_N "checking for kernel header at least $minimum_kernel... $ECHO_C" >&6; } decnum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/(\1 * 65536 + \2 * 256 + \3)/'`; abinum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1,\2,\3/'`; cat >conftest.$ac_ext <<_ACEOF @@ -189,8 +336,8 @@ else fi rm -f conftest* - echo "$as_me:$LINENO: result: $libc_minimum_kernel" >&5 -echo "${ECHO_T}$libc_minimum_kernel" >&6 + { echo "$as_me:$LINENO: result: $libc_minimum_kernel" >&5 +echo "${ECHO_T}$libc_minimum_kernel" >&6; } if test "$libc_minimum_kernel" = ok; then cat >>confdefs.h <<_ACEOF #define __LINUX_KERNEL_VERSION $decnum @@ -333,8 +480,8 @@ if test $host = $build; then else ac_prefix=$ac_default_prefix fi - echo "$as_me:$LINENO: checking for symlinks in ${ac_prefix}/include" >&5 -echo $ECHO_N "checking for symlinks in ${ac_prefix}/include... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking for symlinks in ${ac_prefix}/include" >&5 +echo $ECHO_N "checking for symlinks in ${ac_prefix}/include... $ECHO_C" >&6; } ac_message= if test -L ${ac_prefix}/include/net; then ac_message="$ac_message @@ -355,8 +502,8 @@ Delete the links and re-run configure, or better still, move the entire ${ac_prefix}/include directory out of the way." >&2;} { (exit 1); exit 1; }; } else - echo "$as_me:$LINENO: result: ok" >&5 -echo "${ECHO_T}ok" >&6 + { echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6; } fi fi diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/mathinline.h b/sysdeps/unix/sysv/linux/powerpc/bits/mathinline.h new file mode 100644 index 0000000000..6d7e006307 --- /dev/null +++ b/sysdeps/unix/sysv/linux/powerpc/bits/mathinline.h @@ -0,0 +1,132 @@ +/* Inline math functions for powerpc. + Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2004, 2006, 2007, 2008 + 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _MATH_H +# error "Never use directly; include instead." +#endif + +#ifndef __extern_inline +# define __MATH_INLINE __inline +#else +# define __MATH_INLINE __extern_inline +#endif /* __cplusplus */ + +#if defined __GNUC__ && !defined _SOFT_FLOAT + +#ifdef __USE_ISOC99 +# if !__GNUC_PREREQ (2,97) +# define __unordered_cmp(x, y) \ + (__extension__ \ + ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \ + unsigned __r; \ + __asm__("fcmpu 7,%1,%2 ; mfcr %0" : "=r" (__r) : "f" (__x), "f"(__y) \ + : "cr7"); \ + __r; })) + +# undef isgreater +# undef isgreaterequal +# undef isless +# undef islessequal +# undef islessgreater +# undef isunordered + +# define isgreater(x, y) (__unordered_cmp (x, y) >> 2 & 1) +# define isgreaterequal(x, y) ((__unordered_cmp (x, y) & 6) != 0) +# define isless(x, y) (__unordered_cmp (x, y) >> 3 & 1) +# define islessequal(x, y) ((__unordered_cmp (x, y) & 0xA) != 0) +# define islessgreater(x, y) ((__unordered_cmp (x, y) & 0xC) != 0) +# define isunordered(x, y) (__unordered_cmp (x, y) & 1) + +# endif /* __GNUC_PREREQ (2,97) */ + +/* The gcc, version 2.7 or below, has problems with all this inlining + code. So disable it for this version of the compiler. */ +# if __GNUC_PREREQ (2, 8) +/* Test for negative number. Used in the signbit() macro. */ +__MATH_INLINE int +__NTH (__signbitf (float __x)) +{ + __extension__ union { float __f; int __i; } __u = { __f: __x }; + return __u.__i < 0; +} +__MATH_INLINE int +__NTH (__signbit (double __x)) +{ + __extension__ union { double __d; int __i[2]; } __u = { __d: __x }; + return __u.__i[0] < 0; +} +# if defined __powerpc64__ && defined __LONGDOUBLE128 +__MATH_INLINE int +__NTH (__signbitl (long double __x)) +{ + __extension__ union { long double __d; long int __i[2]; } __u = { __d: __x }; + return __u.__i[0] < 0; +} +# endif +# endif +#endif /* __USE_ISOC99 */ + +#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__ + +#ifdef __USE_ISOC99 + +# ifndef __powerpc64__ +__MATH_INLINE long int lrint (double __x) __THROW; +__MATH_INLINE long int +__NTH (lrint (double __x)) +{ + union { + double __d; + int __ll[2]; + } __u; + __asm__ ("fctiw %0,%1" : "=f"(__u.__d) : "f"(__x)); + return __u.__ll[1]; +} + +__MATH_INLINE long int lrintf (float __x) __THROW; +__MATH_INLINE long int +__NTH (lrintf (float __x)) +{ + union { + double __d; + int __ll[2]; + } __u; + __asm__ ("fctiw %0,%1" : "=f"(__u.__d) : "f"(__x)); + return __u.__ll[1]; +} +# endif + +__MATH_INLINE double fdim (double __x, double __y) __THROW; +__MATH_INLINE double +__NTH (fdim (double __x, double __y)) +{ + return __x <= __y ? 0 : __x - __y; +} + +__MATH_INLINE float fdimf (float __x, float __y) __THROW; +__MATH_INLINE float +__NTH (fdimf (float __x, float __y)) +{ + return __x <= __y ? 0 : __x - __y; +} + +#endif /* __USE_ISOC99 */ +#endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */ +#endif /* __GNUC__ && !_SOFT_FLOAT */ diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/fe_nomask.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/fe_nomask.c index 8d3b9ad1f4..95baa3acc2 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/fe_nomask.c +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/fe_nomask.c @@ -1,5 +1,5 @@ /* Procedure definition for FE_NOMASK_ENV for Linux/ppc. - Copyright (C) 2000, 2006 Free Software Foundation, Inc. + Copyright (C) 2000, 2006, 2008 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 @@ -66,3 +66,4 @@ __fe_nomask_env (void) return FE_ENABLED_ENV; } +libm_hidden_def (__fe_nomask_env) diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/fe_nomask.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/fe_nomask.c index 62f735514a..d0cf8596e1 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/fe_nomask.c +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/fe_nomask.c @@ -1,5 +1,5 @@ /* Procedure definition for FE_NOMASK_ENV for Linux/ppc64. - Copyright (C) 2003, 2006 Free Software Foundation, Inc. + Copyright (C) 2003, 2006, 2008 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 @@ -17,7 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include +#include #include #include #include @@ -41,3 +41,4 @@ __fe_nomask_env (void) #endif return FE_ENABLED_ENV; } +libm_hidden_def (__fe_nomask_env) -- cgit v1.2.1