sysdep_routines += s_isnan-power7 s_isnan-power6 s_isnan-power5 \
s_isnan-ppc32 \
s_isnanf-power7 s_isnanf-power6 s_isnanf-power5 \
- s_isnanf-ppc32
+ s_isnanf-ppc32 \
+ s_copysign-power6 s_copysign-ppc32
libm-sysdep_routines += s_llrintf-power6 s_llrintf-power4 s_llrintf-c \
s_llrint-power6 s_llrint-power4 s_llrint-c \
s_isnan-power7 s_isnan-power6 s_isnan-power5 \
s_isnan-ppc32 \
s_isnanf-power7 s_isnanf-power6 s_isnanf-power5 \
- s_isnanf-ppc32
+ s_isnanf-ppc32 \
+ s_copysign-power6 s_copysign-ppc32
CFLAGS-s_llround.c = -fno-builtin-llroundf
endif
.section ".text"
.type __copysign, @function
.machine power6
-EALIGN (__copysign, 4, 0)
+EALIGN (__copysign_power6, 4, 0)
CALL_MCOUNT
fcpsgn fp1,fp2,fp1
blr
-END (__copysign)
-
-hidden_def (__copysign)
-weak_alias (__copysign, copysign)
-
-/* It turns out that the 'double' version will also always work for
- single-precision. */
-strong_alias (__copysign, __copysignf)
-hidden_def (__copysignf)
-weak_alias (__copysignf, copysignf)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__copysign, __copysignl)
-weak_alias (__copysign, copysignl)
-#endif
-
-#ifdef IS_IN_libm
-# if LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)
-compat_symbol (libm, copysign, copysignl, GLIBC_2_0)
-# endif
-#else
-# if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
-compat_symbol (libc, copysign, copysignl, GLIBC_2_0);
-# endif
-#endif
+END (__copysign_power6)
--- /dev/null
+/* Multiple versions of s_copysign.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <math.h>
+#include <math_ldbl_opt.h>
+#include <shlib-compat.h>
+#include "init-arch.h"
+
+extern __typeof (__copysign) __copysign_ppc32 attribute_hidden;
+extern __typeof (__copysign) __copysign_power6 attribute_hidden;
+
+libc_ifunc (__copysign,
+ (hwcap & PPC_FEATURE_ARCH_2_05)
+ ? __copysign_power6
+ : __copysign_ppc32);
+
+weak_alias (__copysign, copysign)
+
+/* It's safe to use double-precision implementation for single-precision.
+ The following assembly directives are basically doing:
+ weak_alias (__copysign,copysignf)
+ strong_alias(__copysign,__copysignf)
+ But the compiler will not let us do it in C because both __copysignf and
+ copysignf are already defined. */
+asm (".weak copysignf\n"
+ ".set copysignf, __copysign");
+asm (".globl __copysign\n"
+ "__copysign = __copysignf");
+
+#ifdef NO_LONG_DOUBLE
+weak_alias (__copysign,copysignl)
+strong_alias(__copysign,__copysignl)
+#endif
+#ifdef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __copysign, copysignl, GLIBC_2_0);
+# endif
+#elif LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __copysign, copysignl, GLIBC_2_0);
+#endif