diff -u eglibc-2.15/debian/changelog eglibc-2.15/debian/changelog --- eglibc-2.15/debian/changelog +++ eglibc-2.15/debian/changelog @@ -1,3 +1,11 @@ +eglibc (2.15-0ubuntu11.1) precise-proposed; urgency=low + + [ Adam Conrad ] + * Backport FMA4/AVX detection from glibc 2.16 (LP: #956051, #979003) + * Backport fixups to AVX-using code to match the detection backport. + + -- Adam Stokes Wed, 22 Aug 2012 22:28:54 -0400 + eglibc (2.15-0ubuntu11) UNRELEASED; urgency=low * Per Adam's suggestion, comment the NSS_CHECK substitution so it's diff -u eglibc-2.15/debian/patches/series eglibc-2.15/debian/patches/series --- eglibc-2.15/debian/patches/series +++ eglibc-2.15/debian/patches/series @@ -43,7 +43,8 @@ amd64/local-linuxthreads-gscope.diff amd64/submitted-tst-audit6-avx.diff amd64/submitted-rwlock-stack-imbalance.diff -amd64/cvs-avx-osxsave.diff +amd64/cvs-avx-fma4.diff +amd64/cvs-avx-fma4-fixups.diff arm/local-atomic.diff arm/local-eabi-wchar.diff reverted: --- eglibc-2.15/debian/patches/amd64/cvs-avx-osxsave.diff +++ eglibc-2.15.orig/debian/patches/amd64/cvs-avx-osxsave.diff @@ -1,43 +0,0 @@ -2012-01-26 Ulrich Drepper - - [BZ #13583] - * sysdeps/x86_64/multiarch/init-arch.h: Define bit_OSXSAVE. - * sysdeps/x86_64/multiarch/init-arch.c (__init_cpu_features): If - bit_AVX is set also check OSXAVE/XCR0 and reset bit_AVX if necessary. - -diff --git a/sysdeps/x86_64/multiarch/init-arch.c b/sysdeps/x86_64/multiarch/init-arch.c -index 65b0ee9..4fabbee 100644 ---- a/sysdeps/x86_64/multiarch/init-arch.c -+++ b/sysdeps/x86_64/multiarch/init-arch.c -@@ -144,6 +144,18 @@ __init_cpu_features (void) - else - kind = arch_kind_other; - -+ if (__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx & bit_AVX) -+ { -+ /* Reset the AVX bit in case OSXSAVE is disabled. */ -+ if ((__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx & bit_OSXSAVE) == 0 -+ || ({ unsigned int xcrlow; -+ unsigned int xcrhigh; -+ asm ("xgetbv" -+ : "=a" (xcrlow), "=d" (xcrhigh) : "c" (0)); -+ (xcrlow & 6) != 6; })) -+ __cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx &= ~bit_AVX; -+ } -+ - __cpu_features.family = family; - __cpu_features.model = model; - atomic_write_barrier (); -diff --git a/sysdeps/x86_64/multiarch/init-arch.h b/sysdeps/x86_64/multiarch/init-arch.h -index 2a1df39..408e5ae 100644 ---- a/sysdeps/x86_64/multiarch/init-arch.h -+++ b/sysdeps/x86_64/multiarch/init-arch.h -@@ -27,6 +27,7 @@ - #define bit_SSSE3 (1 << 9) - #define bit_SSE4_1 (1 << 19) - #define bit_SSE4_2 (1 << 20) -+#define bit_OSXSAVE (1 << 27) - #define bit_AVX (1 << 28) - #define bit_POPCOUNT (1 << 23) - #define bit_FMA (1 << 12) - only in patch2: unchanged: --- eglibc-2.15.orig/debian/patches/amd64/cvs-avx-fma4-fixups.diff +++ eglibc-2.15/debian/patches/amd64/cvs-avx-fma4-fixups.diff @@ -0,0 +1,1406 @@ +2012-03-21 Andreas Schwab + + * configure.in (libc_cv_cc_nofma): Check for option to disable + generation of FMA instructions. + * configure: Regenerate. + * config.make.in (config-cflags-nofma): Set from libc_cv_cc_nofma. + * sysdeps/ieee754/dbl-64/Makefile: New file. + * sysdeps/x86_64/fpu/multiarch/Makefile (libm-sysdep_routines): + Remove brandred-fma4. + (CFLAGS-brandred-fma4.c): Remove. + * sysdeps/x86_64/fpu/multiarch/brandred-fma4.c: Remove. + * sysdeps/x86_64/fpu/multiarch/s_sin-fma4.c (__branred): Don't + define. + * sysdeps/x86_64/fpu/multiarch/s_tan-fma4.c (__branred): Don't + define. + +2012-01-30 Joseph Myers + + * configure.in (libc_cv_cc_sse2avx): AC_SUBST. + * configure: Regenerate. + * config.make.in (config-cflags-sse2avx): Define. + * sysdeps/x86_64/fpu/multiarch/Makefile (CFLAGS-slowexp-avx.c): + Fix typo. + +2012-01-28 Ulrich Drepper + + * config.h.in: Define HAVE_SSE2AVX_SUPPORT. + * math/math_private.h: Remove libc_fegetround* and + libc_fesetround*. + * sysdeps/i386/configure.in: Check for -msse2avx. + * sysdeps/x86_64/fpu/math_private.h: Use VEX-encoded instructions + also if SSE2AVX is defined. + Remove libc_fegetround* and libc_fesetround*. + * sysdeps/x86_64/fpu/multiarch/Makefile: Compile *-avx functions + if config-cflags-sse2avx is yes. Also add -DSSE2AVX to defines. + * sysdeps/x86_64/fpu/multiarch/e_atan2.c: Use HAS_AVX again instead + of HAS_YMM_USABLE. + * sysdeps/x86_64/fpu/multiarch/e_exp.c: Likewise. + * sysdeps/x86_64/fpu/multiarch/e_log.c: Likewise. + * sysdeps/x86_64/fpu/multiarch/s_atan.c: Likewise. + * sysdeps/x86_64/fpu/multiarch/s_sin.c: Likewise. + * sysdeps/x86_64/fpu/multiarch/s_tan.c: Likewise. + + * sysdeps/x86_64/fpu/math_private.h: Simplify use of AVX instructions. + +diff --git a/config.h.in b/config.h.in +index 7db6630..dc5a320 100644 +--- a/config.h.in ++++ b/config.h.in +@@ -102,7 +102,7 @@ + certain registers (CR0, MQ, CTR, LR) in asm statements. */ + #undef BROKEN_PPC_ASM_CR0 + +-/* Defined on SPARC if ld doesn't handle R_SPARC_WDISP22 against .hidden ++/* Defined on SPARC if ld does not handle R_SPARC_WDISP22 against .hidden + symbol. sysdeps/sparc/sparc32/elf/configure. */ + #undef BROKEN_SPARC_WDISP22 + +@@ -118,17 +118,20 @@ + /* Define if gcc supports AVX. */ + #undef HAVE_AVX_SUPPORT + ++/* Define if gcc supports VEX encoding. */ ++#undef HAVE_SSE2AVX_SUPPORT ++ + /* Define if gcc supports FMA4. */ + #undef HAVE_FMA4_SUPPORT + +-/* Define if the compiler's exception support is based on libunwind. */ ++/* Define if the compiler\'s exception support is based on libunwind. */ + #undef HAVE_CC_WITH_LIBUNWIND + + /* Define if the access to static and hidden variables is position independent + and does not need relocations. */ + #undef PI_STATIC_AND_HIDDEN + +-/* Define this to disable the `hidden_proto' et al macros in ++/* Define this to disable the 'hidden_proto' et al macros in + include/libc-symbols.h that avoid PLT slots in the shared objects. */ + #undef NO_HIDDEN + +diff --git a/config.make.in b/config.make.in +index d2baf6d..402f766 100644 +--- a/config.make.in ++++ b/config.make.in +@@ -36,7 +36,9 @@ asflags-cpu = @libc_cv_cc_submachine@ + + config-cflags-sse4 = @libc_cv_cc_sse4@ + config-cflags-avx = @libc_cv_cc_avx@ ++config-cflags-sse2avx = @libc_cv_cc_sse2avx@ + config-cflags-novzeroupper = @libc_cv_cc_novzeroupper@ ++config-cflags-nofma = @libc_cv_cc_nofma@ + config-asflags-i686 = @libc_cv_as_i686@ + + defines = @DEFINES@ +diff --git a/configure b/configure +index c22ed38..75454f6 100755 +--- a/configure ++++ b/configure +@@ -622,8 +622,10 @@ elf + ldd_rewrite_script + use_ldconfig + libc_cv_as_i686 ++libc_cv_cc_nofma + libc_cv_cc_fma4 + libc_cv_cc_novzeroupper ++libc_cv_cc_sse2avx + libc_cv_cc_avx + libc_cv_cc_sse4 + libc_cv_cpp_asm_debuginfo +@@ -7328,6 +7330,26 @@ if test "$libc_cv_gcc_tls_model_attr" = no; then + as_fn_error $? "support for the tls_model attribute is required" "$LINENO" 5 + fi + ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler option to disable generation of FMA instructions" >&5 ++$as_echo_n "checking for compiler option to disable generation of FMA instructions... " >&6; } ++if ${libc_cv_cc_nofma+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ libc_cv_cc_nofma= ++for opt in -ffp-contract=off -mno-fused-madd; do ++ if { ac_try='${CC-cc} $opt -xc /dev/null -S -o /dev/null' ++ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; }; then : ++ libc_cv_cc_nofma=$opt; break ++fi ++done ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_nofma" >&5 ++$as_echo "$libc_cv_cc_nofma" >&6; } ++ + if test -n "$submachine"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler option for CPU variant" >&5 + $as_echo_n "checking for compiler option for CPU variant... " >&6; } +diff --git a/configure.in b/configure.in +index 2c4fc97..80d45f0 100644 +--- a/configure.in ++++ b/configure.in +@@ -2196,6 +2196,14 @@ if test "$libc_cv_gcc_tls_model_attr" = no; then + AC_MSG_ERROR([support for the tls_model attribute is required]) + fi + ++dnl Determine how to disable generation of FMA instructions. ++AC_CACHE_CHECK([for compiler option to disable generation of FMA instructions], ++ libc_cv_cc_nofma, [dnl ++libc_cv_cc_nofma= ++for opt in -ffp-contract=off -mno-fused-madd; do ++ LIBC_TRY_CC_OPTION([$opt], [libc_cv_cc_nofma=$opt; break]) ++done]) ++ + if test -n "$submachine"; then + AC_CACHE_CHECK([for compiler option for CPU variant], + libc_cv_cc_submachine, [dnl +@@ -2337,8 +2345,10 @@ dnl sysdeps/CPU/configure.in checks set this via arch-specific asm tests + AC_SUBST(libc_cv_cpp_asm_debuginfo) + AC_SUBST(libc_cv_cc_sse4) + AC_SUBST(libc_cv_cc_avx) ++AC_SUBST(libc_cv_cc_sse2avx) + AC_SUBST(libc_cv_cc_novzeroupper) + AC_SUBST(libc_cv_cc_fma4) ++AC_SUBST(libc_cv_cc_nofma) + AC_SUBST(libc_cv_as_i686) + + AC_SUBST(use_ldconfig) +diff --git a/math/math_private.h b/math/math_private.h +index 04c112f..82c6f80 100644 +--- a/math/math_private.h ++++ b/math/math_private.h +@@ -365,14 +365,6 @@ extern void __docos (double __x, double __dx, double __v[]); + know what operations are going to be performed. Therefore we + define additional interfaces. By default they refer to the normal + interfaces. */ +-#define libc_fegetround() fegetround () +-#define libc_fegetroundf() fegetround () +-#define libc_fegetroundl() fegetround () +- +-#define libc_fesetround(r) (void) fesetround (r) +-#define libc_fesetroundf(r) (void) fesetround (r) +-#define libc_fesetroundl(r) (void) fesetround (r) +- + #define libc_feholdexcept(e) (void) feholdexcept (e) + #define libc_feholdexceptf(e) (void) feholdexcept (e) + #define libc_feholdexceptl(e) (void) feholdexcept (e) +diff --git a/sysdeps/i386/configure b/sysdeps/i386/configure +index ae494e2..bc7900e 100644 +--- a/sysdeps/i386/configure ++++ b/sysdeps/i386/configure +@@ -756,6 +756,29 @@ if test $libc_cv_cc_avx = yes; then + + fi + ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for AVX encoding of SSE instructions" >&5 ++$as_echo_n "checking for AVX encoding of SSE instructions... " >&6; } ++if ${libc_cv_cc_sse2avx+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ if { ac_try='${CC-cc} -msse2avx -xc /dev/null -S -o /dev/null' ++ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; }; then ++ libc_cv_cc_sse2avx=yes ++else ++ libc_cv_cc_sse2avx=no ++fi ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_sse2avx" >&5 ++$as_echo "$libc_cv_cc_sse2avx" >&6; } ++if test $libc_cv_cc_sse2avx = yes; then ++ $as_echo "#define HAVE_SSE2AVX_SUPPORT 1" >>confdefs.h ++ ++fi ++ + { $as_echo "$as_me:$LINENO: checking for FMA4 support" >&5 + $as_echo_n "checking for FMA4 support... " >&6; } + if test "${libc_cv_cc_fma4+set}" = set; then +diff --git a/sysdeps/i386/configure.in b/sysdeps/i386/configure.in +index 5a9840e..59a4cd6 100644 +--- a/sysdeps/i386/configure.in ++++ b/sysdeps/i386/configure.in +@@ -67,6 +67,17 @@ if test $libc_cv_cc_avx = yes; then + AC_DEFINE(HAVE_AVX_SUPPORT) + fi + ++dnl Check if -msse2avx works. ++AC_CACHE_CHECK(for AVX encoding of SSE instructions, libc_cv_cc_sse2avx, [dnl ++if AC_TRY_COMMAND([${CC-cc} -msse2avx -xc /dev/null -S -o /dev/null]); then ++ libc_cv_cc_sse2avx=yes ++else ++ libc_cv_cc_sse2avx=no ++fi]) ++if test $libc_cv_cc_sse2avx = yes; then ++ AC_DEFINE(HAVE_SSE2AVX_SUPPORT) ++fi ++ + dnl Check if -mfma4 works. + AC_CACHE_CHECK(for FMA4 support, libc_cv_cc_fma4, [dnl + if AC_TRY_COMMAND([${CC-cc} -mfma4 -xc /dev/null -S -o /dev/null]); then +diff --git a/sysdeps/ieee754/dbl-64/Makefile b/sysdeps/ieee754/dbl-64/Makefile +new file mode 100644 +index 0000000..1a7b311 +--- /dev/null ++++ b/sysdeps/ieee754/dbl-64/Makefile +@@ -0,0 +1,4 @@ ++ifeq ($(subdir),math) ++# branred depends on precise IEEE double rounding ++CFLAGS-branred.c = $(config-cflags-nofma) ++endif +diff --git a/sysdeps/ieee754/ldbl-opt/configure b/sysdeps/ieee754/ldbl-opt/configure +index 065a3c8..d1f3177 100644 +--- a/sysdeps/ieee754/ldbl-opt/configure ++++ b/sysdeps/ieee754/ldbl-opt/configure +@@ -1,19 +1,135 @@ ++ ++# as_fn_set_status STATUS ++# ----------------------- ++# Set $? to STATUS, without forking. ++as_fn_set_status () ++{ ++ return $1 ++} # as_fn_set_status ++ ++# as_fn_exit STATUS ++# ----------------- ++# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. ++as_fn_exit () ++{ ++ set +e ++ as_fn_set_status $1 ++ exit $1 ++} # as_fn_exit ++if expr a : '\(a\)' >/dev/null 2>&1 && ++ test "X`expr 00001 : '.*\(...\)'`" = X001; then ++ as_expr=expr ++else ++ as_expr=false ++fi ++ ++if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then ++ as_basename=basename ++else ++ as_basename=false ++fi ++ ++as_me=`$as_basename -- "$0" || ++$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ ++ X"$0" : 'X\(//\)$' \| \ ++ X"$0" : 'X\(/\)' \| . 2>/dev/null || ++$as_echo X/"$0" | ++ sed '/^.*\/\([^/][^/]*\)\/*$/{ ++ s//\1/ ++ q ++ } ++ /^X\/\(\/\/\)$/{ ++ s//\1/ ++ q ++ } ++ /^X\/\(\/\).*/{ ++ s//\1/ ++ q ++ } ++ s/.*/./; q'` ++ ++ ++ as_lineno_1=$LINENO as_lineno_1a=$LINENO ++ as_lineno_2=$LINENO as_lineno_2a=$LINENO ++ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && ++ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { ++ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) ++ sed -n ' ++ p ++ /[$]LINENO/= ++ ' <$as_myself | ++ sed ' ++ s/[$]LINENO.*/&-/ ++ t lineno ++ b ++ :lineno ++ N ++ :loop ++ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ ++ t loop ++ s/-\n.*// ++ ' >$as_me.lineno && ++ chmod +x "$as_me.lineno" || ++ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } ++ ++ # Don't try to exec as it changes $[0], causing all sort of problems ++ # (the dirname of $[0] is not the place where we might find the ++ # original and so on. Autoconf is especially sensitive to this). ++ . "./$as_me.lineno" ++ # Exit status is that of the last command. ++ exit ++} ++ ++ ++# ac_fn_c_try_compile LINENO ++# -------------------------- ++# Try to compile conftest.$ac_ext, and return whether this succeeded. ++ac_fn_c_try_compile () ++{ ++ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack ++ rm -f conftest.$ac_objext ++ if { { ac_try="$ac_compile" ++case "(($ac_try" in ++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; ++ *) ac_try_echo=$ac_try;; ++esac ++eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" ++$as_echo "$ac_try_echo"; } >&5 ++ (eval "$ac_compile") 2>conftest.err ++ ac_status=$? ++ if test -s conftest.err; then ++ grep -v '^ *+' conftest.err >conftest.er1 ++ cat conftest.er1 >&5 ++ mv -f conftest.er1 conftest.err ++ fi ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; } && { ++ test -z "$ac_c_werror_flag" || ++ test ! -s conftest.err ++ } && test -s conftest.$ac_objext; then : ++ ac_retval=0 ++else ++ $as_echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ ac_retval=1 ++fi ++ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno ++ as_fn_set_status $ac_retval ++ ++} # ac_fn_c_try_compile + # This file is generated from configure.in by Autoconf. DO NOT EDIT! + # Local configure fragment for sysdeps/ieee754/ldbl-opt/. + + +-{ $as_echo "$as_me:$LINENO: checking whether $CC $CFLAGS supports -mlong-double-128" >&5 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC $CFLAGS supports -mlong-double-128" >&5 + $as_echo_n "checking whether $CC $CFLAGS supports -mlong-double-128... " >&6; } +-if test "${libc_cv_mlong_double_128+set}" = set; then ++if ${libc_cv_mlong_double_128+:} false; then : + $as_echo_n "(cached) " >&6 + else + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -mlong-double-128" +-cat >conftest.$ac_ext <<_ACEOF +-/* confdefs.h. */ +-_ACEOF +-cat confdefs.h >>conftest.$ac_ext +-cat >>conftest.$ac_ext <<_ACEOF ++cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + + int +@@ -28,39 +144,16 @@ long double foobar (long double x) { return x; } + return 0; + } + _ACEOF +-rm -f conftest.$ac_objext +-if { (ac_try="$ac_compile" +-case "(($ac_try" in +- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; +- *) ac_try_echo=$ac_try;; +-esac +-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +-$as_echo "$ac_try_echo") >&5 +- (eval "$ac_compile") 2>conftest.er1 +- ac_status=$? +- grep -v '^ *+' conftest.er1 >conftest.err +- rm -f conftest.er1 +- cat conftest.err >&5 +- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 +- (exit $ac_status); } && { +- test -z "$ac_c_werror_flag" || +- test ! -s conftest.err +- } && test -s conftest.$ac_objext; then ++if ac_fn_c_try_compile "$LINENO"; then : + libc_cv_mlong_double_128=yes + else +- $as_echo "$as_me: failed program was:" >&5 +-sed 's/^/| /' conftest.$ac_ext >&5 +- +- libc_cv_mlong_double_128=no ++ libc_cv_mlong_double_128=no + fi +- + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + fi +-{ $as_echo "$as_me:$LINENO: result: $libc_cv_mlong_double_128" >&5 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mlong_double_128" >&5 + $as_echo "$libc_cv_mlong_double_128" >&6; } + if test "$libc_cv_mlong_double_128" = no; then +- { { $as_echo "$as_me:$LINENO: error: this configuration requires -mlong-double-128 support" >&5 +-$as_echo "$as_me: error: this configuration requires -mlong-double-128 support" >&2;} +- { (exit 1); exit 1; }; } ++ as_fn_error $? "this configuration requires -mlong-double-128 support" "$LINENO" 5 + fi +diff --git a/sysdeps/powerpc/configure b/sysdeps/powerpc/configure +index b347754..c3ad67f 100644 +--- a/sysdeps/powerpc/configure ++++ b/sysdeps/powerpc/configure +@@ -1,10 +1,92 @@ ++ ++# as_fn_set_status STATUS ++# ----------------------- ++# Set $? to STATUS, without forking. ++as_fn_set_status () ++{ ++ return $1 ++} # as_fn_set_status ++ ++# as_fn_exit STATUS ++# ----------------- ++# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. ++as_fn_exit () ++{ ++ set +e ++ as_fn_set_status $1 ++ exit $1 ++} # as_fn_exit ++if expr a : '\(a\)' >/dev/null 2>&1 && ++ test "X`expr 00001 : '.*\(...\)'`" = X001; then ++ as_expr=expr ++else ++ as_expr=false ++fi ++ ++if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then ++ as_basename=basename ++else ++ as_basename=false ++fi ++ ++as_me=`$as_basename -- "$0" || ++$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ ++ X"$0" : 'X\(//\)$' \| \ ++ X"$0" : 'X\(/\)' \| . 2>/dev/null || ++$as_echo X/"$0" | ++ sed '/^.*\/\([^/][^/]*\)\/*$/{ ++ s//\1/ ++ q ++ } ++ /^X\/\(\/\/\)$/{ ++ s//\1/ ++ q ++ } ++ /^X\/\(\/\).*/{ ++ s//\1/ ++ q ++ } ++ s/.*/./; q'` ++ ++ ++ as_lineno_1=$LINENO as_lineno_1a=$LINENO ++ as_lineno_2=$LINENO as_lineno_2a=$LINENO ++ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && ++ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { ++ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) ++ sed -n ' ++ p ++ /[$]LINENO/= ++ ' <$as_myself | ++ sed ' ++ s/[$]LINENO.*/&-/ ++ t lineno ++ b ++ :lineno ++ N ++ :loop ++ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ ++ t loop ++ s/-\n.*// ++ ' >$as_me.lineno && ++ chmod +x "$as_me.lineno" || ++ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } ++ ++ # Don't try to exec as it changes $[0], causing all sort of problems ++ # (the dirname of $[0] is not the place where we might find the ++ # original and so on. Autoconf is especially sensitive to this). ++ . "./$as_me.lineno" ++ # Exit status is that of the last command. ++ exit ++} ++ + # This file is generated from configure.in by Autoconf. DO NOT EDIT! + # Local configure fragment for sysdeps/powerpc. + + # Accept binutils which knows about ".machine". +-{ $as_echo "$as_me:$LINENO: checking for .machine support" >&5 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for .machine support" >&5 + $as_echo_n "checking for .machine support... " >&6; } +-if test "${libc_cv_ppc_machine+set}" = set; then ++if ${libc_cv_ppc_machine+:} false; then : + $as_echo_n "(cached) " >&6 + else + cat > conftest.s <<\EOF +@@ -12,27 +94,22 @@ else + blr + EOF + if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5' +- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? +- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 +- (exit $ac_status); }; }; then ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; }; then + libc_cv_ppc_machine=yes + else + libc_cv_ppc_machine=no + fi + rm -f conftest* + fi +-{ $as_echo "$as_me:$LINENO: result: $libc_cv_ppc_machine" >&5 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_ppc_machine" >&5 + $as_echo "$libc_cv_ppc_machine" >&6; } + if test $libc_cv_ppc_machine != yes; then +- { { $as_echo "$as_me:$LINENO: error: +-*** A binutils version which can handle +-*** .machine \"altivec\" +-*** is needed." >&5 +-$as_echo "$as_me: error: ++ as_fn_error $? " + *** A binutils version which can handle + *** .machine \"altivec\" +-*** is needed." >&2;} +- { (exit 1); exit 1; }; } ++*** is needed." "$LINENO" 5 + fi +diff --git a/sysdeps/powerpc/powerpc32/configure b/sysdeps/powerpc/powerpc32/configure +index da8ec0b..86ecfdc 100644 +--- a/sysdeps/powerpc/powerpc32/configure ++++ b/sysdeps/powerpc/powerpc32/configure +@@ -1,10 +1,92 @@ ++ ++# as_fn_set_status STATUS ++# ----------------------- ++# Set $? to STATUS, without forking. ++as_fn_set_status () ++{ ++ return $1 ++} # as_fn_set_status ++ ++# as_fn_exit STATUS ++# ----------------- ++# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. ++as_fn_exit () ++{ ++ set +e ++ as_fn_set_status $1 ++ exit $1 ++} # as_fn_exit ++if expr a : '\(a\)' >/dev/null 2>&1 && ++ test "X`expr 00001 : '.*\(...\)'`" = X001; then ++ as_expr=expr ++else ++ as_expr=false ++fi ++ ++if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then ++ as_basename=basename ++else ++ as_basename=false ++fi ++ ++as_me=`$as_basename -- "$0" || ++$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ ++ X"$0" : 'X\(//\)$' \| \ ++ X"$0" : 'X\(/\)' \| . 2>/dev/null || ++$as_echo X/"$0" | ++ sed '/^.*\/\([^/][^/]*\)\/*$/{ ++ s//\1/ ++ q ++ } ++ /^X\/\(\/\/\)$/{ ++ s//\1/ ++ q ++ } ++ /^X\/\(\/\).*/{ ++ s//\1/ ++ q ++ } ++ s/.*/./; q'` ++ ++ ++ as_lineno_1=$LINENO as_lineno_1a=$LINENO ++ as_lineno_2=$LINENO as_lineno_2a=$LINENO ++ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && ++ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { ++ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) ++ sed -n ' ++ p ++ /[$]LINENO/= ++ ' <$as_myself | ++ sed ' ++ s/[$]LINENO.*/&-/ ++ t lineno ++ b ++ :lineno ++ N ++ :loop ++ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ ++ t loop ++ s/-\n.*// ++ ' >$as_me.lineno && ++ chmod +x "$as_me.lineno" || ++ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } ++ ++ # Don't try to exec as it changes $[0], causing all sort of problems ++ # (the dirname of $[0] is not the place where we might find the ++ # original and so on. Autoconf is especially sensitive to this). ++ . "./$as_me.lineno" ++ # Exit status is that of the last command. ++ exit ++} ++ + # This file is generated from configure.in by Autoconf. DO NOT EDIT! + # Local configure fragment for sysdeps/powerpc/powerpc32. + + # See whether gas has R_PPC_REL16 relocs. +-{ $as_echo "$as_me:$LINENO: checking for R_PPC_REL16 gas support" >&5 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for R_PPC_REL16 gas support" >&5 + $as_echo_n "checking for R_PPC_REL16 gas support... " >&6; } +-if test "${libc_cv_ppc_rel16+set}" = set; then ++if ${libc_cv_ppc_rel16+:} false; then : + $as_echo_n "(cached) " >&6 + else + cat > conftest.s <<\EOF +@@ -12,50 +94,46 @@ else + addis 11,30,_GLOBAL_OFFSET_TABLE_-.@ha + EOF + if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5' +- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? +- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 +- (exit $ac_status); }; }; then ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; }; then + libc_cv_ppc_rel16=yes + else + libc_cv_ppc_rel16=no + fi + rm -f conftest* + fi +-{ $as_echo "$as_me:$LINENO: result: $libc_cv_ppc_rel16" >&5 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_ppc_rel16" >&5 + $as_echo "$libc_cv_ppc_rel16" >&6; } + if test $libc_cv_ppc_rel16 = no; then +- { { $as_echo "$as_me:$LINENO: error: R_PPC_REL16 is not supported. Binutils is too old." >&5 +-$as_echo "$as_me: error: R_PPC_REL16 is not supported. Binutils is too old." >&2;} +- { (exit 1); exit 1; }; } ++ as_fn_error $? "R_PPC_REL16 is not supported. Binutils is too old." "$LINENO" 5 + fi + + # See whether GCC uses -msecure-plt. +-{ $as_echo "$as_me:$LINENO: checking for -msecure-plt by default" >&5 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -msecure-plt by default" >&5 + $as_echo_n "checking for -msecure-plt by default... " >&6; } +-if test "${libc_cv_ppc_secure_plt+set}" = set; then ++if ${libc_cv_ppc_secure_plt+:} false; then : + $as_echo_n "(cached) " >&6 + else + echo 'int foo (void) { extern int bar; return bar; }' > conftest.c + libc_cv_ppc_secure_plt=no + if { ac_try='${CC-cc} -S $CFLAGS conftest.c -fpic -o conftest.s 1>&5' +- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? +- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 +- (exit $ac_status); }; }; then ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; }; then + if grep '_GLOBAL_OFFSET_TABLE_-.*@ha' conftest.s > /dev/null 2>&1; then + libc_cv_ppc_secure_plt=yes + fi + fi + rm -rf conftest* + fi +-{ $as_echo "$as_me:$LINENO: result: $libc_cv_ppc_secure_plt" >&5 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_ppc_secure_plt" >&5 + $as_echo "$libc_cv_ppc_secure_plt" >&6; } + if test $libc_cv_ppc_secure_plt = yes; then +- cat >>confdefs.h <<\_ACEOF +-#define HAVE_PPC_SECURE_PLT 1 +-_ACEOF ++ $as_echo "#define HAVE_PPC_SECURE_PLT 1" >>confdefs.h + + fi +diff --git a/sysdeps/powerpc/powerpc64/configure b/sysdeps/powerpc/powerpc64/configure +index a9b6722..7cff761 100644 +--- a/sysdeps/powerpc/powerpc64/configure ++++ b/sysdeps/powerpc/powerpc64/configure +@@ -1,21 +1,103 @@ ++ ++# as_fn_set_status STATUS ++# ----------------------- ++# Set $? to STATUS, without forking. ++as_fn_set_status () ++{ ++ return $1 ++} # as_fn_set_status ++ ++# as_fn_exit STATUS ++# ----------------- ++# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. ++as_fn_exit () ++{ ++ set +e ++ as_fn_set_status $1 ++ exit $1 ++} # as_fn_exit ++if expr a : '\(a\)' >/dev/null 2>&1 && ++ test "X`expr 00001 : '.*\(...\)'`" = X001; then ++ as_expr=expr ++else ++ as_expr=false ++fi ++ ++if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then ++ as_basename=basename ++else ++ as_basename=false ++fi ++ ++as_me=`$as_basename -- "$0" || ++$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ ++ X"$0" : 'X\(//\)$' \| \ ++ X"$0" : 'X\(/\)' \| . 2>/dev/null || ++$as_echo X/"$0" | ++ sed '/^.*\/\([^/][^/]*\)\/*$/{ ++ s//\1/ ++ q ++ } ++ /^X\/\(\/\/\)$/{ ++ s//\1/ ++ q ++ } ++ /^X\/\(\/\).*/{ ++ s//\1/ ++ q ++ } ++ s/.*/./; q'` ++ ++ ++ as_lineno_1=$LINENO as_lineno_1a=$LINENO ++ as_lineno_2=$LINENO as_lineno_2a=$LINENO ++ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && ++ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { ++ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) ++ sed -n ' ++ p ++ /[$]LINENO/= ++ ' <$as_myself | ++ sed ' ++ s/[$]LINENO.*/&-/ ++ t lineno ++ b ++ :lineno ++ N ++ :loop ++ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ ++ t loop ++ s/-\n.*// ++ ' >$as_me.lineno && ++ chmod +x "$as_me.lineno" || ++ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } ++ ++ # Don't try to exec as it changes $[0], causing all sort of problems ++ # (the dirname of $[0] is not the place where we might find the ++ # original and so on. Autoconf is especially sensitive to this). ++ . "./$as_me.lineno" ++ # Exit status is that of the last command. ++ exit ++} ++ + # This file is generated from configure.in by Autoconf. DO NOT EDIT! + # Local configure fragment for sysdeps/powerpc/powerpc64. + + # The Aix ld uses global .symbol_names instead of symbol_names + # and unfortunately early Linux PPC64 linkers use it as well. +-{ $as_echo "$as_me:$LINENO: checking for support for omitting dot symbols" >&5 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for support for omitting dot symbols" >&5 + $as_echo_n "checking for support for omitting dot symbols... " >&6; } +-if test "${libc_cv_omit_dot_syms+set}" = set; then ++if ${libc_cv_omit_dot_syms+:} false; then : + $as_echo_n "(cached) " >&6 + else + libc_cv_omit_dot_syms=no + echo 'void foo (void) {}' > conftest.c + if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -S conftest.c -o conftest.s 1>&5' +- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? +- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 +- (exit $ac_status); }; }; then ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; }; then + if grep -w '\.foo' conftest.s > /dev/null; then + : + else +@@ -25,28 +107,26 @@ fi + rm -f conftest.c conftest.s + + fi +-{ $as_echo "$as_me:$LINENO: result: $libc_cv_omit_dot_syms" >&5 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_omit_dot_syms" >&5 + $as_echo "$libc_cv_omit_dot_syms" >&6; } + if test x$libc_cv_omit_dot_syms != xyes; then +- cat >>confdefs.h <<\_ACEOF +-#define HAVE_ASM_GLOBAL_DOT_NAME 1 +-_ACEOF ++ $as_echo "#define HAVE_ASM_GLOBAL_DOT_NAME 1" >>confdefs.h + + fi + +-{ $as_echo "$as_me:$LINENO: checking for linker support for overlapping .opd entries" >&5 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker support for overlapping .opd entries" >&5 + $as_echo_n "checking for linker support for overlapping .opd entries... " >&6; } +-if test "${libc_cv_overlapping_opd+set}" = set; then ++if ${libc_cv_overlapping_opd+:} false; then : + $as_echo_n "(cached) " >&6 + else + libc_cv_overlapping_opd=no + echo 'void foo (void) {}' > conftest.c + if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -S conftest.c -o conftest.s 1>&5' +- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? +- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 +- (exit $ac_status); }; }; then ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; }; then + if grep '\.TOC\.@tocbase' conftest.s > /dev/null; then + if grep '\.TOC\.@tocbase[ ]*,[ ]*0' conftest.s > /dev/null; then + : +@@ -58,11 +138,9 @@ fi + rm -f conftest.c conftest.s + + fi +-{ $as_echo "$as_me:$LINENO: result: $libc_cv_overlapping_opd" >&5 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_overlapping_opd" >&5 + $as_echo "$libc_cv_overlapping_opd" >&6; } + if test x$libc_cv_overlapping_opd = xyes; then +- cat >>confdefs.h <<\_ACEOF +-#define USE_PPC64_OVERLAPPING_OPD 1 +-_ACEOF ++ $as_echo "#define USE_PPC64_OVERLAPPING_OPD 1" >>confdefs.h + + fi +diff --git a/sysdeps/unix/sysv/linux/powerpc/configure b/sysdeps/unix/sysv/linux/powerpc/configure +index df2813d..802b371 100644 +--- a/sysdeps/unix/sysv/linux/powerpc/configure ++++ b/sysdeps/unix/sysv/linux/powerpc/configure +@@ -1,19 +1,135 @@ ++ ++# as_fn_set_status STATUS ++# ----------------------- ++# Set $? to STATUS, without forking. ++as_fn_set_status () ++{ ++ return $1 ++} # as_fn_set_status ++ ++# as_fn_exit STATUS ++# ----------------- ++# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. ++as_fn_exit () ++{ ++ set +e ++ as_fn_set_status $1 ++ exit $1 ++} # as_fn_exit ++if expr a : '\(a\)' >/dev/null 2>&1 && ++ test "X`expr 00001 : '.*\(...\)'`" = X001; then ++ as_expr=expr ++else ++ as_expr=false ++fi ++ ++if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then ++ as_basename=basename ++else ++ as_basename=false ++fi ++ ++as_me=`$as_basename -- "$0" || ++$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ ++ X"$0" : 'X\(//\)$' \| \ ++ X"$0" : 'X\(/\)' \| . 2>/dev/null || ++$as_echo X/"$0" | ++ sed '/^.*\/\([^/][^/]*\)\/*$/{ ++ s//\1/ ++ q ++ } ++ /^X\/\(\/\/\)$/{ ++ s//\1/ ++ q ++ } ++ /^X\/\(\/\).*/{ ++ s//\1/ ++ q ++ } ++ s/.*/./; q'` ++ ++ ++ as_lineno_1=$LINENO as_lineno_1a=$LINENO ++ as_lineno_2=$LINENO as_lineno_2a=$LINENO ++ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && ++ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { ++ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) ++ sed -n ' ++ p ++ /[$]LINENO/= ++ ' <$as_myself | ++ sed ' ++ s/[$]LINENO.*/&-/ ++ t lineno ++ b ++ :lineno ++ N ++ :loop ++ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ ++ t loop ++ s/-\n.*// ++ ' >$as_me.lineno && ++ chmod +x "$as_me.lineno" || ++ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } ++ ++ # Don't try to exec as it changes $[0], causing all sort of problems ++ # (the dirname of $[0] is not the place where we might find the ++ # original and so on. Autoconf is especially sensitive to this). ++ . "./$as_me.lineno" ++ # Exit status is that of the last command. ++ exit ++} ++ ++ ++# ac_fn_c_try_compile LINENO ++# -------------------------- ++# Try to compile conftest.$ac_ext, and return whether this succeeded. ++ac_fn_c_try_compile () ++{ ++ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack ++ rm -f conftest.$ac_objext ++ if { { ac_try="$ac_compile" ++case "(($ac_try" in ++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; ++ *) ac_try_echo=$ac_try;; ++esac ++eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" ++$as_echo "$ac_try_echo"; } >&5 ++ (eval "$ac_compile") 2>conftest.err ++ ac_status=$? ++ if test -s conftest.err; then ++ grep -v '^ *+' conftest.err >conftest.er1 ++ cat conftest.er1 >&5 ++ mv -f conftest.er1 conftest.err ++ fi ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; } && { ++ test -z "$ac_c_werror_flag" || ++ test ! -s conftest.err ++ } && test -s conftest.$ac_objext; then : ++ ac_retval=0 ++else ++ $as_echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ ac_retval=1 ++fi ++ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno ++ as_fn_set_status $ac_retval ++ ++} # ac_fn_c_try_compile + # This file is generated from configure.in by Autoconf. DO NOT EDIT! + # Local configure fragment for sysdeps/unix/sysv/linux/powerpc/. + + +-{ $as_echo "$as_me:$LINENO: checking whether $CC $CFLAGS -mlong-double-128 uses IBM extended format" >&5 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC $CFLAGS -mlong-double-128 uses IBM extended format" >&5 + $as_echo_n "checking whether $CC $CFLAGS -mlong-double-128 uses IBM extended format... " >&6; } +-if test "${libc_cv_mlong_double_128ibm+set}" = set; then ++if ${libc_cv_mlong_double_128ibm+:} false; then : + $as_echo_n "(cached) " >&6 + else + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -mlong-double-128" +-cat >conftest.$ac_ext <<_ACEOF +-/* confdefs.h. */ +-_ACEOF +-cat confdefs.h >>conftest.$ac_ext +-cat >>conftest.$ac_ext <<_ACEOF ++cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #include + int +@@ -28,51 +144,26 @@ long double foobar (long double x) { return x; } + return 0; + } + _ACEOF +-rm -f conftest.$ac_objext +-if { (ac_try="$ac_compile" +-case "(($ac_try" in +- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; +- *) ac_try_echo=$ac_try;; +-esac +-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +-$as_echo "$ac_try_echo") >&5 +- (eval "$ac_compile") 2>conftest.er1 +- ac_status=$? +- grep -v '^ *+' conftest.er1 >conftest.err +- rm -f conftest.er1 +- cat conftest.err >&5 +- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 +- (exit $ac_status); } && { +- test -z "$ac_c_werror_flag" || +- test ! -s conftest.err +- } && test -s conftest.$ac_objext; then ++if ac_fn_c_try_compile "$LINENO"; then : + libc_cv_mlong_double_128ibm=yes + else +- $as_echo "$as_me: failed program was:" >&5 +-sed 's/^/| /' conftest.$ac_ext >&5 +- +- libc_cv_mlong_double_128ibm=no ++ libc_cv_mlong_double_128ibm=no + fi +- + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + fi +-{ $as_echo "$as_me:$LINENO: result: $libc_cv_mlong_double_128ibm" >&5 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mlong_double_128ibm" >&5 + $as_echo "$libc_cv_mlong_double_128ibm" >&6; } + + if test "$libc_cv_mlong_double_128ibm" = no; then +- { $as_echo "$as_me:$LINENO: checking whether $CC $CFLAGS supports -mabi=ibmlongdouble" >&5 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC $CFLAGS supports -mabi=ibmlongdouble" >&5 + $as_echo_n "checking whether $CC $CFLAGS supports -mabi=ibmlongdouble... " >&6; } +-if test "${libc_cv_mabi_ibmlongdouble+set}" = set; then ++if ${libc_cv_mabi_ibmlongdouble+:} false; then : + $as_echo_n "(cached) " >&6 + else + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -mlong-double-128 -mabi=ibmlongdouble" +- cat >conftest.$ac_ext <<_ACEOF +-/* confdefs.h. */ +-_ACEOF +-cat confdefs.h >>conftest.$ac_ext +-cat >>conftest.$ac_ext <<_ACEOF ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #include + int +@@ -87,43 +178,20 @@ long double foobar (long double x) { return x; } + return 0; + } + _ACEOF +-rm -f conftest.$ac_objext +-if { (ac_try="$ac_compile" +-case "(($ac_try" in +- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; +- *) ac_try_echo=$ac_try;; +-esac +-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +-$as_echo "$ac_try_echo") >&5 +- (eval "$ac_compile") 2>conftest.er1 +- ac_status=$? +- grep -v '^ *+' conftest.er1 >conftest.err +- rm -f conftest.er1 +- cat conftest.err >&5 +- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 +- (exit $ac_status); } && { +- test -z "$ac_c_werror_flag" || +- test ! -s conftest.err +- } && test -s conftest.$ac_objext; then ++if ac_fn_c_try_compile "$LINENO"; then : + libc_cv_mabi_ibmlongdouble=yes + else +- $as_echo "$as_me: failed program was:" >&5 +-sed 's/^/| /' conftest.$ac_ext >&5 +- +- libc_cv_mabi_ibmlongdouble=no ++ libc_cv_mabi_ibmlongdouble=no + fi +- + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + fi +-{ $as_echo "$as_me:$LINENO: result: $libc_cv_mabi_ibmlongdouble" >&5 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mabi_ibmlongdouble" >&5 + $as_echo "$libc_cv_mabi_ibmlongdouble" >&6; } + + if test "$libc_cv_mabi_ibmlongdouble" = yes; then + CFLAGS="$CFLAGS -mabi=ibmlongdouble" + else +- { { $as_echo "$as_me:$LINENO: error: this configuration requires -mlong-double-128 IBM extended format support" >&5 +-$as_echo "$as_me: error: this configuration requires -mlong-double-128 IBM extended format support" >&2;} +- { (exit 1); exit 1; }; } ++ as_fn_error $? "this configuration requires -mlong-double-128 IBM extended format support" "$LINENO" 5 + fi + fi +diff --git a/sysdeps/x86_64/fpu/math_private.h b/sysdeps/x86_64/fpu/math_private.h +index 7f52d5e..3929b6b 100644 +--- a/sysdeps/x86_64/fpu/math_private.h ++++ b/sysdeps/x86_64/fpu/math_private.h +@@ -19,7 +19,7 @@ + + /* We can do a few things better on x86-64. */ + +-#ifdef __AVX__ ++#if defined __AVX__ || defined SSE2AVX + # define MOVD "vmovd" + #else + # define MOVD "movd" +@@ -86,7 +86,7 @@ + ({ int __di; GET_FLOAT_WORD (__di, (float) d); \ + (__di & 0x7fffffff) < 0x7f800000; }) + +-#ifdef __AVX__ ++#if defined __AVX__ || defined SSE2AVX + # define __ieee754_sqrt(d) \ + ({ double __res; \ + asm ("vsqrtsd %1, %0, %0" : "=x" (__res) : "xm" ((double) (d))); \ +@@ -112,7 +112,7 @@ + + #ifdef __SSE4_1__ + # ifndef __rint +-# ifdef __AVX__ ++# if defined __AVX__ || defined SSE2AVX + # define __rint(d) \ + ({ double __res; \ + asm ("vroundsd $4, %1, %0, %0" : "=x" (__res) : "xm" ((double) (d))); \ +@@ -125,7 +125,7 @@ + # endif + # endif + # ifndef __rintf +-# ifdef __AVX__ ++# if defined __AVX__ || defined SSE2AVX + # define __rintf(d) \ + ({ float __res; \ + asm ("vroundss $4, %1, %0, %0" : "=x" (__res) : "xm" ((float) (d))); \ +@@ -139,7 +139,7 @@ + # endif + + # ifndef __floor +-# ifdef __AVX__ ++# if defined __AVX__ || defined SSE2AVX + # define __floor(d) \ + ({ double __res; \ + asm ("vroundsd $1, %1, %0, %0" : "=x" (__res) : "xm" ((double) (d))); \ +@@ -152,7 +152,7 @@ + # endif + # endif + # ifndef __floorf +-# ifdef __AVX__ ++# if defined __AVX__ || defined SSE2AVX + # define __floorf(d) \ + ({ float __res; \ + asm ("vroundss $1, %1, %0, %0" : "=x" (__res) : "xm" ((float) (d))); \ +@@ -169,29 +169,6 @@ + + /* Specialized variants of the interfaces which only handle + either the FPU or the SSE unit. */ +-#undef libc_fegetround +-#define libc_fegetround() \ +- ({ \ +- unsigned int mxcsr; \ +- asm volatile ("stmxcsr %0" : "=m" (*&mxcsr)); \ +- (mxcsr & 0x6000) >> 3; \ +- }) +-#undef libc_fegetroundf +-#define libc_fegetroundf() libc_fegetround () +-// #define libc_fegetroundl() fegetround () +- +-#undef libc_fesetround +-#define libc_fesetround(r) \ +- do { \ +- unsigned int mxcsr; \ +- asm ("stmxcsr %0" : "=m" (*&mxcsr)); \ +- mxcsr = (mxcsr & ~0x6000) | ((r) << 3); \ +- asm volatile ("ldmxcsr %0" : : "m" (*&mxcsr)); \ +- } while (0) +-#undef libc_fesetroundf +-#define libc_fesetroundf(r) libc_fesetround (r) +-// #define libc_fesetroundl(r) (void) fesetround (r) +- + #undef libc_feholdexcept + #ifdef __AVX__ + # define libc_feholdexcept(e) \ +diff --git a/sysdeps/x86_64/fpu/multiarch/Makefile b/sysdeps/x86_64/fpu/multiarch/Makefile +index be68903..12b0526 100644 +--- a/sysdeps/x86_64/fpu/multiarch/Makefile ++++ b/sysdeps/x86_64/fpu/multiarch/Makefile +@@ -7,10 +7,9 @@ libm-sysdep_routines += e_exp-fma4 e_log-fma4 e_pow-fma4 s_atan-fma4 \ + e_asin-fma4 e_atan2-fma4 s_sin-fma4 s_tan-fma4 \ + mplog-fma4 mpa-fma4 slowexp-fma4 slowpow-fma4 \ + sincos32-fma4 doasin-fma4 dosincos-fma4 \ +- brandred-fma4 halfulp-fma4 mpexp-fma4 \ ++ halfulp-fma4 mpexp-fma4 \ + mpatan2-fma4 mpatan-fma4 mpsqrt-fma4 mptan-fma4 + +-CFLAGS-brandred-fma4.c = -mfma4 + CFLAGS-doasin-fma4.c = -mfma4 + CFLAGS-dosincos-fma4.c = -mfma4 + CFLAGS-e_asin-fma4.c = -mfma4 +@@ -34,21 +33,21 @@ CFLAGS-s_sin-fma4.c = -mfma4 + CFLAGS-s_tan-fma4.c = -mfma4 + endif + +-ifeq ($(config-cflags-avx),yes) ++ifeq ($(config-cflags-sse2avx),yes) + libm-sysdep_routines += e_exp-avx e_log-avx s_atan-avx \ + e_atan2-avx s_sin-avx s_tan-avx \ + mplog-avx mpa-avx slowexp-avx \ + mpexp-avx + +-CFLAGS-e_atan2-avx.c = -mavx +-CFLAGS-e_exp-avx.c = -mavx +-CFLAGS-e_log-avx.c = -mavx +-CFLAGS-mpa-avx.c = -mavx +-CFLAGS-mpexp-avx.c = -mavx +-CFLAGS-mplog-avx.c = -mavx +-CFLAGS-s_atan-avx.c = -mavx +-CFLAGS-s_sin-avx.c = -mavx +-CFLAGS-slowexp-avx.c = -mavx +-CFLAGS-s_tan-avx.c = -mavx ++CFLAGS-e_atan2-avx.c = -msse2avx -DSSE2AVX ++CFLAGS-e_exp-avx.c = -msse2avx -DSSE2AVX ++CFLAGS-e_log-avx.c = -msse2avx -DSSE2AVX ++CFLAGS-mpa-avx.c = -msse2avx -DSSE2AVX ++CFLAGS-mpexp-avx.c = -msse2avx -DSSE2AVX ++CFLAGS-mplog-avx.c = -msse2avx -DSSE2AVX ++CFLAGS-s_atan-avx.c = -msse2avx -DSSE2AVX ++CFLAGS-s_sin-avx.c = -msse2avx -DSSE2AVX ++CFLAGS-slowexp-avx.c = -msse2avx -DSSE2AVX ++CFLAGS-s_tan-avx.c = -msse2avx -DSSE2AVX + endif + endif +diff --git a/sysdeps/x86_64/fpu/multiarch/brandred-fma4.c b/sysdeps/x86_64/fpu/multiarch/brandred-fma4.c +deleted file mode 100644 +index f4f68ac..0000000 +--- a/sysdeps/x86_64/fpu/multiarch/brandred-fma4.c ++++ /dev/null +@@ -1,4 +0,0 @@ +-#define __branred __branred_fma4 +-#define SECTION __attribute__ ((section (".text.fma4"))) +- +-#include +diff --git a/sysdeps/x86_64/fpu/multiarch/e_atan2.c b/sysdeps/x86_64/fpu/multiarch/e_atan2.c +index 3a615fc..6867c6e 100644 +--- a/sysdeps/x86_64/fpu/multiarch/e_atan2.c ++++ b/sysdeps/x86_64/fpu/multiarch/e_atan2.c +@@ -14,7 +14,7 @@ extern double __ieee754_atan2_fma4 (double, double); + + libm_ifunc (__ieee754_atan2, + HAS_FMA4 ? __ieee754_atan2_fma4 +- : (HAS_YMM_USABLE ? __ieee754_atan2_avx : __ieee754_atan2_sse2)); ++ : (HAS_AVX ? __ieee754_atan2_avx : __ieee754_atan2_sse2)); + strong_alias (__ieee754_atan2, __atan2_finite) + + # define __ieee754_atan2 __ieee754_atan2_sse2 +diff --git a/sysdeps/x86_64/fpu/multiarch/e_exp.c b/sysdeps/x86_64/fpu/multiarch/e_exp.c +index 7b2320a..3c65028 100644 +--- a/sysdeps/x86_64/fpu/multiarch/e_exp.c ++++ b/sysdeps/x86_64/fpu/multiarch/e_exp.c +@@ -14,7 +14,7 @@ extern double __ieee754_exp_fma4 (double); + + libm_ifunc (__ieee754_exp, + HAS_FMA4 ? __ieee754_exp_fma4 +- : (HAS_YMM_USABLE ? __ieee754_exp_avx : __ieee754_exp_sse2)); ++ : (HAS_AVX ? __ieee754_exp_avx : __ieee754_exp_sse2)); + strong_alias (__ieee754_exp, __exp_finite) + + # define __ieee754_exp __ieee754_exp_sse2 +diff --git a/sysdeps/x86_64/fpu/multiarch/e_log.c b/sysdeps/x86_64/fpu/multiarch/e_log.c +index ab277d6..05f3668 100644 +--- a/sysdeps/x86_64/fpu/multiarch/e_log.c ++++ b/sysdeps/x86_64/fpu/multiarch/e_log.c +@@ -14,8 +14,7 @@ extern double __ieee754_log_fma4 (double); + + libm_ifunc (__ieee754_log, + HAS_FMA4 ? __ieee754_log_fma4 +- : (HAS_YMM_USABLE ? __ieee754_log_avx +- : __ieee754_log_sse2)); ++ : (HAS_AVX ? __ieee754_log_avx : __ieee754_log_sse2)); + strong_alias (__ieee754_log, __log_finite) + + # define __ieee754_log __ieee754_log_sse2 +diff --git a/sysdeps/x86_64/fpu/multiarch/s_atan.c b/sysdeps/x86_64/fpu/multiarch/s_atan.c +index 78c7e09..ae16d7c 100644 +--- a/sysdeps/x86_64/fpu/multiarch/s_atan.c ++++ b/sysdeps/x86_64/fpu/multiarch/s_atan.c +@@ -13,7 +13,7 @@ extern double __atan_fma4 (double); + # endif + + libm_ifunc (atan, (HAS_FMA4 ? __atan_fma4 : +- HAS_YMM_USABLE ? __atan_avx : __atan_sse2)); ++ HAS_AVX ? __atan_avx : __atan_sse2)); + + # define atan __atan_sse2 + #endif +diff --git a/sysdeps/x86_64/fpu/multiarch/s_sin-fma4.c b/sysdeps/x86_64/fpu/multiarch/s_sin-fma4.c +index 2501af9..4c35739 100644 +--- a/sysdeps/x86_64/fpu/multiarch/s_sin-fma4.c ++++ b/sysdeps/x86_64/fpu/multiarch/s_sin-fma4.c +@@ -1,6 +1,5 @@ + #define __cos __cos_fma4 + #define __sin __sin_fma4 +-#define __branred __branred_fma4 + #define __docos __docos_fma4 + #define __dubsin __dubsin_fma4 + #define __mpcos __mpcos_fma4 +diff --git a/sysdeps/x86_64/fpu/multiarch/s_sin.c b/sysdeps/x86_64/fpu/multiarch/s_sin.c +index 417acd0..a0c2521 100644 +--- a/sysdeps/x86_64/fpu/multiarch/s_sin.c ++++ b/sysdeps/x86_64/fpu/multiarch/s_sin.c +@@ -18,11 +18,11 @@ extern double __sin_fma4 (double); + # endif + + libm_ifunc (__cos, (HAS_FMA4 ? __cos_fma4 : +- HAS_YMM_USABLE ? __cos_avx : __cos_sse2)); ++ HAS_AVX ? __cos_avx : __cos_sse2)); + weak_alias (__cos, cos) + + libm_ifunc (__sin, (HAS_FMA4 ? __sin_fma4 : +- HAS_YMM_USABLE ? __sin_avx : __sin_sse2)); ++ HAS_AVX ? __sin_avx : __sin_sse2)); + weak_alias (__sin, sin) + + # define __cos __cos_sse2 +diff --git a/sysdeps/x86_64/fpu/multiarch/s_tan-fma4.c b/sysdeps/x86_64/fpu/multiarch/s_tan-fma4.c +index d7dab3c..a805440 100644 +--- a/sysdeps/x86_64/fpu/multiarch/s_tan-fma4.c ++++ b/sysdeps/x86_64/fpu/multiarch/s_tan-fma4.c +@@ -1,5 +1,4 @@ + #define tan __tan_fma4 +-#define __branred __branred_fma4 + #define __dbl_mp __dbl_mp_fma4 + #define __mpranred __mpranred_fma4 + #define __mptan __mptan_fma4 +diff --git a/sysdeps/x86_64/fpu/multiarch/s_tan.c b/sysdeps/x86_64/fpu/multiarch/s_tan.c +index 3047155..904308f 100644 +--- a/sysdeps/x86_64/fpu/multiarch/s_tan.c ++++ b/sysdeps/x86_64/fpu/multiarch/s_tan.c +@@ -13,7 +13,7 @@ extern double __tan_fma4 (double); + # endif + + libm_ifunc (tan, (HAS_FMA4 ? __tan_fma4 : +- HAS_YMM_USABLE ? __tan_avx : __tan_sse2)); ++ HAS_AVX ? __tan_avx : __tan_sse2)); + + # define tan __tan_sse2 + #endif only in patch2: unchanged: --- eglibc-2.15.orig/debian/patches/amd64/cvs-avx-fma4.diff +++ eglibc-2.15/debian/patches/amd64/cvs-avx-fma4.diff @@ -0,0 +1,466 @@ +2012-05-17 Andreas Jaeger + Carlos O'Donell + + [BZ #14059] + * sysdeps/x86_64/multiarch/init-arch.h + (bit_YMM_Usable): Rename to... + (bit_AVX_Usable): ... this. + (bit_FMA4_Usable): New macro. + (bit_XMM_state): New macro. + (bit_YMM_state): New macro. + [__ASSEMBLER__] (index_YMM_Usable): Rename to... + [__ASSEMBLER__] (index_AVX_Usable): ... this. + [__ASSEMBLER__] (index_FMA4_Usable): New macro. + (CPUID_OSXSAVE): New macro. + (CPUID_AVX): New macro. + (CPUID_FMA4): New macro. + (index_YMM_Usable): Rename to... + (index_AVX_Usable): ... this. + (HAS_AVX): Use HAS_ARCH_FEATURE. + (HAS_FMA4): Likewise. + (HAS_YMM_USABLE): Remove. + * sysdeps/x86_64/multiarch/init-arch.c (__init_cpu_features): + Enable AVX or FMA4 IFF YMM and XMM states are usable and the features + are present. + * sysdeps/x86_64/multiarch/strcmp.S: Use bit_AVX_Usable. + * sysdeps/i386/i686/multiarch/Makefile: Add test-multiarch to tests. + * sysdeps/x86_64/multiarch/Makefile: Likewise. + * sysdeps/i386/i686/multiarch/test-multiarch.c: New file. + * sysdeps/x86_64/multiarch/test-multiarch.c: New file. + +2012-01-26 Ulrich Drepper + + [BZ #13583] + * sysdeps/x86_64/multiarch/init-arch.h: Define bit_OSXSAVE. + Clean up HAS_* macros. + * sysdeps/x86_64/multiarch/init-arch.c (__init_cpu_features): If + bit_AVX is set also check OSXAVE/XCR0 and set bit_YMM_Usable if + possible. + * sysdeps/x86_64/fpu/multiarch/e_atan2.c: Use HAS_YMM_USABLE, not + HAS_AVX. + * sysdeps/x86_64/fpu/multiarch/e_exp.c: Likewise. + * sysdeps/x86_64/fpu/multiarch/e_log.c: Likewise. + * sysdeps/x86_64/fpu/multiarch/s_atan.c: Likewise. + * sysdeps/x86_64/fpu/multiarch/s_sin.c: Likewise. + * sysdeps/x86_64/fpu/multiarch/s_tan.c: Likewise. + +diff --git a/sysdeps/i386/i686/multiarch/Makefile b/sysdeps/i386/i686/multiarch/Makefile +index b764e5b..8946bfa 100644 +--- a/sysdeps/i386/i686/multiarch/Makefile ++++ b/sysdeps/i386/i686/multiarch/Makefile +@@ -1,5 +1,6 @@ + ifeq ($(subdir),csu) + aux += init-arch ++tests += test-multiarch + gen-as-const-headers += ifunc-defines.sym + endif + +diff --git a/sysdeps/i386/i686/multiarch/test-multiarch.c b/sysdeps/i386/i686/multiarch/test-multiarch.c +new file mode 100644 +index 0000000..593cfec +--- /dev/null ++++ b/sysdeps/i386/i686/multiarch/test-multiarch.c +@@ -0,0 +1 @@ ++#include +diff --git a/sysdeps/x86_64/fpu/multiarch/e_atan2.c b/sysdeps/x86_64/fpu/multiarch/e_atan2.c +index 6867c6e..3a615fc 100644 +--- a/sysdeps/x86_64/fpu/multiarch/e_atan2.c ++++ b/sysdeps/x86_64/fpu/multiarch/e_atan2.c +@@ -14,7 +14,7 @@ extern double __ieee754_atan2_fma4 (double, double); + + libm_ifunc (__ieee754_atan2, + HAS_FMA4 ? __ieee754_atan2_fma4 +- : (HAS_AVX ? __ieee754_atan2_avx : __ieee754_atan2_sse2)); ++ : (HAS_YMM_USABLE ? __ieee754_atan2_avx : __ieee754_atan2_sse2)); + strong_alias (__ieee754_atan2, __atan2_finite) + + # define __ieee754_atan2 __ieee754_atan2_sse2 +diff --git a/sysdeps/x86_64/fpu/multiarch/e_exp.c b/sysdeps/x86_64/fpu/multiarch/e_exp.c +index 3c65028..7b2320a 100644 +--- a/sysdeps/x86_64/fpu/multiarch/e_exp.c ++++ b/sysdeps/x86_64/fpu/multiarch/e_exp.c +@@ -14,7 +14,7 @@ extern double __ieee754_exp_fma4 (double); + + libm_ifunc (__ieee754_exp, + HAS_FMA4 ? __ieee754_exp_fma4 +- : (HAS_AVX ? __ieee754_exp_avx : __ieee754_exp_sse2)); ++ : (HAS_YMM_USABLE ? __ieee754_exp_avx : __ieee754_exp_sse2)); + strong_alias (__ieee754_exp, __exp_finite) + + # define __ieee754_exp __ieee754_exp_sse2 +diff --git a/sysdeps/x86_64/fpu/multiarch/e_log.c b/sysdeps/x86_64/fpu/multiarch/e_log.c +index 3b468d0..ab277d6 100644 +--- a/sysdeps/x86_64/fpu/multiarch/e_log.c ++++ b/sysdeps/x86_64/fpu/multiarch/e_log.c +@@ -14,7 +14,7 @@ extern double __ieee754_log_fma4 (double); + + libm_ifunc (__ieee754_log, + HAS_FMA4 ? __ieee754_log_fma4 +- : (HAS_AVX ? __ieee754_log_avx ++ : (HAS_YMM_USABLE ? __ieee754_log_avx + : __ieee754_log_sse2)); + strong_alias (__ieee754_log, __log_finite) + +diff --git a/sysdeps/x86_64/fpu/multiarch/s_atan.c b/sysdeps/x86_64/fpu/multiarch/s_atan.c +index 3160201..78c7e09 100644 +--- a/sysdeps/x86_64/fpu/multiarch/s_atan.c ++++ b/sysdeps/x86_64/fpu/multiarch/s_atan.c +@@ -12,7 +12,8 @@ extern double __atan_fma4 (double); + # define __atan_fma4 ((void *) 0) + # endif + +-libm_ifunc (atan, HAS_FMA4 ? __atan_fma4 : HAS_AVX ? __atan_avx : __atan_sse2); ++libm_ifunc (atan, (HAS_FMA4 ? __atan_fma4 : ++ HAS_YMM_USABLE ? __atan_avx : __atan_sse2)); + + # define atan __atan_sse2 + #endif +diff --git a/sysdeps/x86_64/fpu/multiarch/s_sin.c b/sysdeps/x86_64/fpu/multiarch/s_sin.c +index 1ba9dbc..417acd0 100644 +--- a/sysdeps/x86_64/fpu/multiarch/s_sin.c ++++ b/sysdeps/x86_64/fpu/multiarch/s_sin.c +@@ -17,10 +17,12 @@ extern double __sin_fma4 (double); + # define __sin_fma4 ((void *) 0) + # endif + +-libm_ifunc (__cos, HAS_FMA4 ? __cos_fma4 : HAS_AVX ? __cos_avx : __cos_sse2); ++libm_ifunc (__cos, (HAS_FMA4 ? __cos_fma4 : ++ HAS_YMM_USABLE ? __cos_avx : __cos_sse2)); + weak_alias (__cos, cos) + +-libm_ifunc (__sin, HAS_FMA4 ? __sin_fma4 : HAS_AVX ? __sin_avx : __sin_sse2); ++libm_ifunc (__sin, (HAS_FMA4 ? __sin_fma4 : ++ HAS_YMM_USABLE ? __sin_avx : __sin_sse2)); + weak_alias (__sin, sin) + + # define __cos __cos_sse2 +diff --git a/sysdeps/x86_64/fpu/multiarch/s_tan.c b/sysdeps/x86_64/fpu/multiarch/s_tan.c +index 8f6601e..3047155 100644 +--- a/sysdeps/x86_64/fpu/multiarch/s_tan.c ++++ b/sysdeps/x86_64/fpu/multiarch/s_tan.c +@@ -12,7 +12,8 @@ extern double __tan_fma4 (double); + # define __tan_fma4 ((void *) 0) + # endif + +-libm_ifunc (tan, HAS_FMA4 ? __tan_fma4 : HAS_AVX ? __tan_avx : __tan_sse2); ++libm_ifunc (tan, (HAS_FMA4 ? __tan_fma4 : ++ HAS_YMM_USABLE ? __tan_avx : __tan_sse2)); + + # define tan __tan_sse2 + #endif +diff --git a/sysdeps/x86_64/multiarch/Makefile b/sysdeps/x86_64/multiarch/Makefile +index 9a183f0..dd6c27d 100644 +--- a/sysdeps/x86_64/multiarch/Makefile ++++ b/sysdeps/x86_64/multiarch/Makefile +@@ -1,5 +1,6 @@ + ifeq ($(subdir),csu) + aux += init-arch ++tests += test-multiarch + gen-as-const-headers += ifunc-defines.sym + endif + +diff --git a/sysdeps/x86_64/multiarch/init-arch.c b/sysdeps/x86_64/multiarch/init-arch.c +index 65b0ee9..df0fe55c 100644 +--- a/sysdeps/x86_64/multiarch/init-arch.c ++++ b/sysdeps/x86_64/multiarch/init-arch.c +@@ -1,6 +1,6 @@ + /* Initialize CPU feature data. + This file is part of the GNU C Library. +- Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc. ++ Copyright (C) 2008-2012 Free Software Foundation, Inc. + Contributed by Ulrich Drepper . + + The GNU C Library is free software; you can redistribute it and/or +@@ -144,6 +144,25 @@ __init_cpu_features (void) + else + kind = arch_kind_other; + ++ /* Can we call xgetbv? */ ++ if (CPUID_OSXSAVE) ++ { ++ unsigned int xcrlow; ++ unsigned int xcrhigh; ++ asm ("xgetbv" : "=a" (xcrlow), "=d" (xcrhigh) : "c" (0)); ++ /* Is YMM and XMM state usable? */ ++ if ((xcrlow & (bit_YMM_state | bit_XMM_state)) == ++ (bit_YMM_state | bit_XMM_state)) ++ { ++ /* Determine if AVX is usable. */ ++ if (CPUID_AVX) ++ __cpu_features.feature[index_AVX_Usable] |= bit_AVX_Usable; ++ /* Determine if FMA4 is usable. */ ++ if (CPUID_FMA4) ++ __cpu_features.feature[index_FMA4_Usable] |= bit_FMA4_Usable; ++ } ++ } ++ + __cpu_features.family = family; + __cpu_features.model = model; + atomic_write_barrier (); +diff --git a/sysdeps/x86_64/multiarch/init-arch.h b/sysdeps/x86_64/multiarch/init-arch.h +index 2a1df39..37566c8 100644 +--- a/sysdeps/x86_64/multiarch/init-arch.h ++++ b/sysdeps/x86_64/multiarch/init-arch.h +@@ -1,5 +1,5 @@ + /* This file is part of the GNU C Library. +- Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc. ++ Copyright (C) 2008-2012 Free Software Foundation, Inc. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public +@@ -22,16 +22,24 @@ + #define bit_Prefer_SSE_for_memop (1 << 3) + #define bit_Fast_Unaligned_Load (1 << 4) + #define bit_Prefer_PMINUB_for_stringop (1 << 5) ++#define bit_AVX_Usable (1 << 6) ++#define bit_FMA4_Usable (1 << 7) + ++/* CPUID Feature flags. */ + #define bit_SSE2 (1 << 26) + #define bit_SSSE3 (1 << 9) + #define bit_SSE4_1 (1 << 19) + #define bit_SSE4_2 (1 << 20) ++#define bit_OSXSAVE (1 << 27) + #define bit_AVX (1 << 28) + #define bit_POPCOUNT (1 << 23) + #define bit_FMA (1 << 12) + #define bit_FMA4 (1 << 16) + ++/* XCR0 Feature flags. */ ++#define bit_XMM_state (1 << 1) ++#define bit_YMM_state (2 << 1) ++ + #ifdef __ASSEMBLER__ + + # include +@@ -48,6 +56,8 @@ + # define index_Prefer_SSE_for_memop FEATURE_INDEX_1*FEATURE_SIZE + # define index_Fast_Unaligned_Load FEATURE_INDEX_1*FEATURE_SIZE + # define index_Prefer_PMINUB_for_stringop FEATURE_INDEX_1*FEATURE_SIZE ++# define index_AVX_Usable FEATURE_INDEX_1*FEATURE_SIZE ++# define index_FMA4_Usable FEATURE_INDEX_1*FEATURE_SIZE + + #else /* __ASSEMBLER__ */ + +@@ -92,7 +102,7 @@ extern struct cpu_features + + + extern void __init_cpu_features (void) attribute_hidden; +-#define INIT_ARCH()\ ++# define INIT_ARCH() \ + do \ + if (__cpu_features.kind == arch_kind_unknown) \ + __init_cpu_features (); \ +@@ -111,37 +121,45 @@ extern const struct cpu_features *__get_cpu_features (void) + + /* Following are the feature tests used throughout libc. */ + ++/* CPUID_* evaluates to true if the feature flag is enabled. ++ We always use &__cpu_features because the HAS_CPUID_* macros ++ are called only within __init_cpu_features, where we can't ++ call __get_cpu_features without infinite recursion. */ ++# define HAS_CPUID_FLAG(idx, reg, bit) \ ++ (((&__cpu_features)->cpuid[idx].reg & (bit)) != 0) ++ ++# define CPUID_OSXSAVE \ ++ HAS_CPUID_FLAG (COMMON_CPUID_INDEX_1, ecx, bit_OSXSAVE) ++# define CPUID_AVX \ ++ HAS_CPUID_FLAG (COMMON_CPUID_INDEX_1, ecx, bit_AVX) ++# define CPUID_FMA4 \ ++ HAS_CPUID_FLAG (COMMON_CPUID_INDEX_80000001, ecx, bit_FMA4) ++ ++/* HAS_* evaluates to true if we may use the feature at runtime. */ + # define HAS_SSE2 HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, edx, bit_SSE2) + # define HAS_POPCOUNT HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, bit_POPCOUNT) + # define HAS_SSSE3 HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, bit_SSSE3) + # define HAS_SSE4_1 HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, bit_SSE4_1) + # define HAS_SSE4_2 HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, bit_SSE4_2) + # define HAS_FMA HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, bit_FMA) +-# define HAS_AVX HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, bit_AVX) +-# define HAS_FMA4 HAS_CPU_FEATURE (COMMON_CPUID_INDEX_80000001, ecx, bit_FMA4) + + # define index_Fast_Rep_String FEATURE_INDEX_1 + # define index_Fast_Copy_Backward FEATURE_INDEX_1 + # define index_Slow_BSF FEATURE_INDEX_1 + # define index_Prefer_SSE_for_memop FEATURE_INDEX_1 + # define index_Fast_Unaligned_Load FEATURE_INDEX_1 +- +-#define HAS_ARCH_FEATURE(idx, bit) \ +- ((__get_cpu_features ()->feature[idx] & (bit)) != 0) +- +-#define HAS_FAST_REP_STRING \ +- HAS_ARCH_FEATURE (index_Fast_Rep_String, bit_Fast_Rep_String) +- +-#define HAS_FAST_COPY_BACKWARD \ +- HAS_ARCH_FEATURE (index_Fast_Copy_Backward, bit_Fast_Copy_Backward) +- +-#define HAS_SLOW_BSF \ +- HAS_ARCH_FEATURE (index_Slow_BSF, bit_Slow_BSF) +- +-#define HAS_PREFER_SSE_FOR_MEMOP \ +- HAS_ARCH_FEATURE (index_Prefer_SSE_for_memop, bit_Prefer_SSE_for_memop) +- +-#define HAS_FAST_UNALIGNED_LOAD \ +- HAS_ARCH_FEATURE (index_Fast_Unaligned_Load, bit_Fast_Unaligned_Load) ++# define index_AVX_Usable FEATURE_INDEX_1 ++# define index_FMA4_Usable FEATURE_INDEX_1 ++ ++# define HAS_ARCH_FEATURE(name) \ ++ ((__get_cpu_features ()->feature[index_##name] & (bit_##name)) != 0) ++ ++# define HAS_FAST_REP_STRING HAS_ARCH_FEATURE (Fast_Rep_String) ++# define HAS_FAST_COPY_BACKWARD HAS_ARCH_FEATURE (Fast_Copy_Backward) ++# define HAS_SLOW_BSF HAS_ARCH_FEATURE (Slow_BSF) ++# define HAS_PREFER_SSE_FOR_MEMOP HAS_ARCH_FEATURE (Prefer_SSE_for_memop) ++# define HAS_FAST_UNALIGNED_LOAD HAS_ARCH_FEATURE (Fast_Unaligned_Load) ++# define HAS_AVX HAS_ARCH_FEATURE (AVX_Usable) ++# define HAS_FMA4 HAS_ARCH_FEATURE (FMA4_Usable) + + #endif /* __ASSEMBLER__ */ +diff --git a/sysdeps/x86_64/multiarch/strcmp.S b/sysdeps/x86_64/multiarch/strcmp.S +index f93c83d..d036160 100644 +--- a/sysdeps/x86_64/multiarch/strcmp.S ++++ b/sysdeps/x86_64/multiarch/strcmp.S +@@ -1,5 +1,5 @@ + /* strcmp with SSE4.2 +- Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc. ++ Copyright (C) 2009-2012 Free Software Foundation, Inc. + Contributed by Intel Corporation. + This file is part of the GNU C Library. + +@@ -84,6 +84,7 @@ + .text + ENTRY(STRCMP) + .type STRCMP, @gnu_indirect_function ++ /* Manually inlined call to __get_cpu_features. */ + cmpl $0, __cpu_features+KIND_OFFSET(%rip) + jne 1f + call __init_cpu_features +@@ -101,13 +102,14 @@ END(STRCMP) + # ifdef USE_AS_STRCASECMP_L + ENTRY(__strcasecmp) + .type __strcasecmp, @gnu_indirect_function ++ /* Manually inlined call to __get_cpu_features. */ + cmpl $0, __cpu_features+KIND_OFFSET(%rip) + jne 1f + call __init_cpu_features + 1: + # ifdef HAVE_AVX_SUPPORT + leaq __strcasecmp_avx(%rip), %rax +- testl $bit_AVX, __cpu_features+CPUID_OFFSET+index_AVX(%rip) ++ testl $bit_AVX_Usable, __cpu_features+FEATURE_OFFSET+index_AVX_Usable(%rip) + jnz 2f + # endif + leaq __strcasecmp_sse42(%rip), %rax +@@ -124,13 +126,14 @@ weak_alias (__strcasecmp, strcasecmp) + # ifdef USE_AS_STRNCASECMP_L + ENTRY(__strncasecmp) + .type __strncasecmp, @gnu_indirect_function ++ /* Manually inlined call to __get_cpu_features. */ + cmpl $0, __cpu_features+KIND_OFFSET(%rip) + jne 1f + call __init_cpu_features + 1: + # ifdef HAVE_AVX_SUPPORT + leaq __strncasecmp_avx(%rip), %rax +- testl $bit_AVX, __cpu_features+CPUID_OFFSET+index_AVX(%rip) ++ testl $bit_AVX_Usable, __cpu_features+FEATURE_OFFSET+index_AVX_Usable(%rip) + jnz 2f + # endif + leaq __strncasecmp_sse42(%rip), %rax +diff --git a/sysdeps/x86_64/multiarch/test-multiarch.c b/sysdeps/x86_64/multiarch/test-multiarch.c +new file mode 100644 +index 0000000..76b1af2 +--- /dev/null ++++ b/sysdeps/x86_64/multiarch/test-multiarch.c +@@ -0,0 +1,90 @@ ++/* Test CPU feature data. ++ This file is part of the GNU C Library. ++ Copyright (C) 2012 Free Software Foundation, Inc. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++#include ++ ++static char *cpu_flags; ++ ++/* Search for flags in /proc/cpuinfo and store line ++ in cpu_flags. */ ++void ++get_cpuinfo (void) ++{ ++ FILE *f; ++ char *line = NULL; ++ size_t len = 0; ++ ssize_t read; ++ ++ f = fopen ("/proc/cpuinfo", "r"); ++ if (f == NULL) ++ { ++ printf ("cannot open /proc/cpuinfo"); ++ exit (1); ++ } ++ ++ while ((read = getline (&line, &len, f)) != -1) ++ { ++ if (strncmp (line, "flags", 5) == 0) ++ { ++ cpu_flags = strdup (line); ++ break; ++ } ++ } ++ fclose (f); ++ free (line); ++} ++ ++int ++check_proc (const char *proc_name, int flag, const char *name) ++{ ++ int found = 0; ++ ++ printf ("Checking %s:\n", name); ++ printf (" init-arch %d\n", flag); ++ if (strstr (cpu_flags, proc_name) != NULL) ++ found = 1; ++ printf (" cpuinfo (%s) %d\n", proc_name, found); ++ ++ if (found != flag) ++ printf (" *** failure ***\n"); ++ ++ return (found != flag); ++} ++ ++static int ++do_test (int argc, char **argv) ++{ ++ int fails; ++ ++ get_cpuinfo (); ++ fails = check_proc ("avx", HAS_AVX, "HAS_AVX"); ++ fails += check_proc ("fma4", HAS_FMA4, "HAS_FMA4"); ++ fails += check_proc ("sse4_2", HAS_SSE4_2, "HAS_SSE4_2"); ++ fails += check_proc ("sse4_1", HAS_SSE4_1, "HAS_SSE4_1"); ++ fails += check_proc ("ssse3", HAS_SSSE3, "HAS_SSSE3"); ++ fails += check_proc ("popcnt", HAS_POPCOUNT, "HAS_POPCOUNT"); ++ ++ printf ("%d differences between /proc/cpuinfo and glibc code.\n", fails); ++ ++ return (fails != 0); ++} ++ ++#include "../../../test-skeleton.c"