From 2293395f48cbfbd6ddf548fea8ba832e4c185356 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 10 Oct 1999 00:00:36 +0000 Subject: Update. * nss/getXXbyYY_r.c (do_weak_alias): Remove unnecessary parenthesis. * sysdeps/powerpc/s_copysign.S: Move to... * sysdeps/powerpc/fpu/s_copysign.S: ...here. Use portable asm syntax. * sysdeps/powerpc/s_copysignf.S: Move to... * sysdeps/powerpc/fpu/s_copysignf.S: ...here. * sysdeps/powerpc/s_fabs.S: Move to... * sysdeps/powerpc/fpu/s_fabs.S: ...here. Use portable asm syntax. * sysdeps/powerpc/s_fabsf.S: Move to... * sysdeps/powerpc/fpu/s_fabsf.S: ...here. * sysdeps/powerpc/s_fdim.c: Move to... * sysdeps/powerpc/fpu/s_fdim.c: ...here. * sysdeps/powerpc/s_fdimf.c: Move to... * sysdeps/powerpc/fpu/s_fdimf.c: ...here. * sysdeps/powerpc/s_fmax.S: Move to... * sysdeps/powerpc/fpu/s_fmax.S: ...here. Use portable asm syntax. * sysdeps/powerpc/s_fmaxf.S: Move to... * sysdeps/powerpc/fpu/s_fmaxf.S: ...here. * sysdeps/powerpc/s_fmin.S: Move to... * sysdeps/powerpc/fpu/s_fmin.S: ...here. Use portable asm syntax. * sysdeps/powerpc/s_fminf.S: Move to... * sysdeps/powerpc/fpu/s_fminf.S: ...here. * sysdeps/powerpc/s_isnan.S: Move to... * sysdeps/powerpc/fpu/s_isnan.c: ...here. * sysdeps/powerpc/s_isnanf.S: Move to... * sysdeps/powerpc/fpu/s_isnanf.S: ...here. * sysdeps/powerpc/s_llrint.c: Move to... * sysdeps/powerpc/fpu/s_llrint.c: ...here. * sysdeps/powerpc/s_llrintf.c: Move to... * sysdeps/powerpc/fpu/s_llrintf.c: ...here. * sysdeps/powerpc/s_llround.c: Move to... * sysdeps/powerpc/fpu/s_llround.c: ...here. * sysdeps/powerpc/s_llroundf.c: Move to... * sysdeps/powerpc/fpu/s_llroundf.c: ...here. * sysdeps/powerpc/s_lrint.c: Move to... * sysdeps/powerpc/fpu/s_lrint.c: ...here. * sysdeps/powerpc/s_lrintf.S: Move to... * sysdeps/powerpc/fpu/s_lrintf.S: ...here. * sysdeps/powerpc/s_lround.c: Move to... * sysdeps/powerpc/fpu/s_lround.c: ...here. * sysdeps/powerpc/s_lroundf.c: Move to... * sysdeps/powerpc/fpu/s_lroundf.c: ...here. * sysdeps/powerpc/s_rint.c: Move to... * sysdeps/powerpc/fpu/s_rint.c: ...here. * sysdeps/powerpc/s_rintf.c: Move to... * sysdeps/powerpc/fpu/s_rintf.c: ...here. * sysdeps/powerpc/t_sqrt.c: Move to... * sysdeps/powerpc/fpu/t_sqrt: ...here. * sysdeps/powerpc/w_sqrt.c: Move to... * sysdeps/powerpc/fpu/w_sqrt.c: ...here. * sysdeps/powerpc/w_sqrtf.c: Move to... * sysdeps/powerpc/fpu/w_sqrtf.c: ...here. * configure.in: Support platforms which have no .text pseudo-op. Patches partly by Jimi X . --- ChangeLog | 54 +++++ configure | 495 ++++++++++++++++++++++---------------- configure.in | 30 ++- nss/getXXbyYY_r.c | 2 +- sysdeps/powerpc/fpu/s_copysign.S | 50 ++++ sysdeps/powerpc/fpu/s_copysignf.S | 1 + sysdeps/powerpc/fpu/s_fabs.S | 37 +++ sysdeps/powerpc/fpu/s_fabsf.S | 1 + sysdeps/powerpc/fpu/s_fdim.c | 31 +++ sysdeps/powerpc/fpu/s_fdimf.c | 27 +++ sysdeps/powerpc/fpu/s_fmax.S | 43 ++++ sysdeps/powerpc/fpu/s_fmaxf.S | 1 + sysdeps/powerpc/fpu/s_fmin.S | 43 ++++ sysdeps/powerpc/fpu/s_fminf.S | 1 + sysdeps/powerpc/fpu/s_isnan.c | 47 ++++ sysdeps/powerpc/fpu/s_isnanf.S | 1 + sysdeps/powerpc/fpu/s_llrint.c | 31 +++ sysdeps/powerpc/fpu/s_llrintf.c | 27 +++ sysdeps/powerpc/fpu/s_llround.c | 50 ++++ sysdeps/powerpc/fpu/s_llroundf.c | 46 ++++ sysdeps/powerpc/fpu/s_lrint.c | 46 ++++ sysdeps/powerpc/fpu/s_lrintf.S | 1 + sysdeps/powerpc/fpu/s_lround.c | 50 ++++ sysdeps/powerpc/fpu/s_lroundf.c | 46 ++++ sysdeps/powerpc/fpu/s_rint.c | 47 ++++ sysdeps/powerpc/fpu/s_rintf.c | 43 ++++ sysdeps/powerpc/fpu/t_sqrt.c | 144 +++++++++++ sysdeps/powerpc/fpu/w_sqrt.c | 141 +++++++++++ sysdeps/powerpc/fpu/w_sqrtf.c | 136 +++++++++++ sysdeps/powerpc/s_copysign.S | 50 ---- sysdeps/powerpc/s_copysignf.S | 1 - sysdeps/powerpc/s_fabs.S | 37 --- sysdeps/powerpc/s_fabsf.S | 1 - sysdeps/powerpc/s_fdim.c | 31 --- sysdeps/powerpc/s_fdimf.c | 27 --- sysdeps/powerpc/s_fmax.S | 43 ---- sysdeps/powerpc/s_fmaxf.S | 1 - sysdeps/powerpc/s_fmin.S | 43 ---- sysdeps/powerpc/s_fminf.S | 1 - sysdeps/powerpc/s_isnan.c | 47 ---- sysdeps/powerpc/s_isnanf.S | 1 - sysdeps/powerpc/s_llrint.c | 31 --- sysdeps/powerpc/s_llrintf.c | 27 --- sysdeps/powerpc/s_llround.c | 50 ---- sysdeps/powerpc/s_llroundf.c | 46 ---- sysdeps/powerpc/s_lrint.c | 46 ---- sysdeps/powerpc/s_lrintf.S | 1 - sysdeps/powerpc/s_lround.c | 50 ---- sysdeps/powerpc/s_lroundf.c | 46 ---- sysdeps/powerpc/s_rint.c | 47 ---- sysdeps/powerpc/s_rintf.c | 43 ---- sysdeps/powerpc/t_sqrt.c | 144 ----------- sysdeps/powerpc/w_sqrt.c | 141 ----------- sysdeps/powerpc/w_sqrtf.c | 136 ----------- 54 files changed, 1458 insertions(+), 1305 deletions(-) create mode 100644 sysdeps/powerpc/fpu/s_copysign.S create mode 100644 sysdeps/powerpc/fpu/s_copysignf.S create mode 100644 sysdeps/powerpc/fpu/s_fabs.S create mode 100644 sysdeps/powerpc/fpu/s_fabsf.S create mode 100644 sysdeps/powerpc/fpu/s_fdim.c create mode 100644 sysdeps/powerpc/fpu/s_fdimf.c create mode 100644 sysdeps/powerpc/fpu/s_fmax.S create mode 100644 sysdeps/powerpc/fpu/s_fmaxf.S create mode 100644 sysdeps/powerpc/fpu/s_fmin.S create mode 100644 sysdeps/powerpc/fpu/s_fminf.S create mode 100644 sysdeps/powerpc/fpu/s_isnan.c create mode 100644 sysdeps/powerpc/fpu/s_isnanf.S create mode 100644 sysdeps/powerpc/fpu/s_llrint.c create mode 100644 sysdeps/powerpc/fpu/s_llrintf.c create mode 100644 sysdeps/powerpc/fpu/s_llround.c create mode 100644 sysdeps/powerpc/fpu/s_llroundf.c create mode 100644 sysdeps/powerpc/fpu/s_lrint.c create mode 100644 sysdeps/powerpc/fpu/s_lrintf.S create mode 100644 sysdeps/powerpc/fpu/s_lround.c create mode 100644 sysdeps/powerpc/fpu/s_lroundf.c create mode 100644 sysdeps/powerpc/fpu/s_rint.c create mode 100644 sysdeps/powerpc/fpu/s_rintf.c create mode 100644 sysdeps/powerpc/fpu/t_sqrt.c create mode 100644 sysdeps/powerpc/fpu/w_sqrt.c create mode 100644 sysdeps/powerpc/fpu/w_sqrtf.c delete mode 100644 sysdeps/powerpc/s_copysign.S delete mode 100644 sysdeps/powerpc/s_copysignf.S delete mode 100644 sysdeps/powerpc/s_fabs.S delete mode 100644 sysdeps/powerpc/s_fabsf.S delete mode 100644 sysdeps/powerpc/s_fdim.c delete mode 100644 sysdeps/powerpc/s_fdimf.c delete mode 100644 sysdeps/powerpc/s_fmax.S delete mode 100644 sysdeps/powerpc/s_fmaxf.S delete mode 100644 sysdeps/powerpc/s_fmin.S delete mode 100644 sysdeps/powerpc/s_fminf.S delete mode 100644 sysdeps/powerpc/s_isnan.c delete mode 100644 sysdeps/powerpc/s_isnanf.S delete mode 100644 sysdeps/powerpc/s_llrint.c delete mode 100644 sysdeps/powerpc/s_llrintf.c delete mode 100644 sysdeps/powerpc/s_llround.c delete mode 100644 sysdeps/powerpc/s_llroundf.c delete mode 100644 sysdeps/powerpc/s_lrint.c delete mode 100644 sysdeps/powerpc/s_lrintf.S delete mode 100644 sysdeps/powerpc/s_lround.c delete mode 100644 sysdeps/powerpc/s_lroundf.c delete mode 100644 sysdeps/powerpc/s_rint.c delete mode 100644 sysdeps/powerpc/s_rintf.c delete mode 100644 sysdeps/powerpc/t_sqrt.c delete mode 100644 sysdeps/powerpc/w_sqrt.c delete mode 100644 sysdeps/powerpc/w_sqrtf.c diff --git a/ChangeLog b/ChangeLog index 046eca9..842d61a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,59 @@ 1999-10-09 Ulrich Drepper + * nss/getXXbyYY_r.c (do_weak_alias): Remove unnecessary parenthesis. + * sysdeps/powerpc/s_copysign.S: Move to... + * sysdeps/powerpc/fpu/s_copysign.S: ...here. Use portable asm syntax. + * sysdeps/powerpc/s_copysignf.S: Move to... + * sysdeps/powerpc/fpu/s_copysignf.S: ...here. + * sysdeps/powerpc/s_fabs.S: Move to... + * sysdeps/powerpc/fpu/s_fabs.S: ...here. Use portable asm syntax. + * sysdeps/powerpc/s_fabsf.S: Move to... + * sysdeps/powerpc/fpu/s_fabsf.S: ...here. + * sysdeps/powerpc/s_fdim.c: Move to... + * sysdeps/powerpc/fpu/s_fdim.c: ...here. + * sysdeps/powerpc/s_fdimf.c: Move to... + * sysdeps/powerpc/fpu/s_fdimf.c: ...here. + * sysdeps/powerpc/s_fmax.S: Move to... + * sysdeps/powerpc/fpu/s_fmax.S: ...here. Use portable asm syntax. + * sysdeps/powerpc/s_fmaxf.S: Move to... + * sysdeps/powerpc/fpu/s_fmaxf.S: ...here. + * sysdeps/powerpc/s_fmin.S: Move to... + * sysdeps/powerpc/fpu/s_fmin.S: ...here. Use portable asm syntax. + * sysdeps/powerpc/s_fminf.S: Move to... + * sysdeps/powerpc/fpu/s_fminf.S: ...here. + * sysdeps/powerpc/s_isnan.S: Move to... + * sysdeps/powerpc/fpu/s_isnan.c: ...here. + * sysdeps/powerpc/s_isnanf.S: Move to... + * sysdeps/powerpc/fpu/s_isnanf.S: ...here. + * sysdeps/powerpc/s_llrint.c: Move to... + * sysdeps/powerpc/fpu/s_llrint.c: ...here. + * sysdeps/powerpc/s_llrintf.c: Move to... + * sysdeps/powerpc/fpu/s_llrintf.c: ...here. + * sysdeps/powerpc/s_llround.c: Move to... + * sysdeps/powerpc/fpu/s_llround.c: ...here. + * sysdeps/powerpc/s_llroundf.c: Move to... + * sysdeps/powerpc/fpu/s_llroundf.c: ...here. + * sysdeps/powerpc/s_lrint.c: Move to... + * sysdeps/powerpc/fpu/s_lrint.c: ...here. + * sysdeps/powerpc/s_lrintf.S: Move to... + * sysdeps/powerpc/fpu/s_lrintf.S: ...here. + * sysdeps/powerpc/s_lround.c: Move to... + * sysdeps/powerpc/fpu/s_lround.c: ...here. + * sysdeps/powerpc/s_lroundf.c: Move to... + * sysdeps/powerpc/fpu/s_lroundf.c: ...here. + * sysdeps/powerpc/s_rint.c: Move to... + * sysdeps/powerpc/fpu/s_rint.c: ...here. + * sysdeps/powerpc/s_rintf.c: Move to... + * sysdeps/powerpc/fpu/s_rintf.c: ...here. + * sysdeps/powerpc/t_sqrt.c: Move to... + * sysdeps/powerpc/fpu/t_sqrt: ...here. + * sysdeps/powerpc/w_sqrt.c: Move to... + * sysdeps/powerpc/fpu/w_sqrt.c: ...here. + * sysdeps/powerpc/w_sqrtf.c: Move to... + * sysdeps/powerpc/fpu/w_sqrtf.c: ...here. + * configure.in: Support platforms which have no .text pseudo-op. + Patches partly by Jimi X . + * Makeconfig: Look also in all subdirs for shlib-versions files. * malloc/memprof.sh: Fix --help string a bit. diff --git a/configure b/configure index ef446d5..8261086 100755 --- a/configure +++ b/configure @@ -12,7 +12,7 @@ # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 +# Generated automatically using autoconf version 2.14.1 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -394,7 +394,7 @@ EOF verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13" + echo "configure generated by autoconf version 2.14.1" exit 0 ;; -with-* | --with-*) @@ -554,7 +554,7 @@ done if test -r "$cache_file"; then echo "loading cache $cache_file" - . $cache_file + test -f "$cache_file" && . $cache_file else echo "creating cache $cache_file" > $cache_file @@ -606,9 +606,9 @@ done if test -z "$ac_aux_dir"; then { echo "configure: error: can not find install-sh or install.sh in scripts $srcdir/scripts" 1>&2; exit 1; } fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # This will get text that should go into config.make. @@ -851,31 +851,45 @@ fi +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:856: checking host system type" >&5 +if test "x$ac_cv_host" = "x" || (test "x$host" != "xNONE" && test "x$host" != "x$ac_cv_host_alias"); then + # Make sure we can run config.sub. -if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : -else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } + if $ac_config_sub sun4 >/dev/null 2>&1; then : + else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } + fi + + ac_cv_host_alias=$host + case "$ac_cv_host_alias" in + NONE) + case $nonopt in + NONE) + if ac_cv_host_alias=`$ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) ac_cv_host_alias=$nonopt ;; + esac ;; + esac + + ac_cv_host=`$ac_config_sub $ac_cv_host_alias` + ac_cv_host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` + ac_cv_host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` + ac_cv_host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +else + echo $ac_n "(cached) $ac_c" 1>&6 fi -echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:861: checking host system type" >&5 +echo "$ac_t""$ac_cv_host" 1>&6 + +host=$ac_cv_host +host_alias=$ac_cv_host_alias +host_cpu=$ac_cv_host_cpu +host_vendor=$ac_cv_host_vendor +host_os=$ac_cv_host_os + -host_alias=$host -case "$host_alias" in -NONE) - case $nonopt in - NONE) - if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : - else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } - fi ;; - *) host_alias=$nonopt ;; - esac ;; -esac -host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` -host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$host" 1>&6 # The way shlib-versions is used to generate soversions.mk uses a @@ -982,7 +996,7 @@ fi # This can take a while to compute. sysdep_dir=$srcdir/sysdeps echo $ac_n "checking sysdep dirs""... $ac_c" 1>&6 -echo "configure:986: checking sysdep dirs" >&5 +echo "configure:1000: checking sysdep dirs" >&5 # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1. os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`" @@ -1186,9 +1200,9 @@ echo "$ac_t""$default_sysnames" 1>&6 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1190: checking for a BSD compatible install" >&5 +echo "configure:1204: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then +if eval "test \"\${ac_cv_path_install+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" @@ -1206,6 +1220,10 @@ else grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : + elif test $ac_prog = install && + grep pwplus $ac_dir/$ac_prog >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : else ac_cv_path_install="$ac_dir/$ac_prog -c" break 2 @@ -1234,7 +1252,7 @@ echo "$ac_t""$INSTALL" 1>&6 # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' @@ -1243,8 +1261,8 @@ if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then INSTALL='\$(..)./scripts/install-sh -c' fi echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1247: checking whether ln -s works" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then +echo "configure:1265: checking whether ln -s works" >&5 +if eval "test \"\${ac_cv_prog_LN_S+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else rm -f conftestdata @@ -1265,23 +1283,45 @@ fi # These programs are version sensitive. + echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:1270: checking build system type" >&5 - -build_alias=$build -case "$build_alias" in -NONE) - case $nonopt in - NONE) build_alias=$host_alias ;; - *) build_alias=$nonopt ;; - esac ;; -esac +echo "configure:1289: checking build system type" >&5 +if test "x$ac_cv_build" = "x" || (test "x$build" != "xNONE" && test "x$build" != "x$ac_cv_build_alias"); then + +# Make sure we can run config.sub. + if $ac_config_sub sun4 >/dev/null 2>&1; then : + else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } + fi + + ac_cv_build_alias=$build + case "$ac_cv_build_alias" in + NONE) + case $nonopt in + NONE) + ac_cv_build_alias=$host_alias ;; + + *) ac_cv_build_alias=$nonopt ;; + esac ;; + esac + + ac_cv_build=`$ac_config_sub $ac_cv_build_alias` + ac_cv_build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` + ac_cv_build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` + ac_cv_build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +else + echo $ac_n "(cached) $ac_c" 1>&6 +fi + +echo "$ac_t""$ac_cv_build" 1>&6 + +build=$ac_cv_build +build_alias=$ac_cv_build_alias +build_cpu=$ac_cv_build_cpu +build_vendor=$ac_cv_build_vendor +build_os=$ac_cv_build_os + + -build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` -build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$build" 1>&6 if test $host != $build; then ac_tool_prefix=${host_alias}- @@ -1294,8 +1334,8 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1298: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then +echo "configure:1338: checking for $ac_word" >&5 +if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then @@ -1328,7 +1368,7 @@ if test -z "$CC"; then else # Found it, now check the version. echo $ac_n "checking version of $CC""... $ac_c" 1>&6 -echo "configure:1332: checking version of $CC" >&5 +echo "configure:1372: checking version of $CC" >&5 ac_prog_version=`$CC -v 2>&1 | sed -n 's/^.*version \([egcygnustp-]*[0-9.]*\).*$/\1/p'` case $ac_prog_version in '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; @@ -1348,8 +1388,8 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1352: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_MAKE'+set}'`\" = set"; then +echo "configure:1392: checking for $ac_word" >&5 +if eval "test \"\${ac_cv_prog_MAKE+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$MAKE"; then @@ -1382,7 +1422,7 @@ if test -z "$MAKE"; then else # Found it, now check the version. echo $ac_n "checking version of $MAKE""... $ac_c" 1>&6 -echo "configure:1386: checking version of $MAKE" >&5 +echo "configure:1426: checking version of $MAKE" >&5 ac_prog_version=`$MAKE --version 2>&1 | sed -n 's/^.*GNU Make[^0-9]*\([0-9][0-9.]*\).*$/\1/p'` case $ac_prog_version in '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; @@ -1403,8 +1443,8 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1407: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_MSGFMT'+set}'`\" = set"; then +echo "configure:1447: checking for $ac_word" >&5 +if eval "test \"\${ac_cv_prog_MSGFMT+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$MSGFMT"; then @@ -1437,7 +1477,7 @@ if test -z "$MSGFMT"; then else # Found it, now check the version. echo $ac_n "checking version of $MSGFMT""... $ac_c" 1>&6 -echo "configure:1441: checking version of $MSGFMT" >&5 +echo "configure:1481: checking version of $MSGFMT" >&5 ac_prog_version=`$MSGFMT --version 2>&1 | sed -n 's/^.*GNU gettext.* \([0-9]*\.[0-9.]*\).*$/\1/p'` case $ac_prog_version in '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; @@ -1457,8 +1497,8 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1461: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_MAKEINFO'+set}'`\" = set"; then +echo "configure:1501: checking for $ac_word" >&5 +if eval "test \"\${ac_cv_prog_MAKEINFO+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$MAKEINFO"; then @@ -1491,7 +1531,7 @@ if test -z "$MAKEINFO"; then else # Found it, now check the version. echo $ac_n "checking version of $MAKEINFO""... $ac_c" 1>&6 -echo "configure:1495: checking version of $MAKEINFO" >&5 +echo "configure:1535: checking version of $MAKEINFO" >&5 ac_prog_version=`$MAKEINFO --version 2>&1 | sed -n 's/^.*GNU texinfo.* \([0-9][0-9.]*\).*$/\1/p'` case $ac_prog_version in '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; @@ -1524,8 +1564,8 @@ CCVERSION=`$CC -v 2>&1 | sed -n 's/gcc version //p'` echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1528: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_works'+set}'`\" = set"; then +echo "configure:1568: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +if eval "test \"\${ac_cv_prog_cc_works+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1538,12 +1578,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 1542 "configure" +#line 1582 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1547: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1587: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1574,8 +1614,8 @@ else cross_linkable=yes fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1578: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_cross'+set}'`\" = set"; then +echo "configure:1618: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +if eval "test \"\${ac_cv_prog_cc_cross+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else : @@ -1586,8 +1626,8 @@ echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1590: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then +echo "configure:1630: checking whether we are using GNU C" >&5 +if eval "test \"\${ac_cv_prog_gcc+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1639: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1607,23 +1647,45 @@ if test $ac_cv_prog_gcc != yes; then { echo "configure: error: GNU libc must be compiled using GNU CC" 1>&2; exit 1; } fi + echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:1612: checking build system type" >&5 - -build_alias=$build -case "$build_alias" in -NONE) - case $nonopt in - NONE) build_alias=$host_alias ;; - *) build_alias=$nonopt ;; - esac ;; -esac +echo "configure:1653: checking build system type" >&5 +if test "x$ac_cv_build" = "x" || (test "x$build" != "xNONE" && test "x$build" != "x$ac_cv_build_alias"); then + +# Make sure we can run config.sub. + if $ac_config_sub sun4 >/dev/null 2>&1; then : + else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } + fi + + ac_cv_build_alias=$build + case "$ac_cv_build_alias" in + NONE) + case $nonopt in + NONE) + ac_cv_build_alias=$host_alias ;; + + *) ac_cv_build_alias=$nonopt ;; + esac ;; + esac + + ac_cv_build=`$ac_config_sub $ac_cv_build_alias` + ac_cv_build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` + ac_cv_build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` + ac_cv_build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +else + echo $ac_n "(cached) $ac_c" 1>&6 +fi + +echo "$ac_t""$ac_cv_build" 1>&6 + +build=$ac_cv_build +build_alias=$ac_cv_build_alias +build_cpu=$ac_cv_build_cpu +build_vendor=$ac_cv_build_vendor +build_os=$ac_cv_build_os + + -build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` -build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$build" 1>&6 if test $host != $build; then for ac_prog in gcc cc @@ -1631,8 +1693,8 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1635: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_BUILD_CC'+set}'`\" = set"; then +echo "configure:1697: checking for $ac_word" >&5 +if eval "test \"\${ac_cv_prog_BUILD_CC+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$BUILD_CC"; then @@ -1663,13 +1725,13 @@ done fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1667: checking how to run the C preprocessor" >&5 +echo "configure:1729: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then +if eval "test \"\${ac_cv_prog_CPP+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else # This must be in double quotes, not single quotes, because CPP may get @@ -1678,13 +1740,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1688: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1750: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1695,13 +1757,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1705: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1767: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1712,13 +1774,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1722: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1784: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1761,8 +1823,8 @@ if test $RANLIB = ranlib; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1765: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then +echo "configure:1827: checking for $ac_word" >&5 +if eval "test \"\${ac_cv_prog_RANLIB+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$RANLIB"; then @@ -1793,8 +1855,8 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1797: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then +echo "configure:1859: checking for $ac_word" >&5 +if eval "test \"\${ac_cv_prog_RANLIB+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$RANLIB"; then @@ -1830,8 +1892,8 @@ fi # Determine whether we are using GNU binutils. echo $ac_n "checking whether $AS is GNU as""... $ac_c" 1>&6 -echo "configure:1834: checking whether $AS is GNU as" >&5 -if eval "test \"`echo '$''{'libc_cv_prog_as_gnu'+set}'`\" = set"; then +echo "configure:1896: checking whether $AS is GNU as" >&5 +if eval "test \"\${libc_cv_prog_as_gnu+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else # Most GNU programs take a -v and spit out some text including @@ -1849,8 +1911,8 @@ rm -f a.out gnu_as=$libc_cv_prog_as_gnu echo $ac_n "checking whether $LD is GNU ld""... $ac_c" 1>&6 -echo "configure:1853: checking whether $LD is GNU ld" >&5 -if eval "test \"`echo '$''{'libc_cv_prog_ld_gnu'+set}'`\" = set"; then +echo "configure:1915: checking whether $LD is GNU ld" >&5 +if eval "test \"\${libc_cv_prog_ld_gnu+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else # Most GNU programs take a -v and spit out some text including @@ -1869,8 +1931,8 @@ gnu_ld=$libc_cv_prog_ld_gnu # Extract the first word of "${ac_tool_prefix}mig", so it can be a program name with args. set dummy ${ac_tool_prefix}mig; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1873: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_MIG'+set}'`\" = set"; then +echo "configure:1935: checking for $ac_word" >&5 +if eval "test \"\${ac_cv_prog_MIG+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$MIG"; then @@ -1910,8 +1972,8 @@ fi # check if ranlib is necessary echo $ac_n "checking whether ranlib is necessary""... $ac_c" 1>&6 -echo "configure:1914: checking whether ranlib is necessary" >&5 -if eval "test \"`echo '$''{'libc_cv_ranlib_necessary'+set}'`\" = set"; then +echo "configure:1976: checking whether ranlib is necessary" >&5 +if eval "test \"\${libc_cv_ranlib_necessary+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <&6 -echo "configure:1948: checking LD_LIBRARY_PATH variable" >&5 +echo "configure:2010: checking LD_LIBRARY_PATH variable" >&5 case ${LD_LIBRARY_PATH} in [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* ) ld_library_path_setting="contains current directory" @@ -1964,8 +2026,8 @@ fi # Extract the first word of "bash", so it can be a program name with args. set dummy bash; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1968: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_BASH'+set}'`\" = set"; then +echo "configure:2030: checking for $ac_word" >&5 +if eval "test \"\${ac_cv_path_BASH+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else case "$BASH" in @@ -2010,8 +2072,8 @@ if test "$BASH" = no; then # Extract the first word of "ksh", so it can be a program name with args. set dummy ksh; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2014: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_KSH'+set}'`\" = set"; then +echo "configure:2076: checking for $ac_word" >&5 +if eval "test \"\${ac_cv_path_KSH+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else case "$KSH" in @@ -2060,8 +2122,8 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2064: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then +echo "configure:2126: checking for $ac_word" >&5 +if eval "test \"\${ac_cv_prog_AWK+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$AWK"; then @@ -2092,8 +2154,8 @@ done # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2096: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then +echo "configure:2158: checking for $ac_word" >&5 +if eval "test \"\${ac_cv_path_PERL+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else case "$PERL" in @@ -2129,8 +2191,8 @@ fi # Extract the first word of "install-info", so it can be a program name with args. set dummy install-info; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2133: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_INSTALL_INFO'+set}'`\" = set"; then +echo "configure:2195: checking for $ac_word" >&5 +if eval "test \"\${ac_cv_path_INSTALL_INFO+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else case "$INSTALL_INFO" in @@ -2165,8 +2227,8 @@ fi if test "$INSTALL_INFO" != "no"; then echo $ac_n "checking for old Debian install-info""... $ac_c" 1>&6 -echo "configure:2169: checking for old Debian install-info" >&5 -if eval "test \"`echo '$''{'libc_cv_old_debian_install_info'+set}'`\" = set"; then +echo "configure:2231: checking for old Debian install-info" >&5 +if eval "test \"\${libc_cv_old_debian_install_info+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else mkdir conftest.d @@ -2198,8 +2260,8 @@ fi echo $ac_n "checking for signed size_t type""... $ac_c" 1>&6 -echo "configure:2202: checking for signed size_t type" >&5 -if eval "test \"`echo '$''{'libc_cv_signed_size_t'+set}'`\" = set"; then +echo "configure:2264: checking for signed size_t type" >&5 +if eval "test \"\${libc_cv_signed_size_t+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else echo '#include @@ -2222,12 +2284,12 @@ EOF fi echo $ac_n "checking for libc-friendly stddef.h""... $ac_c" 1>&6 -echo "configure:2226: checking for libc-friendly stddef.h" >&5 -if eval "test \"`echo '$''{'libc_cv_friendly_stddef'+set}'`\" = set"; then +echo "configure:2288: checking for libc-friendly stddef.h" >&5 +if eval "test \"\${libc_cv_friendly_stddef+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2308: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libc_cv_friendly_stddef=yes else @@ -2261,8 +2323,8 @@ override stddef.h = # The installed seems to be libc-friendly." fi echo $ac_n "checking whether we need to use -P to assemble .S files""... $ac_c" 1>&6 -echo "configure:2265: checking whether we need to use -P to assemble .S files" >&5 -if eval "test \"`echo '$''{'libc_cv_need_minus_P'+set}'`\" = set"; then +echo "configure:2327: checking whether we need to use -P to assemble .S files" >&5 +if eval "test \"\${libc_cv_need_minus_P+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.S <&6 +echo "configure:2350: checking whether .text pseudo-op must be used" >&5 +if eval "test \"\${libc_cv_dot_text+set}\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.s </dev/null; then + libc_cv_dot_text=.text +fi +rm -f conftest* +fi + +if test -z "$libc_cv_dot_text"; then + echo "$ac_t""no" 1>&6 +else + echo "$ac_t""yes" 1>&6 +fi + echo $ac_n "checking for assembler global-symbol directive""... $ac_c" 1>&6 -echo "configure:2288: checking for assembler global-symbol directive" >&5 -if eval "test \"`echo '$''{'libc_cv_asm_global_directive'+set}'`\" = set"; then +echo "configure:2371: checking for assembler global-symbol directive" >&5 +if eval "test \"\${libc_cv_asm_global_directive+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else libc_cv_asm_global_directive=UNKNOWN for ac_globl in .globl .global .EXPORT; do cat > conftest.s <&6 -echo "configure:2318: checking for .set assembler directive" >&5 -if eval "test \"`echo '$''{'libc_cv_asm_set_directive'+set}'`\" = set"; then +echo "configure:2401: checking for .set assembler directive" >&5 +if eval "test \"\${libc_cv_asm_set_directive+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.s <&6 -echo "configure:2352: checking for .symver assembler directive" >&5 -if eval "test \"`echo '$''{'libc_cv_asm_symver_directive'+set}'`\" = set"; then +echo "configure:2435: checking for .symver assembler directive" >&5 +if eval "test \"\${libc_cv_asm_symver_directive+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.s <&6 echo $ac_n "checking for ld --version-script""... $ac_c" 1>&6 -echo "configure:2371: checking for ld --version-script" >&5 -if eval "test \"`echo '$''{'libc_cv_ld_version_script_option'+set}'`\" = set"; then +echo "configure:2454: checking for ld --version-script" >&5 +if eval "test \"\${libc_cv_ld_version_script_option+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test $libc_cv_asm_symver_directive = yes; then cat > conftest.s <&5; (eval $ac_try) 2>&5; }; }; + 1>&5'; { (eval echo configure:2477: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_ld_version_script_option=yes else @@ -2428,15 +2511,15 @@ if test $VERSIONING = no; then fi if test $elf = yes; then echo $ac_n "checking for .previous assembler directive""... $ac_c" 1>&6 -echo "configure:2432: checking for .previous assembler directive" >&5 -if eval "test \"`echo '$''{'libc_cv_asm_previous_directive'+set}'`\" = set"; then +echo "configure:2515: checking for .previous assembler directive" >&5 +if eval "test \"\${libc_cv_asm_previous_directive+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.s <&5; (eval $ac_try) 2>&5; }; }; then + if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:2523: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_asm_previous_directive=yes else libc_cv_asm_previous_directive=no @@ -2452,15 +2535,15 @@ EOF else echo $ac_n "checking for .popsection assembler directive""... $ac_c" 1>&6 -echo "configure:2456: checking for .popsection assembler directive" >&5 -if eval "test \"`echo '$''{'libc_cv_asm_popsection_directive'+set}'`\" = set"; then +echo "configure:2539: checking for .popsection assembler directive" >&5 +if eval "test \"\${libc_cv_asm_popsection_directive+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.s <&5; (eval $ac_try) 2>&5; }; }; then + if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:2547: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_asm_popsection_directive=yes else libc_cv_asm_popsection_directive=no @@ -2480,21 +2563,21 @@ fi if test $elf != yes; then echo $ac_n "checking for .init and .fini sections""... $ac_c" 1>&6 -echo "configure:2484: checking for .init and .fini sections" >&5 -if eval "test \"`echo '$''{'libc_cv_have_initfini'+set}'`\" = set"; then +echo "configure:2567: checking for .init and .fini sections" >&5 +if eval "test \"\${libc_cv_have_initfini+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2581: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libc_cv_have_initfini=yes else @@ -2522,19 +2605,19 @@ if test $elf = yes; then else if test $ac_cv_prog_cc_works = yes; then echo $ac_n "checking for _ prefix on C symbol names""... $ac_c" 1>&6 -echo "configure:2526: checking for _ prefix on C symbol names" >&5 -if eval "test \"`echo '$''{'libc_cv_asm_underscores'+set}'`\" = set"; then +echo "configure:2609: checking for _ prefix on C symbol names" >&5 +if eval "test \"\${libc_cv_asm_underscores+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2621: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* libc_cv_asm_underscores=yes else @@ -2549,17 +2632,17 @@ fi echo "$ac_t""$libc_cv_asm_underscores" 1>&6 else echo $ac_n "checking for _ prefix on C symbol names""... $ac_c" 1>&6 -echo "configure:2553: checking for _ prefix on C symbol names" >&5 -if eval "test \"`echo '$''{'libc_cv_asm_underscores'+set}'`\" = set"; then +echo "configure:2636: checking for _ prefix on C symbol names" >&5 +if eval "test \"\${libc_cv_asm_underscores+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2646: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if grep _underscore_test conftest* >/dev/null; then rm -f conftest* libc_cv_asm_underscores=yes @@ -2591,12 +2674,12 @@ if test $elf = yes; then fi echo $ac_n "checking for assembler .weak directive""... $ac_c" 1>&6 -echo "configure:2595: checking for assembler .weak directive" >&5 -if eval "test \"`echo '$''{'libc_cv_asm_weak_directive'+set}'`\" = set"; then +echo "configure:2678: checking for assembler .weak directive" >&5 +if eval "test \"\${libc_cv_asm_weak_directive+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.s <&6 if test $libc_cv_asm_weak_directive = no; then echo $ac_n "checking for assembler .weakext directive""... $ac_c" 1>&6 -echo "configure:2618: checking for assembler .weakext directive" >&5 -if eval "test \"`echo '$''{'libc_cv_asm_weakext_directive'+set}'`\" = set"; then +echo "configure:2701: checking for assembler .weakext directive" >&5 +if eval "test \"\${libc_cv_asm_weakext_directive+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.s <&6 -echo "configure:2656: checking for ld --no-whole-archive" >&5 -if eval "test \"`echo '$''{'libc_cv_ld_no_whole_archive'+set}'`\" = set"; then +echo "configure:2739: checking for ld --no-whole-archive" >&5 +if eval "test \"\${libc_cv_ld_no_whole_archive+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <<\EOF @@ -2663,7 +2746,7 @@ __throw () {} EOF if { ac_try='${CC-cc} $CFLAGS -nostdlib -nostartfiles -Wl,--no-whole-archive - -o conftest conftest.c 1>&5'; { (eval echo configure:2667: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c 1>&5'; { (eval echo configure:2750: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_ld_no_whole_archive=yes else libc_cv_ld_no_whole_archive=no @@ -2677,8 +2760,8 @@ if test $libc_cv_ld_no_whole_archive = yes; then fi echo $ac_n "checking for gcc -fexceptions""... $ac_c" 1>&6 -echo "configure:2681: checking for gcc -fexceptions" >&5 -if eval "test \"`echo '$''{'libc_cv_gcc_exceptions'+set}'`\" = set"; then +echo "configure:2764: checking for gcc -fexceptions" >&5 +if eval "test \"\${libc_cv_gcc_exceptions+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <<\EOF @@ -2688,7 +2771,7 @@ __throw () {} EOF if { ac_try='${CC-cc} $CFLAGS -nostdlib -nostartfiles -fexceptions - -o conftest conftest.c 1>&5'; { (eval echo configure:2692: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c 1>&5'; { (eval echo configure:2775: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_gcc_exceptions=yes else libc_cv_gcc_exceptions=no @@ -2703,14 +2786,14 @@ fi if test "$base_machine" = alpha ; then echo $ac_n "checking for function ..ng prefix""... $ac_c" 1>&6 -echo "configure:2707: checking for function ..ng prefix" >&5 -if eval "test \"`echo '$''{'libc_cv_gcc_alpha_ng_prefix'+set}'`\" = set"; then +echo "configure:2790: checking for function ..ng prefix" >&5 +if eval "test \"\${libc_cv_gcc_alpha_ng_prefix+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <<\EOF foo () { } EOF -if { ac_try='${CC-cc} -S conftest.c -o - | fgrep "\$foo..ng" > /dev/null'; { (eval echo configure:2714: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; +if { ac_try='${CC-cc} -S conftest.c -o - | fgrep "\$foo..ng" > /dev/null'; { (eval echo configure:2797: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_gcc_alpha_ng_prefix=yes else @@ -2737,19 +2820,19 @@ if test "$host_cpu" = powerpc ; then # Check for a bug present in at least versions 2.8.x of GCC # and versions 1.0.x of EGCS. echo $ac_n "checking whether clobbering cr0 causes problems""... $ac_c" 1>&6 -echo "configure:2741: checking whether clobbering cr0 causes problems" >&5 -if eval "test \"`echo '$''{'libc_cv_c_asmcr0_bug'+set}'`\" = set"; then +echo "configure:2824: checking whether clobbering cr0 causes problems" >&5 +if eval "test \"\${libc_cv_c_asmcr0_bug+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2836: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libc_cv_c_asmcr0_bug='no' else @@ -2771,12 +2854,12 @@ fi fi echo $ac_n "checking for DWARF2 unwind info support""... $ac_c" 1>&6 -echo "configure:2775: checking for DWARF2 unwind info support" >&5 -if eval "test \"`echo '$''{'libc_cv_gcc_dwarf2_unwind_info'+set}'`\" = set"; then +echo "configure:2858: checking for DWARF2 unwind info support" >&5 +if eval "test \"\${libc_cv_gcc_dwarf2_unwind_info+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c -lgcc >&5'; { (eval echo configure:2890: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_gcc_dwarf2_unwind_info=static else libc_cv_gcc_dwarf2_unwind_info=no @@ -2811,7 +2894,7 @@ fi if test $libc_cv_gcc_dwarf2_unwind_info = no; then if { ac_try='${CC-cc} $CFLAGS -DCHECK__register_frame -nostdlib -nostartfiles - -o conftest conftest.c -lgcc >&5'; { (eval echo configure:2815: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c -lgcc >&5'; { (eval echo configure:2898: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_gcc_dwarf2_unwind_info=yes else libc_cv_gcc_dwarf2_unwind_info=no @@ -2841,12 +2924,12 @@ EOF esac echo $ac_n "checking for __builtin_expect""... $ac_c" 1>&6 -echo "configure:2845: checking for __builtin_expect" >&5 -if eval "test \"`echo '$''{'libc_cv_gcc_builtin_expect'+set}'`\" = set"; then +echo "configure:2928: checking for __builtin_expect" >&5 +if eval "test \"\${libc_cv_gcc_builtin_expect+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c -lgcc >&5'; { (eval echo configure:2941: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_gcc_builtin_expect=yes else libc_cv_gcc_builtin_expect=no @@ -2871,12 +2954,12 @@ EOF fi echo $ac_n "checking for local label subtraction""... $ac_c" 1>&6 -echo "configure:2875: checking for local label subtraction" >&5 -if eval "test \"`echo '$''{'libc_cv_gcc_subtract_local_labels'+set}'`\" = set"; then +echo "configure:2958: checking for local label subtraction" >&5 +if eval "test \"\${libc_cv_gcc_subtract_local_labels+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c -lgcc >&5'; { (eval echo configure:2976: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_gcc_subtract_local_labels=yes else libc_cv_gcc_subtract_local_labels=no @@ -2906,7 +2989,7 @@ EOF fi echo $ac_n "checking for libgd""... $ac_c" 1>&6 -echo "configure:2910: checking for libgd" >&5 +echo "configure:2993: checking for libgd" >&5 old_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $libgd_include" old_LDFLAGS="$LDFLAGS" @@ -2914,14 +2997,14 @@ LDFLAGS="$LDFLAGS $libgd_ldflags" old_LIBS="$LIBS" LIBS="$LIBS -lgd -lpng -lz" cat > conftest.$ac_ext < int main() { gdImagePng (0, 0) ; return 0; } EOF -if { (eval echo configure:2925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3008: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBGD=yes else @@ -2982,8 +3065,8 @@ if test "$uname" = "sysdeps/generic"; then fi echo $ac_n "checking OS release for uname""... $ac_c" 1>&6 -echo "configure:2986: checking OS release for uname" >&5 -if eval "test \"`echo '$''{'libc_cv_uname_release'+set}'`\" = set"; then +echo "configure:3069: checking OS release for uname" >&5 +if eval "test \"\${libc_cv_uname_release+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else kernel_release=`echo "$kernel_id" | sed 's/^[^0-9.]*\([0-9.]*\).*$/\1/'` @@ -3004,8 +3087,8 @@ echo "$ac_t""$libc_cv_uname_release" 1>&6 uname_release="$libc_cv_uname_release" echo $ac_n "checking OS version for uname""... $ac_c" 1>&6 -echo "configure:3008: checking OS version for uname" >&5 -if eval "test \"`echo '$''{'libc_cv_uname_version'+set}'`\" = set"; then +echo "configure:3091: checking OS version for uname" >&5 +if eval "test \"\${libc_cv_uname_version+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else kernel_version=`echo "$kernel_id" | sed 's/^[^#]*#\([0-9]*\).*$/\1/'` @@ -3026,7 +3109,7 @@ else fi echo $ac_n "checking stdio selection""... $ac_c" 1>&6 -echo "configure:3030: checking stdio selection" >&5 +echo "configure:3113: checking stdio selection" >&5 case $stdio in libio) cat >> confdefs.h <<\EOF @@ -3040,7 +3123,7 @@ echo "$ac_t""$stdio" 1>&6 # Test for old glibc 2.0.x headers so that they can be removed properly # Search only in includedir. echo $ac_n "checking for old glibc 2.0.x headers""... $ac_c" 1>&6 -echo "configure:3044: checking for old glibc 2.0.x headers" >&5 +echo "configure:3127: checking for old glibc 2.0.x headers" >&5 if eval test -f "${includedir}/elfclass.h" -a -f "${includedir}/fcntlbits.h" then old_glibc_headers=yes @@ -3094,8 +3177,8 @@ if test $shared = default; then fi echo $ac_n "checking whether -fPIC is default""... $ac_c" 1>&6 -echo "configure:3098: checking whether -fPIC is default" >&5 -if eval "test \"`echo '$''{'pic_default'+set}'`\" = set"; then +echo "configure:3181: checking whether -fPIC is default" >&5 +if eval "test \"\${pic_default+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else pic_default=yes @@ -3232,7 +3315,7 @@ do echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13" + echo "$CONFIG_STATUS generated by autoconf version 2.14.1" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -3611,7 +3694,7 @@ exit 0 EOF chmod +x $CONFIG_STATUS rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 +test "$no_create" = yes || $SHELL $CONFIG_STATUS || exit 1 if test "$no_recursion" != yes; then @@ -3675,7 +3758,7 @@ if test "$no_recursion" != yes; then # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_sub_srcdir/configure; then - ac_sub_configure=$ac_sub_srcdir/configure + ac_sub_configure="$SHELL $ac_sub_srcdir/configure" elif test -f $ac_sub_srcdir/configure.in; then ac_sub_configure=$ac_configure else @@ -3697,9 +3780,9 @@ if test "$no_recursion" != yes; then *) INSTALL="$ac_dots$ac_given_INSTALL" ;; esac - echo "running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir" + echo "running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir" # The eval makes quoting arguments work. - if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir + if eval $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir then : else { echo "configure: error: $ac_sub_configure failed for $ac_config_dir" 1>&2; exit 1; } diff --git a/configure.in b/configure.in index 3cc3180..4da192a 100644 --- a/configure.in +++ b/configure.in @@ -694,12 +694,28 @@ if test $libc_cv_need_minus_P = yes; then asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives." fi +AC_MSG_CHECKING(whether .text pseudo-op must be used) +AC_CACHE_VAL(libc_cv_dot_text, [dnl +cat > conftest.s </dev/null; then + libc_cv_dot_text=.text +fi +rm -f conftest*]) +if test -z "$libc_cv_dot_text"; then + AC_MSG_RESULT(no) +else + AC_MSG_RESULT(yes) +fi + AC_CACHE_CHECK(for assembler global-symbol directive, libc_cv_asm_global_directive, [dnl libc_cv_asm_global_directive=UNKNOWN for ac_globl in .globl .global .EXPORT; do cat > conftest.s < conftest.s < conftest.s < conftest.s < conftest.s < conftest.s < + +ENTRY(__copysign) +/* double [f1] copysign (double [f1] x, double [f2] y); + copysign(x,y) returns a value with the magnitude of x and + with the sign bit of y. */ + stwu 1,-16(1) + stfd 2,8(1) + lwz 3,8(1) + cmpwi 3,0 + addi 1,1,16 + blt 0f + fabs 1,1 + blr +0: fnabs 1,1 + blr + END (__copysign) + +weak_alias(__copysign,copysign) + +/* It turns out that it's safe to use this code even for single-precision. */ +weak_alias(__copysign,copysignf) +strong_alias(__copysign,__copysignf) + +#ifdef NO_LONG_DOUBLE +weak_alias(__copysign,copysignl) +strong_alias(__copysign,__copysignl) +#endif diff --git a/sysdeps/powerpc/fpu/s_copysignf.S b/sysdeps/powerpc/fpu/s_copysignf.S new file mode 100644 index 0000000..e05438a --- /dev/null +++ b/sysdeps/powerpc/fpu/s_copysignf.S @@ -0,0 +1 @@ +/* __copysignf is in s_copysign.S */ diff --git a/sysdeps/powerpc/fpu/s_fabs.S b/sysdeps/powerpc/fpu/s_fabs.S new file mode 100644 index 0000000..ec0bdb4 --- /dev/null +++ b/sysdeps/powerpc/fpu/s_fabs.S @@ -0,0 +1,37 @@ +/* Floating-point absolute value. PowerPC version. + Copyright (C) 1997, 1999 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +ENTRY(__fabs) +/* double [f1] fabs (double [f1] x); */ + fabs 1,1 + blr +END(__fabs) + +weak_alias(__fabs,fabs) + +/* It turns out that it's safe to use this code even for single-precision. */ +strong_alias(__fabs,__fabsf) +weak_alias(__fabs,fabsf) + +#ifdef NO_LONG_DOUBLE +weak_alias(__fabs,__fabsl) +weak_alias(__fabs,fabsl) +#endif diff --git a/sysdeps/powerpc/fpu/s_fabsf.S b/sysdeps/powerpc/fpu/s_fabsf.S new file mode 100644 index 0000000..877c710 --- /dev/null +++ b/sysdeps/powerpc/fpu/s_fabsf.S @@ -0,0 +1 @@ +/* __fabsf is in s_fabs.S */ diff --git a/sysdeps/powerpc/fpu/s_fdim.c b/sysdeps/powerpc/fpu/s_fdim.c new file mode 100644 index 0000000..da22f5c --- /dev/null +++ b/sysdeps/powerpc/fpu/s_fdim.c @@ -0,0 +1,31 @@ +/* Return positive difference between arguments. + Copyright (C) 1997 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +double +__fdim (double x, double y) +{ + return x < y ? 0 : x - y; +} +weak_alias (__fdim, fdim) +#ifdef NO_LONG_DOUBLE +strong_alias (__fdim, __fdiml) +weak_alias (__fdim, fdiml) +#endif diff --git a/sysdeps/powerpc/fpu/s_fdimf.c b/sysdeps/powerpc/fpu/s_fdimf.c new file mode 100644 index 0000000..bebe7e5 --- /dev/null +++ b/sysdeps/powerpc/fpu/s_fdimf.c @@ -0,0 +1,27 @@ +/* Return positive difference between arguments. + Copyright (C) 1997 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +float +__fdimf (float x, float y) +{ + return x < y ? 0 : x - y; +} +weak_alias (__fdimf, fdimf) diff --git a/sysdeps/powerpc/fpu/s_fmax.S b/sysdeps/powerpc/fpu/s_fmax.S new file mode 100644 index 0000000..d5373d7 --- /dev/null +++ b/sysdeps/powerpc/fpu/s_fmax.S @@ -0,0 +1,43 @@ +/* Floating-point maximum. PowerPC version. + Copyright (C) 1997, 1999 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +ENTRY(__fmax) +/* double [f1] fmax (double [f1] x, double [f2] y); */ + fcmpu 0,1,2 + blt 0,0f /* if x < y, neither x nor y can be NaN... */ + bnulr+ 0 +/* x and y are unordered, so one of x or y must be a NaN... */ + fcmpu 1,2,2 + bunlr 1 +0: fmr 1,2 + blr +END(__fmax) + +weak_alias(__fmax,fmax) + +/* It turns out that it's safe to use this code even for single-precision. */ +strong_alias(__fmax,__fmaxf) +weak_alias(__fmax,fmaxf) + +#ifdef NO_LONG_DOUBLE +weak_alias(__fmax,__fmaxl) +weak_alias(__fmax,fmaxl) +#endif diff --git a/sysdeps/powerpc/fpu/s_fmaxf.S b/sysdeps/powerpc/fpu/s_fmaxf.S new file mode 100644 index 0000000..3c2d62b --- /dev/null +++ b/sysdeps/powerpc/fpu/s_fmaxf.S @@ -0,0 +1 @@ +/* __fmaxf is in s_fmax.c */ diff --git a/sysdeps/powerpc/fpu/s_fmin.S b/sysdeps/powerpc/fpu/s_fmin.S new file mode 100644 index 0000000..919ceb1 --- /dev/null +++ b/sysdeps/powerpc/fpu/s_fmin.S @@ -0,0 +1,43 @@ +/* Floating-point minimum. PowerPC version. + Copyright (C) 1997, 1999 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +ENTRY(__fmin) +/* double [f1] fmin (double [f1] x, double [f2] y); */ + fcmpu 0,1,2 + bgt 0,0f /* if x > y, neither x nor y can be NaN... */ + bnulr+ 0 +/* x and y are unordered, so one of x or y must be a NaN... */ + fcmpu 1,2,2 + bunlr 1 +0: fmr 1,2 + blr +END(__fmin) + +weak_alias(__fmin,fmin) + +/* It turns out that it's safe to use this code even for single-precision. */ +strong_alias(__fmin,__fminf) +weak_alias(__fmin,fminf) + +#ifdef NO_LONG_DOUBLE +weak_alias(__fmin,__fminl) +weak_alias(__fmin,fminl) +#endif diff --git a/sysdeps/powerpc/fpu/s_fminf.S b/sysdeps/powerpc/fpu/s_fminf.S new file mode 100644 index 0000000..10ab7fe --- /dev/null +++ b/sysdeps/powerpc/fpu/s_fminf.S @@ -0,0 +1 @@ +/* __fminf is in s_fmin.c */ diff --git a/sysdeps/powerpc/fpu/s_isnan.c b/sysdeps/powerpc/fpu/s_isnan.c new file mode 100644 index 0000000..34019fd --- /dev/null +++ b/sysdeps/powerpc/fpu/s_isnan.c @@ -0,0 +1,47 @@ +/* Return 1 if argument is a NaN, else 0. + Copyright (C) 1997 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "math.h" +#include + +int __isnan(double x) +{ + fenv_t savedstate; + int result; + savedstate = fegetenv_register(); + reset_fpscr_bit(FPSCR_VE); + result = !(x == x); + fesetenv_register(savedstate); + return result; +} +weak_alias (__isnan, isnan) +/* It turns out that the 'double' version will also always work for + single-precision. Use explicit assembler to stop gcc complaining + that 'isnanf' takes a float parameter, not double. */ +asm ("\ + .globl __isnanf + .globl isnanf + .weak isnanf + .set __isnanf,__isnan + .set isnanf,__isnan +"); +#ifdef NO_LONG_DOUBLE +strong_alias (__isnan, __isnanl) +weak_alias (__isnan, isnanl) +#endif diff --git a/sysdeps/powerpc/fpu/s_isnanf.S b/sysdeps/powerpc/fpu/s_isnanf.S new file mode 100644 index 0000000..fc22f67 --- /dev/null +++ b/sysdeps/powerpc/fpu/s_isnanf.S @@ -0,0 +1 @@ +/* __isnanf is in s_isnan.c */ diff --git a/sysdeps/powerpc/fpu/s_llrint.c b/sysdeps/powerpc/fpu/s_llrint.c new file mode 100644 index 0000000..1789e79 --- /dev/null +++ b/sysdeps/powerpc/fpu/s_llrint.c @@ -0,0 +1,31 @@ +/* Round a double value to a long long in the current rounding mode. + Copyright (C) 1997 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "math.h" + +long long int +__llrint (double x) +{ + return (long long int) __rint (x); +} +weak_alias (__llrint, llrint) +#ifdef NO_LONG_DOUBLE +strong_alias (__llrint, __llrintl) +weak_alias (__llrint, llrintl) +#endif diff --git a/sysdeps/powerpc/fpu/s_llrintf.c b/sysdeps/powerpc/fpu/s_llrintf.c new file mode 100644 index 0000000..2068a02 --- /dev/null +++ b/sysdeps/powerpc/fpu/s_llrintf.c @@ -0,0 +1,27 @@ +/* Round a float value to a long long in the current rounding mode. + Copyright (C) 1997 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "math.h" + +long long int +__llrintf (float x) +{ + return (long long int) __rintf (x); +} +weak_alias (__llrintf, llrintf) diff --git a/sysdeps/powerpc/fpu/s_llround.c b/sysdeps/powerpc/fpu/s_llround.c new file mode 100644 index 0000000..6b49dbf --- /dev/null +++ b/sysdeps/powerpc/fpu/s_llround.c @@ -0,0 +1,50 @@ +/* Round double value to long long int. + Copyright (C) 1997 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +/* I think that what this routine is supposed to do is round a value + to the nearest integer, with values exactly on the boundary rounded + away from zero. */ +/* This routine relies on (long long)x, when x is out of range of a long long, + clipping to MAX_LLONG or MIN_LLONG. */ + +long long int +__llround (double x) +{ + double xrf; + long long int xr; + xr = (long long int) x; + xrf = (double) xr; + if (x >= 0.0) + if (x - xrf >= 0.5 && x - xrf < 1.0 && x+1 > 0) + return x+1; + else + return x; + else + if (xrf - x >= 0.5 && xrf - x < 1.0 && x-1 < 0) + return x-1; + else + return x; +} +weak_alias (__llround, llround) +#ifdef NO_LONG_DOUBLE +strong_alias (__llround, __llroundl) +weak_alias (__llround, llroundl) +#endif diff --git a/sysdeps/powerpc/fpu/s_llroundf.c b/sysdeps/powerpc/fpu/s_llroundf.c new file mode 100644 index 0000000..23f1c28 --- /dev/null +++ b/sysdeps/powerpc/fpu/s_llroundf.c @@ -0,0 +1,46 @@ +/* Round float value to long long int. + Copyright (C) 1997 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +/* I think that what this routine is supposed to do is round a value + to the nearest integer, with values exactly on the boundary rounded + away from zero. */ +/* This routine relies on (long long)x, when x is out of range of a long long, + clipping to MAX_LLONG or MIN_LLONG. */ + +long long int +__llroundf (float x) +{ + float xrf; + long long int xr; + xr = (long long int) x; + xrf = (float) xr; + if (x >= 0.0) + if (x - xrf >= 0.5 && x - xrf < 1.0 && x+1 > 0) + return x+1; + else + return x; + else + if (xrf - x >= 0.5 && xrf - x < 1.0 && x-1 < 0) + return x-1; + else + return x; +} +weak_alias (__llroundf, llroundf) diff --git a/sysdeps/powerpc/fpu/s_lrint.c b/sysdeps/powerpc/fpu/s_lrint.c new file mode 100644 index 0000000..a060598 --- /dev/null +++ b/sysdeps/powerpc/fpu/s_lrint.c @@ -0,0 +1,46 @@ +/* Round floating-point to integer. PowerPC version. + Copyright (C) 1997 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "math.h" + +long int +__lrint (double x) +{ + union { + double d; + long int ll[2]; + } u; + asm ("fctiw %0,%1" : "=f"(u.d) : "f"(x)); + return u.ll[1]; +} +weak_alias (__lrint, lrint) + +/* This code will also work for a 'float' argument. */ +asm ("\ + .globl __lrintf + .globl lrintf + .weak lrintf + .set __lrintf,__lrint + .set lrintf,__lrint +"); + +#ifdef NO_LONG_DOUBLE +strong_alias (__lrint, __lrintl) +weak_alias (__lrint, lrintl) +#endif diff --git a/sysdeps/powerpc/fpu/s_lrintf.S b/sysdeps/powerpc/fpu/s_lrintf.S new file mode 100644 index 0000000..e247665 --- /dev/null +++ b/sysdeps/powerpc/fpu/s_lrintf.S @@ -0,0 +1 @@ +/* __lrintf is in s_lrint.c */ diff --git a/sysdeps/powerpc/fpu/s_lround.c b/sysdeps/powerpc/fpu/s_lround.c new file mode 100644 index 0000000..c52c038 --- /dev/null +++ b/sysdeps/powerpc/fpu/s_lround.c @@ -0,0 +1,50 @@ +/* Round double value to long int. + Copyright (C) 1997 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +/* I think that what this routine is supposed to do is round a value + to the nearest integer, with values exactly on the boundary rounded + away from zero. */ +/* This routine relies on (long int)x, when x is out of range of a long int, + clipping to MAX_LONG or MIN_LONG. */ + +long int +__lround (double x) +{ + double xrf; + long int xr; + xr = (long int) x; + xrf = (double) xr; + if (x >= 0.0) + if (x - xrf >= 0.5 && x - xrf < 1.0 && x+1 > 0) + return x+1; + else + return x; + else + if (xrf - x >= 0.5 && xrf - x < 1.0 && x-1 < 0) + return x-1; + else + return x; +} +weak_alias (__lround, lround) +#ifdef NO_LONG_DOUBLE +strong_alias (__lround, __lroundl) +weak_alias (__lround, lroundl) +#endif diff --git a/sysdeps/powerpc/fpu/s_lroundf.c b/sysdeps/powerpc/fpu/s_lroundf.c new file mode 100644 index 0000000..ce1c3cf --- /dev/null +++ b/sysdeps/powerpc/fpu/s_lroundf.c @@ -0,0 +1,46 @@ +/* Round float value to long int. + Copyright (C) 1997 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +/* I think that what this routine is supposed to do is round a value + to the nearest integer, with values exactly on the boundary rounded + away from zero. */ +/* This routine relies on (long int)x, when x is out of range of a long int, + clipping to MAX_LONG or MIN_LONG. */ + +long int +__lroundf (float x) +{ + float xrf; + long int xr; + xr = (long int) x; + xrf = (float) xr; + if (x >= 0.0) + if (x - xrf >= 0.5 && x - xrf < 1.0 && x+1 > 0) + return x+1; + else + return x; + else + if (xrf - x >= 0.5 && xrf - x < 1.0 && x-1 < 0) + return x-1; + else + return x; +} +weak_alias (__lroundf, lroundf) diff --git a/sysdeps/powerpc/fpu/s_rint.c b/sysdeps/powerpc/fpu/s_rint.c new file mode 100644 index 0000000..a475875 --- /dev/null +++ b/sysdeps/powerpc/fpu/s_rint.c @@ -0,0 +1,47 @@ +/* Round a 64-bit floating point value to the nearest integer. + Copyright (C) 1997 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "math.h" + +double +__rint (double x) +{ + static const float TWO52 = 4503599627370496.0; + + if (fabs (x) < TWO52) + { + if (x > 0.0) + { + x += TWO52; + x -= TWO52; + } + else if (x < 0.0) + { + x -= TWO52; + x += TWO52; + } + } + + return x; +} +weak_alias (__rint, rint) +#ifdef NO_LONG_DOUBLE +strong_alias (__rint, __rintl) +weak_alias (__rint, rintl) +#endif diff --git a/sysdeps/powerpc/fpu/s_rintf.c b/sysdeps/powerpc/fpu/s_rintf.c new file mode 100644 index 0000000..dde40bb --- /dev/null +++ b/sysdeps/powerpc/fpu/s_rintf.c @@ -0,0 +1,43 @@ +/* Round a 32-bit floating point value to the nearest integer. + Copyright (C) 1997 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "math.h" + +float +__rintf (float x) +{ + static const float TWO23 = 8388608.0; + + if (fabsf (x) < TWO23) + { + if (x > 0.0) + { + x += TWO23; + x -= TWO23; + } + else if (x < 0.0) + { + x -= TWO23; + x += TWO23; + } + } + + return x; +} +weak_alias (__rintf, rintf) diff --git a/sysdeps/powerpc/fpu/t_sqrt.c b/sysdeps/powerpc/fpu/t_sqrt.c new file mode 100644 index 0000000..c49380c --- /dev/null +++ b/sysdeps/powerpc/fpu/t_sqrt.c @@ -0,0 +1,144 @@ +const float __t_sqrt[1024] = { +0.7078,0.7064, 0.7092,0.7050, 0.7106,0.7037, 0.7119,0.7023, 0.7133,0.7010, +0.7147,0.6996, 0.7160,0.6983, 0.7174,0.6970, 0.7187,0.6957, 0.7201,0.6943, +0.7215,0.6930, 0.7228,0.6917, 0.7242,0.6905, 0.7255,0.6892, 0.7269,0.6879, +0.7282,0.6866, 0.7295,0.6854, 0.7309,0.6841, 0.7322,0.6829, 0.7335,0.6816, +0.7349,0.6804, 0.7362,0.6792, 0.7375,0.6779, 0.7388,0.6767, 0.7402,0.6755, +0.7415,0.6743, 0.7428,0.6731, 0.7441,0.6719, 0.7454,0.6708, 0.7467,0.6696, +0.7480,0.6684, 0.7493,0.6672, 0.7507,0.6661, 0.7520,0.6649, 0.7532,0.6638, +0.7545,0.6627, 0.7558,0.6615, 0.7571,0.6604, 0.7584,0.6593, 0.7597,0.6582, +0.7610,0.6570, 0.7623,0.6559, 0.7635,0.6548, 0.7648,0.6537, 0.7661,0.6527, +0.7674,0.6516, 0.7686,0.6505, 0.7699,0.6494, 0.7712,0.6484, 0.7725,0.6473, +0.7737,0.6462, 0.7750,0.6452, 0.7762,0.6441, 0.7775,0.6431, 0.7787,0.6421, +0.7800,0.6410, 0.7812,0.6400, 0.7825,0.6390, 0.7837,0.6380, 0.7850,0.6370, +0.7862,0.6359, 0.7875,0.6349, 0.7887,0.6339, 0.7900,0.6330, 0.7912,0.6320, +0.7924,0.6310, 0.7937,0.6300, 0.7949,0.6290, 0.7961,0.6281, 0.7973,0.6271, +0.7986,0.6261, 0.7998,0.6252, 0.8010,0.6242, 0.8022,0.6233, 0.8034,0.6223, +0.8046,0.6214, 0.8059,0.6205, 0.8071,0.6195, 0.8083,0.6186, 0.8095,0.6177, +0.8107,0.6168, 0.8119,0.6158, 0.8131,0.6149, 0.8143,0.6140, 0.8155,0.6131, +0.8167,0.6122, 0.8179,0.6113, 0.8191,0.6104, 0.8203,0.6096, 0.8215,0.6087, +0.8227,0.6078, 0.8238,0.6069, 0.8250,0.6060, 0.8262,0.6052, 0.8274,0.6043, +0.8286,0.6035, 0.8297,0.6026, 0.8309,0.6017, 0.8321,0.6009, 0.8333,0.6000, +0.8344,0.5992, 0.8356,0.5984, 0.8368,0.5975, 0.8379,0.5967, 0.8391,0.5959, +0.8403,0.5950, 0.8414,0.5942, 0.8426,0.5934, 0.8437,0.5926, 0.8449,0.5918, +0.8461,0.5910, 0.8472,0.5902, 0.8484,0.5894, 0.8495,0.5886, 0.8507,0.5878, +0.8518,0.5870, 0.8530,0.5862, 0.8541,0.5854, 0.8552,0.5846, 0.8564,0.5838, +0.8575,0.5831, 0.8587,0.5823, 0.8598,0.5815, 0.8609,0.5808, 0.8621,0.5800, +0.8632,0.5792, 0.8643,0.5785, 0.8655,0.5777, 0.8666,0.5770, 0.8677,0.5762, +0.8688,0.5755, 0.8700,0.5747, 0.8711,0.5740, 0.8722,0.5733, 0.8733,0.5725, +0.8744,0.5718, 0.8756,0.5711, 0.8767,0.5703, 0.8778,0.5696, 0.8789,0.5689, +0.8800,0.5682, 0.8811,0.5675, 0.8822,0.5667, 0.8833,0.5660, 0.8844,0.5653, +0.8855,0.5646, 0.8866,0.5639, 0.8877,0.5632, 0.8888,0.5625, 0.8899,0.5618, +0.8910,0.5611, 0.8921,0.5605, 0.8932,0.5598, 0.8943,0.5591, 0.8954,0.5584, +0.8965,0.5577, 0.8976,0.5570, 0.8987,0.5564, 0.8998,0.5557, 0.9008,0.5550, +0.9019,0.5544, 0.9030,0.5537, 0.9041,0.5530, 0.9052,0.5524, 0.9062,0.5517, +0.9073,0.5511, 0.9084,0.5504, 0.9095,0.5498, 0.9105,0.5491, 0.9116,0.5485, +0.9127,0.5478, 0.9138,0.5472, 0.9148,0.5465, 0.9159,0.5459, 0.9170,0.5453, +0.9180,0.5446, 0.9191,0.5440, 0.9202,0.5434, 0.9212,0.5428, 0.9223,0.5421, +0.9233,0.5415, 0.9244,0.5409, 0.9254,0.5403, 0.9265,0.5397, 0.9276,0.5391, +0.9286,0.5384, 0.9297,0.5378, 0.9307,0.5372, 0.9318,0.5366, 0.9328,0.5360, +0.9338,0.5354, 0.9349,0.5348, 0.9359,0.5342, 0.9370,0.5336, 0.9380,0.5330, +0.9391,0.5324, 0.9401,0.5319, 0.9411,0.5313, 0.9422,0.5307, 0.9432,0.5301, +0.9442,0.5295, 0.9453,0.5289, 0.9463,0.5284, 0.9473,0.5278, 0.9484,0.5272, +0.9494,0.5266, 0.9504,0.5261, 0.9515,0.5255, 0.9525,0.5249, 0.9535,0.5244, +0.9545,0.5238, 0.9556,0.5233, 0.9566,0.5227, 0.9576,0.5221, 0.9586,0.5216, +0.9596,0.5210, 0.9607,0.5205, 0.9617,0.5199, 0.9627,0.5194, 0.9637,0.5188, +0.9647,0.5183, 0.9657,0.5177, 0.9667,0.5172, 0.9677,0.5167, 0.9687,0.5161, +0.9698,0.5156, 0.9708,0.5151, 0.9718,0.5145, 0.9728,0.5140, 0.9738,0.5135, +0.9748,0.5129, 0.9758,0.5124, 0.9768,0.5119, 0.9778,0.5114, 0.9788,0.5108, +0.9798,0.5103, 0.9808,0.5098, 0.9818,0.5093, 0.9828,0.5088, 0.9838,0.5083, +0.9847,0.5077, 0.9857,0.5072, 0.9867,0.5067, 0.9877,0.5062, 0.9887,0.5057, +0.9897,0.5052, 0.9907,0.5047, 0.9917,0.5042, 0.9926,0.5037, 0.9936,0.5032, +0.9946,0.5027, 0.9956,0.5022, 0.9966,0.5017, 0.9976,0.5012, 0.9985,0.5007, +0.9995,0.5002, +1.0010,0.4995, 1.0029,0.4985, 1.0049,0.4976, 1.0068,0.4966, 1.0088,0.4957, +1.0107,0.4947, 1.0126,0.4938, 1.0145,0.4928, 1.0165,0.4919, 1.0184,0.4910, +1.0203,0.4901, 1.0222,0.4891, 1.0241,0.4882, 1.0260,0.4873, 1.0279,0.4864, +1.0298,0.4855, 1.0317,0.4846, 1.0336,0.4837, 1.0355,0.4829, 1.0374,0.4820, +1.0393,0.4811, 1.0411,0.4802, 1.0430,0.4794, 1.0449,0.4785, 1.0468,0.4777, +1.0486,0.4768, 1.0505,0.4760, 1.0523,0.4751, 1.0542,0.4743, 1.0560,0.4735, +1.0579,0.4726, 1.0597,0.4718, 1.0616,0.4710, 1.0634,0.4702, 1.0653,0.4694, +1.0671,0.4686, 1.0689,0.4678, 1.0707,0.4670, 1.0726,0.4662, 1.0744,0.4654, +1.0762,0.4646, 1.0780,0.4638, 1.0798,0.4630, 1.0816,0.4623, 1.0834,0.4615, +1.0852,0.4607, 1.0870,0.4600, 1.0888,0.4592, 1.0906,0.4585, 1.0924,0.4577, +1.0942,0.4570, 1.0960,0.4562, 1.0978,0.4555, 1.0995,0.4547, 1.1013,0.4540, +1.1031,0.4533, 1.1049,0.4525, 1.1066,0.4518, 1.1084,0.4511, 1.1101,0.4504, +1.1119,0.4497, 1.1137,0.4490, 1.1154,0.4483, 1.1172,0.4476, 1.1189,0.4469, +1.1207,0.4462, 1.1224,0.4455, 1.1241,0.4448, 1.1259,0.4441, 1.1276,0.4434, +1.1293,0.4427, 1.1311,0.4421, 1.1328,0.4414, 1.1345,0.4407, 1.1362,0.4401, +1.1379,0.4394, 1.1397,0.4387, 1.1414,0.4381, 1.1431,0.4374, 1.1448,0.4368, +1.1465,0.4361, 1.1482,0.4355, 1.1499,0.4348, 1.1516,0.4342, 1.1533,0.4335, +1.1550,0.4329, 1.1567,0.4323, 1.1584,0.4316, 1.1600,0.4310, 1.1617,0.4304, +1.1634,0.4298, 1.1651,0.4292, 1.1668,0.4285, 1.1684,0.4279, 1.1701,0.4273, +1.1718,0.4267, 1.1734,0.4261, 1.1751,0.4255, 1.1768,0.4249, 1.1784,0.4243, +1.1801,0.4237, 1.1817,0.4231, 1.1834,0.4225, 1.1850,0.4219, 1.1867,0.4213, +1.1883,0.4208, 1.1900,0.4202, 1.1916,0.4196, 1.1932,0.4190, 1.1949,0.4185, +1.1965,0.4179, 1.1981,0.4173, 1.1998,0.4167, 1.2014,0.4162, 1.2030,0.4156, +1.2046,0.4151, 1.2063,0.4145, 1.2079,0.4139, 1.2095,0.4134, 1.2111,0.4128, +1.2127,0.4123, 1.2143,0.4117, 1.2159,0.4112, 1.2175,0.4107, 1.2192,0.4101, +1.2208,0.4096, 1.2224,0.4090, 1.2239,0.4085, 1.2255,0.4080, 1.2271,0.4075, +1.2287,0.4069, 1.2303,0.4064, 1.2319,0.4059, 1.2335,0.4054, 1.2351,0.4048, +1.2366,0.4043, 1.2382,0.4038, 1.2398,0.4033, 1.2414,0.4028, 1.2429,0.4023, +1.2445,0.4018, 1.2461,0.4013, 1.2477,0.4008, 1.2492,0.4003, 1.2508,0.3998, +1.2523,0.3993, 1.2539,0.3988, 1.2555,0.3983, 1.2570,0.3978, 1.2586,0.3973, +1.2601,0.3968, 1.2617,0.3963, 1.2632,0.3958, 1.2648,0.3953, 1.2663,0.3949, +1.2678,0.3944, 1.2694,0.3939, 1.2709,0.3934, 1.2725,0.3929, 1.2740,0.3925, +1.2755,0.3920, 1.2771,0.3915, 1.2786,0.3911, 1.2801,0.3906, 1.2816,0.3901, +1.2832,0.3897, 1.2847,0.3892, 1.2862,0.3887, 1.2877,0.3883, 1.2892,0.3878, +1.2907,0.3874, 1.2923,0.3869, 1.2938,0.3865, 1.2953,0.3860, 1.2968,0.3856, +1.2983,0.3851, 1.2998,0.3847, 1.3013,0.3842, 1.3028,0.3838, 1.3043,0.3834, +1.3058,0.3829, 1.3073,0.3825, 1.3088,0.3820, 1.3103,0.3816, 1.3118,0.3812, +1.3132,0.3807, 1.3147,0.3803, 1.3162,0.3799, 1.3177,0.3794, 1.3192,0.3790, +1.3207,0.3786, 1.3221,0.3782, 1.3236,0.3778, 1.3251,0.3773, 1.3266,0.3769, +1.3280,0.3765, 1.3295,0.3761, 1.3310,0.3757, 1.3324,0.3753, 1.3339,0.3748, +1.3354,0.3744, 1.3368,0.3740, 1.3383,0.3736, 1.3397,0.3732, 1.3412,0.3728, +1.3427,0.3724, 1.3441,0.3720, 1.3456,0.3716, 1.3470,0.3712, 1.3485,0.3708, +1.3499,0.3704, 1.3514,0.3700, 1.3528,0.3696, 1.3542,0.3692, 1.3557,0.3688, +1.3571,0.3684, 1.3586,0.3680, 1.3600,0.3676, 1.3614,0.3673, 1.3629,0.3669, +1.3643,0.3665, 1.3657,0.3661, 1.3672,0.3657, 1.3686,0.3653, 1.3700,0.3650, +1.3714,0.3646, 1.3729,0.3642, 1.3743,0.3638, 1.3757,0.3634, 1.3771,0.3631, +1.3785,0.3627, 1.3800,0.3623, 1.3814,0.3620, 1.3828,0.3616, 1.3842,0.3612, +1.3856,0.3609, 1.3870,0.3605, 1.3884,0.3601, 1.3898,0.3598, 1.3912,0.3594, +1.3926,0.3590, 1.3940,0.3587, 1.3954,0.3583, 1.3968,0.3580, 1.3982,0.3576, +1.3996,0.3572, 1.4010,0.3569, 1.4024,0.3565, 1.4038,0.3562, 1.4052,0.3558, +1.4066,0.3555, 1.4080,0.3551, 1.4094,0.3548, 1.4108,0.3544, 1.4121,0.3541, +1.4135,0.3537 +}; + + +/* Generated by: */ +#if 0 +#include +#include +#include + +int +main(int argc, char **argv) +{ + int i, j; + + printf ("const float __t_sqrt[1024] = {"); + for (i = 0; i < 2; i++) + { + putchar('\n'); + for (j = 0; j < 256; j++) + { + double mval = j/512.0 + 0.5; + double eval = i==0 ? 1.0 : 2.0; + double ls = sqrt(mval*eval); + double hs = sqrt((mval+1/512.0)*eval); + double as = (ls+hs)*0.5; + double lx = 1/(2.0*ls); + double hx = 1/(2.0*hs); + double ax = (lx+hx)*0.5; + + printf("%.4f,%.4f%s",as,ax, + i*j==255 ? "\n" : j % 5 == 4 ? ",\n" : ", "); + assert((hs-ls)/as < 1/256.0); + assert((hx-lx)/ax < 1/256.0); + } + } + printf ("};\n"); + return 0; +} +#endif /* 0 */ diff --git a/sysdeps/powerpc/fpu/w_sqrt.c b/sysdeps/powerpc/fpu/w_sqrt.c new file mode 100644 index 0000000..c42ace5 --- /dev/null +++ b/sysdeps/powerpc/fpu/w_sqrt.c @@ -0,0 +1,141 @@ +/* Single-precision floating point square root. + Copyright (C) 1997 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include +#include + +static const double almost_half = 0.5000000000000001; /* 0.5 + 2^-53 */ +static const uint32_t a_nan = 0x7fc00000; +static const uint32_t a_inf = 0x7f800000; +static const float two108 = 3.245185536584267269e+32; +static const float twom54 = 5.551115123125782702e-17; +extern const float __t_sqrt[1024]; + +/* The method is based on a description in + Computation of elementary functions on the IBM RISC System/6000 processor, + P. W. Markstein, IBM J. Res. Develop, 34(1) 1990. + Basically, it consists of two interleaved Newton-Rhapson approximations, + one to find the actual square root, and one to find its reciprocal + without the expense of a division operation. The tricky bit here + is the use of the POWER/PowerPC multiply-add operation to get the + required accuracy with high speed. + + The argument reduction works by a combination of table lookup to + obtain the initial guesses, and some careful modification of the + generated guesses (which mostly runs on the integer unit, while the + Newton-Rhapson is running on the FPU). */ +double +__sqrt(double x) +{ + const float inf = *(const float *)&a_inf; + /* x = f_wash(x); *//* This ensures only one exception for SNaN. */ + if (x > 0) + { + if (x != inf) + { + /* Variables named starting with 's' exist in the + argument-reduced space, so that 2 > sx >= 0.5, + 1.41... > sg >= 0.70.., 0.70.. >= sy > 0.35... . + Variables named ending with 'i' are integer versions of + floating-point values. */ + double sx; /* The value of which we're trying to find the + square root. */ + double sg,g; /* Guess of the square root of x. */ + double sd,d; /* Difference between the square of the guess and x. */ + double sy; /* Estimate of 1/2g (overestimated by 1ulp). */ + double sy2; /* 2*sy */ + double e; /* Difference between y*g and 1/2 (se = e * fsy). */ + double shx; /* == sx * fsg */ + double fsg; /* sg*fsg == g. */ + fenv_t fe; /* Saved floating-point environment (stores rounding + mode and whether the inexact exception is + enabled). */ + uint32_t xi0, xi1, sxi, fsgi; + const float *t_sqrt; + + fe = fegetenv_register(); + EXTRACT_WORDS (xi0,xi1,x); + relax_fenv_state(); + sxi = (xi0 & 0x3fffffff) | 0x3fe00000; + INSERT_WORDS (sx, sxi, xi1); + t_sqrt = __t_sqrt + (xi0 >> (52-32-8-1) & 0x3fe); + sg = t_sqrt[0]; + sy = t_sqrt[1]; + + /* Here we have three Newton-Rhapson iterations each of a + division and a square root and the remainder of the + argument reduction, all interleaved. */ + sd = -(sg*sg - sx); + fsgi = (xi0 + 0x40000000) >> 1 & 0x7ff00000; + sy2 = sy + sy; + sg = sy*sd + sg; /* 16-bit approximation to sqrt(sx). */ + INSERT_WORDS (fsg, fsgi, 0); + e = -(sy*sg - almost_half); + sd = -(sg*sg - sx); + if ((xi0 & 0x7ff00000) == 0) + goto denorm; + sy = sy + e*sy2; + sg = sg + sy*sd; /* 32-bit approximation to sqrt(sx). */ + sy2 = sy + sy; + e = -(sy*sg - almost_half); + sd = -(sg*sg - sx); + sy = sy + e*sy2; + shx = sx * fsg; + sg = sg + sy*sd; /* 64-bit approximation to sqrt(sx), + but perhaps rounded incorrectly. */ + sy2 = sy + sy; + g = sg * fsg; + e = -(sy*sg - almost_half); + d = -(g*sg - shx); + sy = sy + e*sy2; + fesetenv_register (fe); + return g + sy*d; + denorm: + /* For denormalised numbers, we normalise, calculate the + square root, and return an adjusted result. */ + fesetenv_register (fe); + return __sqrt(x * two108) * twom54; + } + } + else if (x < 0) + { +#ifdef FE_INVALID_SQRT + feraiseexcept (FE_INVALID_SQRT); + /* For some reason, some PowerPC processors don't implement + FE_INVALID_SQRT. I guess no-one ever thought they'd be + used for square roots... :-) */ + if (!fetestexcept (FE_INVALID)) +#endif + feraiseexcept (FE_INVALID); +#ifndef _IEEE_LIBM + if (_LIB_VERSION != _IEEE_) + x = __kernel_standard(x,x,26); + else +#endif + x = *(const float*)&a_nan; + } + return f_wash(x); +} + +weak_alias (__sqrt, sqrt) +/* Strictly, this is wrong, but the only places where _ieee754_sqrt is + used will not pass in a negative result. */ +strong_alias(__sqrt,__ieee754_sqrt) diff --git a/sysdeps/powerpc/fpu/w_sqrtf.c b/sysdeps/powerpc/fpu/w_sqrtf.c new file mode 100644 index 0000000..d40ade1 --- /dev/null +++ b/sysdeps/powerpc/fpu/w_sqrtf.c @@ -0,0 +1,136 @@ +/* Single-precision floating point square root. + Copyright (C) 1997 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include +#include + +static const float almost_half = 0.50000006; /* 0.5 + 2^-24 */ +static const uint32_t a_nan = 0x7fc00000; +static const uint32_t a_inf = 0x7f800000; +static const float two48 = 281474976710656.0; +static const float twom24 = 5.9604644775390625e-8; +extern const float __t_sqrt[1024]; + +/* The method is based on a description in + Computation of elementary functions on the IBM RISC System/6000 processor, + P. W. Markstein, IBM J. Res. Develop, 34(1) 1990. + Basically, it consists of two interleaved Newton-Rhapson approximations, + one to find the actual square root, and one to find its reciprocal + without the expense of a division operation. The tricky bit here + is the use of the POWER/PowerPC multiply-add operation to get the + required accuracy with high speed. + + The argument reduction works by a combination of table lookup to + obtain the initial guesses, and some careful modification of the + generated guesses (which mostly runs on the integer unit, while the + Newton-Rhapson is running on the FPU). */ +float +__sqrtf(float x) +{ + const float inf = *(const float *)&a_inf; + /* x = f_washf(x); *//* This ensures only one exception for SNaN. */ + if (x > 0) + { + if (x != inf) + { + /* Variables named starting with 's' exist in the + argument-reduced space, so that 2 > sx >= 0.5, + 1.41... > sg >= 0.70.., 0.70.. >= sy > 0.35... . + Variables named ending with 'i' are integer versions of + floating-point values. */ + float sx; /* The value of which we're trying to find the square + root. */ + float sg,g; /* Guess of the square root of x. */ + float sd,d; /* Difference between the square of the guess and x. */ + float sy; /* Estimate of 1/2g (overestimated by 1ulp). */ + float sy2; /* 2*sy */ + float e; /* Difference between y*g and 1/2 (note that e==se). */ + float shx; /* == sx * fsg */ + float fsg; /* sg*fsg == g. */ + fenv_t fe; /* Saved floating-point environment (stores rounding + mode and whether the inexact exception is + enabled). */ + uint32_t xi, sxi, fsgi; + const float *t_sqrt; + + GET_FLOAT_WORD (xi, x); + fe = fegetenv_register (); + relax_fenv_state (); + sxi = (xi & 0x3fffffff) | 0x3f000000; + SET_FLOAT_WORD (sx, sxi); + t_sqrt = __t_sqrt + (xi >> (23-8-1) & 0x3fe); + sg = t_sqrt[0]; + sy = t_sqrt[1]; + + /* Here we have three Newton-Rhapson iterations each of a + division and a square root and the remainder of the + argument reduction, all interleaved. */ + sd = -(sg*sg - sx); + fsgi = (xi + 0x40000000) >> 1 & 0x7f800000; + sy2 = sy + sy; + sg = sy*sd + sg; /* 16-bit approximation to sqrt(sx). */ + e = -(sy*sg - almost_half); + SET_FLOAT_WORD (fsg, fsgi); + sd = -(sg*sg - sx); + sy = sy + e*sy2; + if ((xi & 0x7f800000) == 0) + goto denorm; + shx = sx * fsg; + sg = sg + sy*sd; /* 32-bit approximation to sqrt(sx), + but perhaps rounded incorrectly. */ + sy2 = sy + sy; + g = sg * fsg; + e = -(sy*sg - almost_half); + d = -(g*sg - shx); + sy = sy + e*sy2; + fesetenv_register (fe); + return g + sy*d; + denorm: + /* For denormalised numbers, we normalise, calculate the + square root, and return an adjusted result. */ + fesetenv_register (fe); + return __sqrtf(x * two48) * twom24; + } + } + else if (x < 0) + { +#ifdef FE_INVALID_SQRT + feraiseexcept (FE_INVALID_SQRT); + /* For some reason, some PowerPC processors don't implement + FE_INVALID_SQRT. I guess no-one ever thought they'd be + used for square roots... :-) */ + if (!fetestexcept (FE_INVALID)) +#endif + feraiseexcept (FE_INVALID); +#ifndef _IEEE_LIBM + if (_LIB_VERSION != _IEEE_) + x = __kernel_standard(x,x,126); + else +#endif + x = *(const float*)&a_nan; + } + return f_washf(x); +} + +weak_alias (__sqrtf, sqrtf) +/* Strictly, this is wrong, but the only places where _ieee754_sqrt is + used will not pass in a negative result. */ +strong_alias(__sqrtf,__ieee754_sqrtf) diff --git a/sysdeps/powerpc/s_copysign.S b/sysdeps/powerpc/s_copysign.S deleted file mode 100644 index 6d5ba82..0000000 --- a/sysdeps/powerpc/s_copysign.S +++ /dev/null @@ -1,50 +0,0 @@ -/* Copy a sign bit between floating-point values. - Copyright (C) 1997 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* This has been coded in assembler because GCC makes such a mess of it - when it's coded in C. */ - -#include - -ENTRY(__copysign) -/* double [f1] copysign (double [f1] x, double [f2] y); - copysign(x,y) returns a value with the magnitude of x and - with the sign bit of y. */ - stwu %r1,-16(%r1) - stfd %f2,8(%r1) - lwz %r3,8(%r1) - cmpwi %r3,0 - addi %r1,%r1,16 - blt 0f - fabs %f1,%f1 - blr -0: fnabs %f1,%f1 - blr - END (__copysign) - -weak_alias(__copysign,copysign) - -/* It turns out that it's safe to use this code even for single-precision. */ -weak_alias(__copysign,copysignf) -strong_alias(__copysign,__copysignf) - -#ifdef NO_LONG_DOUBLE -weak_alias(__copysign,copysignl) -strong_alias(__copysign,__copysignl) -#endif diff --git a/sysdeps/powerpc/s_copysignf.S b/sysdeps/powerpc/s_copysignf.S deleted file mode 100644 index e05438a..0000000 --- a/sysdeps/powerpc/s_copysignf.S +++ /dev/null @@ -1 +0,0 @@ -/* __copysignf is in s_copysign.S */ diff --git a/sysdeps/powerpc/s_fabs.S b/sysdeps/powerpc/s_fabs.S deleted file mode 100644 index 3c6374b..0000000 --- a/sysdeps/powerpc/s_fabs.S +++ /dev/null @@ -1,37 +0,0 @@ -/* Floating-point absolute value. PowerPC version. - Copyright (C) 1997 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -ENTRY(__fabs) -/* double [f1] fabs (double [f1] x); */ - fabs %f1,%f1 - blr -END(__fabs) - -weak_alias(__fabs,fabs) - -/* It turns out that it's safe to use this code even for single-precision. */ -strong_alias(__fabs,__fabsf) -weak_alias(__fabs,fabsf) - -#ifdef NO_LONG_DOUBLE -weak_alias(__fabs,__fabsl) -weak_alias(__fabs,fabsl) -#endif diff --git a/sysdeps/powerpc/s_fabsf.S b/sysdeps/powerpc/s_fabsf.S deleted file mode 100644 index 877c710..0000000 --- a/sysdeps/powerpc/s_fabsf.S +++ /dev/null @@ -1 +0,0 @@ -/* __fabsf is in s_fabs.S */ diff --git a/sysdeps/powerpc/s_fdim.c b/sysdeps/powerpc/s_fdim.c deleted file mode 100644 index da22f5c..0000000 --- a/sysdeps/powerpc/s_fdim.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Return positive difference between arguments. - Copyright (C) 1997 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -double -__fdim (double x, double y) -{ - return x < y ? 0 : x - y; -} -weak_alias (__fdim, fdim) -#ifdef NO_LONG_DOUBLE -strong_alias (__fdim, __fdiml) -weak_alias (__fdim, fdiml) -#endif diff --git a/sysdeps/powerpc/s_fdimf.c b/sysdeps/powerpc/s_fdimf.c deleted file mode 100644 index bebe7e5..0000000 --- a/sysdeps/powerpc/s_fdimf.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Return positive difference between arguments. - Copyright (C) 1997 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -float -__fdimf (float x, float y) -{ - return x < y ? 0 : x - y; -} -weak_alias (__fdimf, fdimf) diff --git a/sysdeps/powerpc/s_fmax.S b/sysdeps/powerpc/s_fmax.S deleted file mode 100644 index 559769a..0000000 --- a/sysdeps/powerpc/s_fmax.S +++ /dev/null @@ -1,43 +0,0 @@ -/* Floating-point maximum. PowerPC version. - Copyright (C) 1997 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -ENTRY(__fmax) -/* double [f1] fmax (double [f1] x, double [f2] y); */ - fcmpu %cr0,%f1,%f2 - blt %cr0,0f /* if x < y, neither x nor y can be NaN... */ - bnulr+ %cr0 -/* x and y are unordered, so one of x or y must be a NaN... */ - fcmpu %cr1,%f2,%f2 - bunlr %cr1 -0: fmr %f1,%f2 - blr -END(__fmax) - -weak_alias(__fmax,fmax) - -/* It turns out that it's safe to use this code even for single-precision. */ -strong_alias(__fmax,__fmaxf) -weak_alias(__fmax,fmaxf) - -#ifdef NO_LONG_DOUBLE -weak_alias(__fmax,__fmaxl) -weak_alias(__fmax,fmaxl) -#endif diff --git a/sysdeps/powerpc/s_fmaxf.S b/sysdeps/powerpc/s_fmaxf.S deleted file mode 100644 index 3c2d62b..0000000 --- a/sysdeps/powerpc/s_fmaxf.S +++ /dev/null @@ -1 +0,0 @@ -/* __fmaxf is in s_fmax.c */ diff --git a/sysdeps/powerpc/s_fmin.S b/sysdeps/powerpc/s_fmin.S deleted file mode 100644 index 72516c2..0000000 --- a/sysdeps/powerpc/s_fmin.S +++ /dev/null @@ -1,43 +0,0 @@ -/* Floating-point minimum. PowerPC version. - Copyright (C) 1997 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -ENTRY(__fmin) -/* double [f1] fmin (double [f1] x, double [f2] y); */ - fcmpu %cr0,%f1,%f2 - bgt %cr0,0f /* if x > y, neither x nor y can be NaN... */ - bnulr+ %cr0 -/* x and y are unordered, so one of x or y must be a NaN... */ - fcmpu %cr1,%f2,%f2 - bunlr %cr1 -0: fmr %f1,%f2 - blr -END(__fmin) - -weak_alias(__fmin,fmin) - -/* It turns out that it's safe to use this code even for single-precision. */ -strong_alias(__fmin,__fminf) -weak_alias(__fmin,fminf) - -#ifdef NO_LONG_DOUBLE -weak_alias(__fmin,__fminl) -weak_alias(__fmin,fminl) -#endif diff --git a/sysdeps/powerpc/s_fminf.S b/sysdeps/powerpc/s_fminf.S deleted file mode 100644 index 10ab7fe..0000000 --- a/sysdeps/powerpc/s_fminf.S +++ /dev/null @@ -1 +0,0 @@ -/* __fminf is in s_fmin.c */ diff --git a/sysdeps/powerpc/s_isnan.c b/sysdeps/powerpc/s_isnan.c deleted file mode 100644 index 34019fd..0000000 --- a/sysdeps/powerpc/s_isnan.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Return 1 if argument is a NaN, else 0. - Copyright (C) 1997 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "math.h" -#include - -int __isnan(double x) -{ - fenv_t savedstate; - int result; - savedstate = fegetenv_register(); - reset_fpscr_bit(FPSCR_VE); - result = !(x == x); - fesetenv_register(savedstate); - return result; -} -weak_alias (__isnan, isnan) -/* It turns out that the 'double' version will also always work for - single-precision. Use explicit assembler to stop gcc complaining - that 'isnanf' takes a float parameter, not double. */ -asm ("\ - .globl __isnanf - .globl isnanf - .weak isnanf - .set __isnanf,__isnan - .set isnanf,__isnan -"); -#ifdef NO_LONG_DOUBLE -strong_alias (__isnan, __isnanl) -weak_alias (__isnan, isnanl) -#endif diff --git a/sysdeps/powerpc/s_isnanf.S b/sysdeps/powerpc/s_isnanf.S deleted file mode 100644 index fc22f67..0000000 --- a/sysdeps/powerpc/s_isnanf.S +++ /dev/null @@ -1 +0,0 @@ -/* __isnanf is in s_isnan.c */ diff --git a/sysdeps/powerpc/s_llrint.c b/sysdeps/powerpc/s_llrint.c deleted file mode 100644 index 1789e79..0000000 --- a/sysdeps/powerpc/s_llrint.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Round a double value to a long long in the current rounding mode. - Copyright (C) 1997 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "math.h" - -long long int -__llrint (double x) -{ - return (long long int) __rint (x); -} -weak_alias (__llrint, llrint) -#ifdef NO_LONG_DOUBLE -strong_alias (__llrint, __llrintl) -weak_alias (__llrint, llrintl) -#endif diff --git a/sysdeps/powerpc/s_llrintf.c b/sysdeps/powerpc/s_llrintf.c deleted file mode 100644 index 2068a02..0000000 --- a/sysdeps/powerpc/s_llrintf.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Round a float value to a long long in the current rounding mode. - Copyright (C) 1997 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "math.h" - -long long int -__llrintf (float x) -{ - return (long long int) __rintf (x); -} -weak_alias (__llrintf, llrintf) diff --git a/sysdeps/powerpc/s_llround.c b/sysdeps/powerpc/s_llround.c deleted file mode 100644 index 6b49dbf..0000000 --- a/sysdeps/powerpc/s_llround.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Round double value to long long int. - Copyright (C) 1997 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -/* I think that what this routine is supposed to do is round a value - to the nearest integer, with values exactly on the boundary rounded - away from zero. */ -/* This routine relies on (long long)x, when x is out of range of a long long, - clipping to MAX_LLONG or MIN_LLONG. */ - -long long int -__llround (double x) -{ - double xrf; - long long int xr; - xr = (long long int) x; - xrf = (double) xr; - if (x >= 0.0) - if (x - xrf >= 0.5 && x - xrf < 1.0 && x+1 > 0) - return x+1; - else - return x; - else - if (xrf - x >= 0.5 && xrf - x < 1.0 && x-1 < 0) - return x-1; - else - return x; -} -weak_alias (__llround, llround) -#ifdef NO_LONG_DOUBLE -strong_alias (__llround, __llroundl) -weak_alias (__llround, llroundl) -#endif diff --git a/sysdeps/powerpc/s_llroundf.c b/sysdeps/powerpc/s_llroundf.c deleted file mode 100644 index 23f1c28..0000000 --- a/sysdeps/powerpc/s_llroundf.c +++ /dev/null @@ -1,46 +0,0 @@ -/* Round float value to long long int. - Copyright (C) 1997 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -/* I think that what this routine is supposed to do is round a value - to the nearest integer, with values exactly on the boundary rounded - away from zero. */ -/* This routine relies on (long long)x, when x is out of range of a long long, - clipping to MAX_LLONG or MIN_LLONG. */ - -long long int -__llroundf (float x) -{ - float xrf; - long long int xr; - xr = (long long int) x; - xrf = (float) xr; - if (x >= 0.0) - if (x - xrf >= 0.5 && x - xrf < 1.0 && x+1 > 0) - return x+1; - else - return x; - else - if (xrf - x >= 0.5 && xrf - x < 1.0 && x-1 < 0) - return x-1; - else - return x; -} -weak_alias (__llroundf, llroundf) diff --git a/sysdeps/powerpc/s_lrint.c b/sysdeps/powerpc/s_lrint.c deleted file mode 100644 index a060598..0000000 --- a/sysdeps/powerpc/s_lrint.c +++ /dev/null @@ -1,46 +0,0 @@ -/* Round floating-point to integer. PowerPC version. - Copyright (C) 1997 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "math.h" - -long int -__lrint (double x) -{ - union { - double d; - long int ll[2]; - } u; - asm ("fctiw %0,%1" : "=f"(u.d) : "f"(x)); - return u.ll[1]; -} -weak_alias (__lrint, lrint) - -/* This code will also work for a 'float' argument. */ -asm ("\ - .globl __lrintf - .globl lrintf - .weak lrintf - .set __lrintf,__lrint - .set lrintf,__lrint -"); - -#ifdef NO_LONG_DOUBLE -strong_alias (__lrint, __lrintl) -weak_alias (__lrint, lrintl) -#endif diff --git a/sysdeps/powerpc/s_lrintf.S b/sysdeps/powerpc/s_lrintf.S deleted file mode 100644 index e247665..0000000 --- a/sysdeps/powerpc/s_lrintf.S +++ /dev/null @@ -1 +0,0 @@ -/* __lrintf is in s_lrint.c */ diff --git a/sysdeps/powerpc/s_lround.c b/sysdeps/powerpc/s_lround.c deleted file mode 100644 index c52c038..0000000 --- a/sysdeps/powerpc/s_lround.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Round double value to long int. - Copyright (C) 1997 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -/* I think that what this routine is supposed to do is round a value - to the nearest integer, with values exactly on the boundary rounded - away from zero. */ -/* This routine relies on (long int)x, when x is out of range of a long int, - clipping to MAX_LONG or MIN_LONG. */ - -long int -__lround (double x) -{ - double xrf; - long int xr; - xr = (long int) x; - xrf = (double) xr; - if (x >= 0.0) - if (x - xrf >= 0.5 && x - xrf < 1.0 && x+1 > 0) - return x+1; - else - return x; - else - if (xrf - x >= 0.5 && xrf - x < 1.0 && x-1 < 0) - return x-1; - else - return x; -} -weak_alias (__lround, lround) -#ifdef NO_LONG_DOUBLE -strong_alias (__lround, __lroundl) -weak_alias (__lround, lroundl) -#endif diff --git a/sysdeps/powerpc/s_lroundf.c b/sysdeps/powerpc/s_lroundf.c deleted file mode 100644 index ce1c3cf..0000000 --- a/sysdeps/powerpc/s_lroundf.c +++ /dev/null @@ -1,46 +0,0 @@ -/* Round float value to long int. - Copyright (C) 1997 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -/* I think that what this routine is supposed to do is round a value - to the nearest integer, with values exactly on the boundary rounded - away from zero. */ -/* This routine relies on (long int)x, when x is out of range of a long int, - clipping to MAX_LONG or MIN_LONG. */ - -long int -__lroundf (float x) -{ - float xrf; - long int xr; - xr = (long int) x; - xrf = (float) xr; - if (x >= 0.0) - if (x - xrf >= 0.5 && x - xrf < 1.0 && x+1 > 0) - return x+1; - else - return x; - else - if (xrf - x >= 0.5 && xrf - x < 1.0 && x-1 < 0) - return x-1; - else - return x; -} -weak_alias (__lroundf, lroundf) diff --git a/sysdeps/powerpc/s_rint.c b/sysdeps/powerpc/s_rint.c deleted file mode 100644 index a475875..0000000 --- a/sysdeps/powerpc/s_rint.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Round a 64-bit floating point value to the nearest integer. - Copyright (C) 1997 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "math.h" - -double -__rint (double x) -{ - static const float TWO52 = 4503599627370496.0; - - if (fabs (x) < TWO52) - { - if (x > 0.0) - { - x += TWO52; - x -= TWO52; - } - else if (x < 0.0) - { - x -= TWO52; - x += TWO52; - } - } - - return x; -} -weak_alias (__rint, rint) -#ifdef NO_LONG_DOUBLE -strong_alias (__rint, __rintl) -weak_alias (__rint, rintl) -#endif diff --git a/sysdeps/powerpc/s_rintf.c b/sysdeps/powerpc/s_rintf.c deleted file mode 100644 index dde40bb..0000000 --- a/sysdeps/powerpc/s_rintf.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Round a 32-bit floating point value to the nearest integer. - Copyright (C) 1997 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "math.h" - -float -__rintf (float x) -{ - static const float TWO23 = 8388608.0; - - if (fabsf (x) < TWO23) - { - if (x > 0.0) - { - x += TWO23; - x -= TWO23; - } - else if (x < 0.0) - { - x -= TWO23; - x += TWO23; - } - } - - return x; -} -weak_alias (__rintf, rintf) diff --git a/sysdeps/powerpc/t_sqrt.c b/sysdeps/powerpc/t_sqrt.c deleted file mode 100644 index c49380c..0000000 --- a/sysdeps/powerpc/t_sqrt.c +++ /dev/null @@ -1,144 +0,0 @@ -const float __t_sqrt[1024] = { -0.7078,0.7064, 0.7092,0.7050, 0.7106,0.7037, 0.7119,0.7023, 0.7133,0.7010, -0.7147,0.6996, 0.7160,0.6983, 0.7174,0.6970, 0.7187,0.6957, 0.7201,0.6943, -0.7215,0.6930, 0.7228,0.6917, 0.7242,0.6905, 0.7255,0.6892, 0.7269,0.6879, -0.7282,0.6866, 0.7295,0.6854, 0.7309,0.6841, 0.7322,0.6829, 0.7335,0.6816, -0.7349,0.6804, 0.7362,0.6792, 0.7375,0.6779, 0.7388,0.6767, 0.7402,0.6755, -0.7415,0.6743, 0.7428,0.6731, 0.7441,0.6719, 0.7454,0.6708, 0.7467,0.6696, -0.7480,0.6684, 0.7493,0.6672, 0.7507,0.6661, 0.7520,0.6649, 0.7532,0.6638, -0.7545,0.6627, 0.7558,0.6615, 0.7571,0.6604, 0.7584,0.6593, 0.7597,0.6582, -0.7610,0.6570, 0.7623,0.6559, 0.7635,0.6548, 0.7648,0.6537, 0.7661,0.6527, -0.7674,0.6516, 0.7686,0.6505, 0.7699,0.6494, 0.7712,0.6484, 0.7725,0.6473, -0.7737,0.6462, 0.7750,0.6452, 0.7762,0.6441, 0.7775,0.6431, 0.7787,0.6421, -0.7800,0.6410, 0.7812,0.6400, 0.7825,0.6390, 0.7837,0.6380, 0.7850,0.6370, -0.7862,0.6359, 0.7875,0.6349, 0.7887,0.6339, 0.7900,0.6330, 0.7912,0.6320, -0.7924,0.6310, 0.7937,0.6300, 0.7949,0.6290, 0.7961,0.6281, 0.7973,0.6271, -0.7986,0.6261, 0.7998,0.6252, 0.8010,0.6242, 0.8022,0.6233, 0.8034,0.6223, -0.8046,0.6214, 0.8059,0.6205, 0.8071,0.6195, 0.8083,0.6186, 0.8095,0.6177, -0.8107,0.6168, 0.8119,0.6158, 0.8131,0.6149, 0.8143,0.6140, 0.8155,0.6131, -0.8167,0.6122, 0.8179,0.6113, 0.8191,0.6104, 0.8203,0.6096, 0.8215,0.6087, -0.8227,0.6078, 0.8238,0.6069, 0.8250,0.6060, 0.8262,0.6052, 0.8274,0.6043, -0.8286,0.6035, 0.8297,0.6026, 0.8309,0.6017, 0.8321,0.6009, 0.8333,0.6000, -0.8344,0.5992, 0.8356,0.5984, 0.8368,0.5975, 0.8379,0.5967, 0.8391,0.5959, -0.8403,0.5950, 0.8414,0.5942, 0.8426,0.5934, 0.8437,0.5926, 0.8449,0.5918, -0.8461,0.5910, 0.8472,0.5902, 0.8484,0.5894, 0.8495,0.5886, 0.8507,0.5878, -0.8518,0.5870, 0.8530,0.5862, 0.8541,0.5854, 0.8552,0.5846, 0.8564,0.5838, -0.8575,0.5831, 0.8587,0.5823, 0.8598,0.5815, 0.8609,0.5808, 0.8621,0.5800, -0.8632,0.5792, 0.8643,0.5785, 0.8655,0.5777, 0.8666,0.5770, 0.8677,0.5762, -0.8688,0.5755, 0.8700,0.5747, 0.8711,0.5740, 0.8722,0.5733, 0.8733,0.5725, -0.8744,0.5718, 0.8756,0.5711, 0.8767,0.5703, 0.8778,0.5696, 0.8789,0.5689, -0.8800,0.5682, 0.8811,0.5675, 0.8822,0.5667, 0.8833,0.5660, 0.8844,0.5653, -0.8855,0.5646, 0.8866,0.5639, 0.8877,0.5632, 0.8888,0.5625, 0.8899,0.5618, -0.8910,0.5611, 0.8921,0.5605, 0.8932,0.5598, 0.8943,0.5591, 0.8954,0.5584, -0.8965,0.5577, 0.8976,0.5570, 0.8987,0.5564, 0.8998,0.5557, 0.9008,0.5550, -0.9019,0.5544, 0.9030,0.5537, 0.9041,0.5530, 0.9052,0.5524, 0.9062,0.5517, -0.9073,0.5511, 0.9084,0.5504, 0.9095,0.5498, 0.9105,0.5491, 0.9116,0.5485, -0.9127,0.5478, 0.9138,0.5472, 0.9148,0.5465, 0.9159,0.5459, 0.9170,0.5453, -0.9180,0.5446, 0.9191,0.5440, 0.9202,0.5434, 0.9212,0.5428, 0.9223,0.5421, -0.9233,0.5415, 0.9244,0.5409, 0.9254,0.5403, 0.9265,0.5397, 0.9276,0.5391, -0.9286,0.5384, 0.9297,0.5378, 0.9307,0.5372, 0.9318,0.5366, 0.9328,0.5360, -0.9338,0.5354, 0.9349,0.5348, 0.9359,0.5342, 0.9370,0.5336, 0.9380,0.5330, -0.9391,0.5324, 0.9401,0.5319, 0.9411,0.5313, 0.9422,0.5307, 0.9432,0.5301, -0.9442,0.5295, 0.9453,0.5289, 0.9463,0.5284, 0.9473,0.5278, 0.9484,0.5272, -0.9494,0.5266, 0.9504,0.5261, 0.9515,0.5255, 0.9525,0.5249, 0.9535,0.5244, -0.9545,0.5238, 0.9556,0.5233, 0.9566,0.5227, 0.9576,0.5221, 0.9586,0.5216, -0.9596,0.5210, 0.9607,0.5205, 0.9617,0.5199, 0.9627,0.5194, 0.9637,0.5188, -0.9647,0.5183, 0.9657,0.5177, 0.9667,0.5172, 0.9677,0.5167, 0.9687,0.5161, -0.9698,0.5156, 0.9708,0.5151, 0.9718,0.5145, 0.9728,0.5140, 0.9738,0.5135, -0.9748,0.5129, 0.9758,0.5124, 0.9768,0.5119, 0.9778,0.5114, 0.9788,0.5108, -0.9798,0.5103, 0.9808,0.5098, 0.9818,0.5093, 0.9828,0.5088, 0.9838,0.5083, -0.9847,0.5077, 0.9857,0.5072, 0.9867,0.5067, 0.9877,0.5062, 0.9887,0.5057, -0.9897,0.5052, 0.9907,0.5047, 0.9917,0.5042, 0.9926,0.5037, 0.9936,0.5032, -0.9946,0.5027, 0.9956,0.5022, 0.9966,0.5017, 0.9976,0.5012, 0.9985,0.5007, -0.9995,0.5002, -1.0010,0.4995, 1.0029,0.4985, 1.0049,0.4976, 1.0068,0.4966, 1.0088,0.4957, -1.0107,0.4947, 1.0126,0.4938, 1.0145,0.4928, 1.0165,0.4919, 1.0184,0.4910, -1.0203,0.4901, 1.0222,0.4891, 1.0241,0.4882, 1.0260,0.4873, 1.0279,0.4864, -1.0298,0.4855, 1.0317,0.4846, 1.0336,0.4837, 1.0355,0.4829, 1.0374,0.4820, -1.0393,0.4811, 1.0411,0.4802, 1.0430,0.4794, 1.0449,0.4785, 1.0468,0.4777, -1.0486,0.4768, 1.0505,0.4760, 1.0523,0.4751, 1.0542,0.4743, 1.0560,0.4735, -1.0579,0.4726, 1.0597,0.4718, 1.0616,0.4710, 1.0634,0.4702, 1.0653,0.4694, -1.0671,0.4686, 1.0689,0.4678, 1.0707,0.4670, 1.0726,0.4662, 1.0744,0.4654, -1.0762,0.4646, 1.0780,0.4638, 1.0798,0.4630, 1.0816,0.4623, 1.0834,0.4615, -1.0852,0.4607, 1.0870,0.4600, 1.0888,0.4592, 1.0906,0.4585, 1.0924,0.4577, -1.0942,0.4570, 1.0960,0.4562, 1.0978,0.4555, 1.0995,0.4547, 1.1013,0.4540, -1.1031,0.4533, 1.1049,0.4525, 1.1066,0.4518, 1.1084,0.4511, 1.1101,0.4504, -1.1119,0.4497, 1.1137,0.4490, 1.1154,0.4483, 1.1172,0.4476, 1.1189,0.4469, -1.1207,0.4462, 1.1224,0.4455, 1.1241,0.4448, 1.1259,0.4441, 1.1276,0.4434, -1.1293,0.4427, 1.1311,0.4421, 1.1328,0.4414, 1.1345,0.4407, 1.1362,0.4401, -1.1379,0.4394, 1.1397,0.4387, 1.1414,0.4381, 1.1431,0.4374, 1.1448,0.4368, -1.1465,0.4361, 1.1482,0.4355, 1.1499,0.4348, 1.1516,0.4342, 1.1533,0.4335, -1.1550,0.4329, 1.1567,0.4323, 1.1584,0.4316, 1.1600,0.4310, 1.1617,0.4304, -1.1634,0.4298, 1.1651,0.4292, 1.1668,0.4285, 1.1684,0.4279, 1.1701,0.4273, -1.1718,0.4267, 1.1734,0.4261, 1.1751,0.4255, 1.1768,0.4249, 1.1784,0.4243, -1.1801,0.4237, 1.1817,0.4231, 1.1834,0.4225, 1.1850,0.4219, 1.1867,0.4213, -1.1883,0.4208, 1.1900,0.4202, 1.1916,0.4196, 1.1932,0.4190, 1.1949,0.4185, -1.1965,0.4179, 1.1981,0.4173, 1.1998,0.4167, 1.2014,0.4162, 1.2030,0.4156, -1.2046,0.4151, 1.2063,0.4145, 1.2079,0.4139, 1.2095,0.4134, 1.2111,0.4128, -1.2127,0.4123, 1.2143,0.4117, 1.2159,0.4112, 1.2175,0.4107, 1.2192,0.4101, -1.2208,0.4096, 1.2224,0.4090, 1.2239,0.4085, 1.2255,0.4080, 1.2271,0.4075, -1.2287,0.4069, 1.2303,0.4064, 1.2319,0.4059, 1.2335,0.4054, 1.2351,0.4048, -1.2366,0.4043, 1.2382,0.4038, 1.2398,0.4033, 1.2414,0.4028, 1.2429,0.4023, -1.2445,0.4018, 1.2461,0.4013, 1.2477,0.4008, 1.2492,0.4003, 1.2508,0.3998, -1.2523,0.3993, 1.2539,0.3988, 1.2555,0.3983, 1.2570,0.3978, 1.2586,0.3973, -1.2601,0.3968, 1.2617,0.3963, 1.2632,0.3958, 1.2648,0.3953, 1.2663,0.3949, -1.2678,0.3944, 1.2694,0.3939, 1.2709,0.3934, 1.2725,0.3929, 1.2740,0.3925, -1.2755,0.3920, 1.2771,0.3915, 1.2786,0.3911, 1.2801,0.3906, 1.2816,0.3901, -1.2832,0.3897, 1.2847,0.3892, 1.2862,0.3887, 1.2877,0.3883, 1.2892,0.3878, -1.2907,0.3874, 1.2923,0.3869, 1.2938,0.3865, 1.2953,0.3860, 1.2968,0.3856, -1.2983,0.3851, 1.2998,0.3847, 1.3013,0.3842, 1.3028,0.3838, 1.3043,0.3834, -1.3058,0.3829, 1.3073,0.3825, 1.3088,0.3820, 1.3103,0.3816, 1.3118,0.3812, -1.3132,0.3807, 1.3147,0.3803, 1.3162,0.3799, 1.3177,0.3794, 1.3192,0.3790, -1.3207,0.3786, 1.3221,0.3782, 1.3236,0.3778, 1.3251,0.3773, 1.3266,0.3769, -1.3280,0.3765, 1.3295,0.3761, 1.3310,0.3757, 1.3324,0.3753, 1.3339,0.3748, -1.3354,0.3744, 1.3368,0.3740, 1.3383,0.3736, 1.3397,0.3732, 1.3412,0.3728, -1.3427,0.3724, 1.3441,0.3720, 1.3456,0.3716, 1.3470,0.3712, 1.3485,0.3708, -1.3499,0.3704, 1.3514,0.3700, 1.3528,0.3696, 1.3542,0.3692, 1.3557,0.3688, -1.3571,0.3684, 1.3586,0.3680, 1.3600,0.3676, 1.3614,0.3673, 1.3629,0.3669, -1.3643,0.3665, 1.3657,0.3661, 1.3672,0.3657, 1.3686,0.3653, 1.3700,0.3650, -1.3714,0.3646, 1.3729,0.3642, 1.3743,0.3638, 1.3757,0.3634, 1.3771,0.3631, -1.3785,0.3627, 1.3800,0.3623, 1.3814,0.3620, 1.3828,0.3616, 1.3842,0.3612, -1.3856,0.3609, 1.3870,0.3605, 1.3884,0.3601, 1.3898,0.3598, 1.3912,0.3594, -1.3926,0.3590, 1.3940,0.3587, 1.3954,0.3583, 1.3968,0.3580, 1.3982,0.3576, -1.3996,0.3572, 1.4010,0.3569, 1.4024,0.3565, 1.4038,0.3562, 1.4052,0.3558, -1.4066,0.3555, 1.4080,0.3551, 1.4094,0.3548, 1.4108,0.3544, 1.4121,0.3541, -1.4135,0.3537 -}; - - -/* Generated by: */ -#if 0 -#include -#include -#include - -int -main(int argc, char **argv) -{ - int i, j; - - printf ("const float __t_sqrt[1024] = {"); - for (i = 0; i < 2; i++) - { - putchar('\n'); - for (j = 0; j < 256; j++) - { - double mval = j/512.0 + 0.5; - double eval = i==0 ? 1.0 : 2.0; - double ls = sqrt(mval*eval); - double hs = sqrt((mval+1/512.0)*eval); - double as = (ls+hs)*0.5; - double lx = 1/(2.0*ls); - double hx = 1/(2.0*hs); - double ax = (lx+hx)*0.5; - - printf("%.4f,%.4f%s",as,ax, - i*j==255 ? "\n" : j % 5 == 4 ? ",\n" : ", "); - assert((hs-ls)/as < 1/256.0); - assert((hx-lx)/ax < 1/256.0); - } - } - printf ("};\n"); - return 0; -} -#endif /* 0 */ diff --git a/sysdeps/powerpc/w_sqrt.c b/sysdeps/powerpc/w_sqrt.c deleted file mode 100644 index c42ace5..0000000 --- a/sysdeps/powerpc/w_sqrt.c +++ /dev/null @@ -1,141 +0,0 @@ -/* Single-precision floating point square root. - Copyright (C) 1997 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include -#include - -static const double almost_half = 0.5000000000000001; /* 0.5 + 2^-53 */ -static const uint32_t a_nan = 0x7fc00000; -static const uint32_t a_inf = 0x7f800000; -static const float two108 = 3.245185536584267269e+32; -static const float twom54 = 5.551115123125782702e-17; -extern const float __t_sqrt[1024]; - -/* The method is based on a description in - Computation of elementary functions on the IBM RISC System/6000 processor, - P. W. Markstein, IBM J. Res. Develop, 34(1) 1990. - Basically, it consists of two interleaved Newton-Rhapson approximations, - one to find the actual square root, and one to find its reciprocal - without the expense of a division operation. The tricky bit here - is the use of the POWER/PowerPC multiply-add operation to get the - required accuracy with high speed. - - The argument reduction works by a combination of table lookup to - obtain the initial guesses, and some careful modification of the - generated guesses (which mostly runs on the integer unit, while the - Newton-Rhapson is running on the FPU). */ -double -__sqrt(double x) -{ - const float inf = *(const float *)&a_inf; - /* x = f_wash(x); *//* This ensures only one exception for SNaN. */ - if (x > 0) - { - if (x != inf) - { - /* Variables named starting with 's' exist in the - argument-reduced space, so that 2 > sx >= 0.5, - 1.41... > sg >= 0.70.., 0.70.. >= sy > 0.35... . - Variables named ending with 'i' are integer versions of - floating-point values. */ - double sx; /* The value of which we're trying to find the - square root. */ - double sg,g; /* Guess of the square root of x. */ - double sd,d; /* Difference between the square of the guess and x. */ - double sy; /* Estimate of 1/2g (overestimated by 1ulp). */ - double sy2; /* 2*sy */ - double e; /* Difference between y*g and 1/2 (se = e * fsy). */ - double shx; /* == sx * fsg */ - double fsg; /* sg*fsg == g. */ - fenv_t fe; /* Saved floating-point environment (stores rounding - mode and whether the inexact exception is - enabled). */ - uint32_t xi0, xi1, sxi, fsgi; - const float *t_sqrt; - - fe = fegetenv_register(); - EXTRACT_WORDS (xi0,xi1,x); - relax_fenv_state(); - sxi = (xi0 & 0x3fffffff) | 0x3fe00000; - INSERT_WORDS (sx, sxi, xi1); - t_sqrt = __t_sqrt + (xi0 >> (52-32-8-1) & 0x3fe); - sg = t_sqrt[0]; - sy = t_sqrt[1]; - - /* Here we have three Newton-Rhapson iterations each of a - division and a square root and the remainder of the - argument reduction, all interleaved. */ - sd = -(sg*sg - sx); - fsgi = (xi0 + 0x40000000) >> 1 & 0x7ff00000; - sy2 = sy + sy; - sg = sy*sd + sg; /* 16-bit approximation to sqrt(sx). */ - INSERT_WORDS (fsg, fsgi, 0); - e = -(sy*sg - almost_half); - sd = -(sg*sg - sx); - if ((xi0 & 0x7ff00000) == 0) - goto denorm; - sy = sy + e*sy2; - sg = sg + sy*sd; /* 32-bit approximation to sqrt(sx). */ - sy2 = sy + sy; - e = -(sy*sg - almost_half); - sd = -(sg*sg - sx); - sy = sy + e*sy2; - shx = sx * fsg; - sg = sg + sy*sd; /* 64-bit approximation to sqrt(sx), - but perhaps rounded incorrectly. */ - sy2 = sy + sy; - g = sg * fsg; - e = -(sy*sg - almost_half); - d = -(g*sg - shx); - sy = sy + e*sy2; - fesetenv_register (fe); - return g + sy*d; - denorm: - /* For denormalised numbers, we normalise, calculate the - square root, and return an adjusted result. */ - fesetenv_register (fe); - return __sqrt(x * two108) * twom54; - } - } - else if (x < 0) - { -#ifdef FE_INVALID_SQRT - feraiseexcept (FE_INVALID_SQRT); - /* For some reason, some PowerPC processors don't implement - FE_INVALID_SQRT. I guess no-one ever thought they'd be - used for square roots... :-) */ - if (!fetestexcept (FE_INVALID)) -#endif - feraiseexcept (FE_INVALID); -#ifndef _IEEE_LIBM - if (_LIB_VERSION != _IEEE_) - x = __kernel_standard(x,x,26); - else -#endif - x = *(const float*)&a_nan; - } - return f_wash(x); -} - -weak_alias (__sqrt, sqrt) -/* Strictly, this is wrong, but the only places where _ieee754_sqrt is - used will not pass in a negative result. */ -strong_alias(__sqrt,__ieee754_sqrt) diff --git a/sysdeps/powerpc/w_sqrtf.c b/sysdeps/powerpc/w_sqrtf.c deleted file mode 100644 index d40ade1..0000000 --- a/sysdeps/powerpc/w_sqrtf.c +++ /dev/null @@ -1,136 +0,0 @@ -/* Single-precision floating point square root. - Copyright (C) 1997 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include -#include - -static const float almost_half = 0.50000006; /* 0.5 + 2^-24 */ -static const uint32_t a_nan = 0x7fc00000; -static const uint32_t a_inf = 0x7f800000; -static const float two48 = 281474976710656.0; -static const float twom24 = 5.9604644775390625e-8; -extern const float __t_sqrt[1024]; - -/* The method is based on a description in - Computation of elementary functions on the IBM RISC System/6000 processor, - P. W. Markstein, IBM J. Res. Develop, 34(1) 1990. - Basically, it consists of two interleaved Newton-Rhapson approximations, - one to find the actual square root, and one to find its reciprocal - without the expense of a division operation. The tricky bit here - is the use of the POWER/PowerPC multiply-add operation to get the - required accuracy with high speed. - - The argument reduction works by a combination of table lookup to - obtain the initial guesses, and some careful modification of the - generated guesses (which mostly runs on the integer unit, while the - Newton-Rhapson is running on the FPU). */ -float -__sqrtf(float x) -{ - const float inf = *(const float *)&a_inf; - /* x = f_washf(x); *//* This ensures only one exception for SNaN. */ - if (x > 0) - { - if (x != inf) - { - /* Variables named starting with 's' exist in the - argument-reduced space, so that 2 > sx >= 0.5, - 1.41... > sg >= 0.70.., 0.70.. >= sy > 0.35... . - Variables named ending with 'i' are integer versions of - floating-point values. */ - float sx; /* The value of which we're trying to find the square - root. */ - float sg,g; /* Guess of the square root of x. */ - float sd,d; /* Difference between the square of the guess and x. */ - float sy; /* Estimate of 1/2g (overestimated by 1ulp). */ - float sy2; /* 2*sy */ - float e; /* Difference between y*g and 1/2 (note that e==se). */ - float shx; /* == sx * fsg */ - float fsg; /* sg*fsg == g. */ - fenv_t fe; /* Saved floating-point environment (stores rounding - mode and whether the inexact exception is - enabled). */ - uint32_t xi, sxi, fsgi; - const float *t_sqrt; - - GET_FLOAT_WORD (xi, x); - fe = fegetenv_register (); - relax_fenv_state (); - sxi = (xi & 0x3fffffff) | 0x3f000000; - SET_FLOAT_WORD (sx, sxi); - t_sqrt = __t_sqrt + (xi >> (23-8-1) & 0x3fe); - sg = t_sqrt[0]; - sy = t_sqrt[1]; - - /* Here we have three Newton-Rhapson iterations each of a - division and a square root and the remainder of the - argument reduction, all interleaved. */ - sd = -(sg*sg - sx); - fsgi = (xi + 0x40000000) >> 1 & 0x7f800000; - sy2 = sy + sy; - sg = sy*sd + sg; /* 16-bit approximation to sqrt(sx). */ - e = -(sy*sg - almost_half); - SET_FLOAT_WORD (fsg, fsgi); - sd = -(sg*sg - sx); - sy = sy + e*sy2; - if ((xi & 0x7f800000) == 0) - goto denorm; - shx = sx * fsg; - sg = sg + sy*sd; /* 32-bit approximation to sqrt(sx), - but perhaps rounded incorrectly. */ - sy2 = sy + sy; - g = sg * fsg; - e = -(sy*sg - almost_half); - d = -(g*sg - shx); - sy = sy + e*sy2; - fesetenv_register (fe); - return g + sy*d; - denorm: - /* For denormalised numbers, we normalise, calculate the - square root, and return an adjusted result. */ - fesetenv_register (fe); - return __sqrtf(x * two48) * twom24; - } - } - else if (x < 0) - { -#ifdef FE_INVALID_SQRT - feraiseexcept (FE_INVALID_SQRT); - /* For some reason, some PowerPC processors don't implement - FE_INVALID_SQRT. I guess no-one ever thought they'd be - used for square roots... :-) */ - if (!fetestexcept (FE_INVALID)) -#endif - feraiseexcept (FE_INVALID); -#ifndef _IEEE_LIBM - if (_LIB_VERSION != _IEEE_) - x = __kernel_standard(x,x,126); - else -#endif - x = *(const float*)&a_nan; - } - return f_washf(x); -} - -weak_alias (__sqrtf, sqrtf) -/* Strictly, this is wrong, but the only places where _ieee754_sqrt is - used will not pass in a negative result. */ -strong_alias(__sqrtf,__ieee754_sqrtf) -- cgit v1.1