This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GNU C Library master sources". The branch, azanella/multilib-ppc32-v2 has been created at db65d6768a1379d8f2f9c9d7b2e44bf5241d70f0 (commit) - Log ----------------------------------------------------------------- http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=db65d6768a1379d8f2f9c9d7b2e44bf5241d70f0 commit db65d6768a1379d8f2f9c9d7b2e44bf5241d70f0 Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 09:46:41 2013 -0500 PowerPC: __ieee754_hypot/__iee754_hypotf multilib for PowerPC32 diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile index 2fcd4f2..7d13757 100644 --- a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile @@ -26,7 +26,8 @@ libm-sysdep_routines += s_llrintf-power6 s_llrintf-power4 s_llrintf-ppc32 \ s_lrint-ppc32 s_modf-power5+ s_modf-ppc32 \ s_modff-power5+ s_modff-ppc32 s_logbl-power7 \ s_logbl-ppc32 s_logb-power7 s_logb-ppc32 \ - s_logbf-power7 s_logbf-ppc32 + s_logbf-power7 s_logbf-ppc32 e_hypot-power7 \ + e_hypot-ppc32 e_hypotf-power7 e_hypotf-ppc32 CFLAGS-s_llround.c = -fno-builtin-llroundf CFLAGS-s_modf-power5+.c = -mcpu=power5+ @@ -34,4 +35,6 @@ CFLAGS-s_modff-power5+.c = -mcpu=power5+ CFLAGS-s_logbl-power7.c = -mcpu=power7 CFLAGS-s_logb-power7.c = -mcpu=power7 CFLAGS-s_logbf-power7.c = -mcpu=power7 +CFLAGS-e_hypot-power7.c = -mcpu=power7 +CFLAGS-e_hypotf-power7.c = -mcpu=power7 endif diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/e_hypot-power7.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/e_hypot-power7.c new file mode 100644 index 0000000..91a42a2 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/e_hypot-power7.c @@ -0,0 +1,26 @@ +/* __ieee_hypot() POWER7 version. + 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> + +#undef strong_alias +#define strong_alias(a, b) + +#define __ieee754_hypot __ieee754_hypot_power7 + +#include <sysdeps/powerpc/fpu/e_hypot.c> diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/e_hypot-ppc32.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/e_hypot-ppc32.c new file mode 100644 index 0000000..35ae97d --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/e_hypot-ppc32.c @@ -0,0 +1,26 @@ +/* __ieee_hypot() PowerPC32 version. + 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> + +#undef strong_alias +#define strong_alias(a, b) + +#define __ieee754_hypot __ieee754_hypot_ppc32 + +#include <sysdeps/powerpc/fpu/e_hypot.c> diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/e_hypot.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/e_hypot.c new file mode 100644 index 0000000..c179ca2 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/e_hypot.c @@ -0,0 +1,32 @@ +/* Multiple versions of ieee754_hypot. + 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 (__ieee754_hypot) __ieee754_hypot_ppc32 attribute_hidden; +extern __typeof (__ieee754_hypot) __ieee754_hypot_power7 attribute_hidden; + +libc_ifunc (__ieee754_hypot, + (hwcap & PPC_FEATURE_ARCH_2_06) + ? __ieee754_hypot_power7 + : __ieee754_hypot_ppc32); + +strong_alias (__ieee754_hypot, __hypot_finite) diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/e_hypotf-power7.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/e_hypotf-power7.c new file mode 100644 index 0000000..64cba4e --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/e_hypotf-power7.c @@ -0,0 +1,26 @@ +/* __ieee754_hypot POWER7 version. + 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> + +#undef strong_alias +#define strong_alias(a, b) + +#define __ieee754_hypotf __ieee754_hypotf_power7 + +#include <sysdeps/powerpc/fpu/e_hypotf.c> diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/e_hypotf-ppc32.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/e_hypotf-ppc32.c new file mode 100644 index 0000000..9a52322 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/e_hypotf-ppc32.c @@ -0,0 +1,26 @@ +/* __ieee_hypot() PowerPC32 version. + 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> + +#undef strong_alias +#define strong_alias(a, b) + +#define __ieee754_hypotf __ieee754_hypotf_ppc32 + +#include <sysdeps/ieee754/flt-32/e_hypotf.c> diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/e_hypotf.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/e_hypotf.c new file mode 100644 index 0000000..d5c61cd --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/e_hypotf.c @@ -0,0 +1,32 @@ +/* Multiple versions of ieee754_hypotf. + 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 (__ieee754_hypotf) __ieee754_hypotf_ppc32 attribute_hidden; +extern __typeof (__ieee754_hypotf) __ieee754_hypotf_power7 attribute_hidden; + +libc_ifunc (__ieee754_hypotf, + (hwcap & PPC_FEATURE_ARCH_2_06) + ? __ieee754_hypotf_power7 + : __ieee754_hypotf_ppc32); + +strong_alias (__ieee754_hypotf, __hypotf_finite) http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=731e24e8df5447a9aa423dec445130e953c16b14 commit 731e24e8df5447a9aa423dec445130e953c16b14 Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 09:22:01 2013 -0500 PowerPC: logb/logbf/logbl multilib for PowerPC32 diff --git a/sysdeps/ieee754/ldbl-128ibm/s_logbl.c b/sysdeps/ieee754/ldbl-128ibm/s_logbl.c index 6cbfcfa..b205680 100644 --- a/sysdeps/ieee754/ldbl-128ibm/s_logbl.c +++ b/sysdeps/ieee754/ldbl-128ibm/s_logbl.c @@ -43,5 +43,6 @@ __logbl (long double x) } return (long double) (rhx - 1023); } - +#ifndef __logbl long_double_symbol (libm, __logbl, logbl); +#endif diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_logb.c b/sysdeps/powerpc/power7/fpu/s_logb.c similarity index 100% rename from sysdeps/powerpc/powerpc32/power7/fpu/s_logb.c rename to sysdeps/powerpc/power7/fpu/s_logb.c diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_logbf.c b/sysdeps/powerpc/power7/fpu/s_logbf.c similarity index 98% rename from sysdeps/powerpc/powerpc32/power7/fpu/s_logbf.c rename to sysdeps/powerpc/power7/fpu/s_logbf.c index 05726f2..f984d14 100644 --- a/sysdeps/powerpc/powerpc32/power7/fpu/s_logbf.c +++ b/sysdeps/powerpc/power7/fpu/s_logbf.c @@ -16,7 +16,7 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include "math_private.h" +#include <math.h> /* This implementation avoids FP to INT conversions by using VSX bitwise instructions over FP values. */ diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c b/sysdeps/powerpc/power7/fpu/s_logbl.c similarity index 96% rename from sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c rename to sysdeps/powerpc/power7/fpu/s_logbl.c index e008ed0..9b4731b 100644 --- a/sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c +++ b/sysdeps/powerpc/power7/fpu/s_logbl.c @@ -58,13 +58,14 @@ __logbl (long double x) { /* POSIX specifies that denormal number is treated as though it were normalized. */ - int64_t lx, hx; + int64_t hx; - GET_LDOUBLE_WORDS64 (hx, lx, x); + GET_LDOUBLE_MSW64 (hx, x); return (long double) (-1023 - (__builtin_clzll (hx) - 12)); } /* Test to avoid logb_downward (0.0) == -0.0. */ return ret == -0.0 ? 0.0 : ret; } - +#ifndef __logbl long_double_symbol (libm, __logbl, logbl); +#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile index 7a6e3fc..2fcd4f2 100644 --- a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile @@ -24,9 +24,14 @@ libm-sysdep_routines += s_llrintf-power6 s_llrintf-power4 s_llrintf-ppc32 \ s_copysign-power6 s_copysign-ppc32 s_lround-power6x \ s_lround-power5+ s_lround-ppc32 s_lrint-power6x \ s_lrint-ppc32 s_modf-power5+ s_modf-ppc32 \ - s_modff-power5+ s_modff-ppc32 + s_modff-power5+ s_modff-ppc32 s_logbl-power7 \ + s_logbl-ppc32 s_logb-power7 s_logb-ppc32 \ + s_logbf-power7 s_logbf-ppc32 CFLAGS-s_llround.c = -fno-builtin-llroundf CFLAGS-s_modf-power5+.c = -mcpu=power5+ CFLAGS-s_modff-power5+.c = -mcpu=power5+ +CFLAGS-s_logbl-power7.c = -mcpu=power7 +CFLAGS-s_logb-power7.c = -mcpu=power7 +CFLAGS-s_logbf-power7.c = -mcpu=power7 endif diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_logb-power7.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_logb-power7.c new file mode 100644 index 0000000..d856431 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_logb-power7.c @@ -0,0 +1,28 @@ +/* logb(). PowerPC32/POWER7 version. + 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> + +#undef weak_alias +#define weak_alias(a, b) +#undef strong_alias +#define strong_alias(a, b) + +#define __logb __logb_power7 + +#include <sysdeps/powerpc/power7/fpu/s_logb.c> diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_logb-ppc32.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_logb-ppc32.c new file mode 100644 index 0000000..9190ec9 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_logb-ppc32.c @@ -0,0 +1,28 @@ +/* logb(). PowerPC32/POWER7 version. + 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> + +#undef weak_alias +#define weak_alias(a, b) +#undef strong_alias +#define strong_alias(a, b) + +#define __logb __logb_ppc32 + +#include <sysdeps/ieee754/dbl-64/s_logb.c> diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_logb.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_logb.c new file mode 100644 index 0000000..c8eaf93 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_logb.c @@ -0,0 +1,41 @@ +/* Multiple versions of logb. + 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 (__logb) __logb_ppc32 attribute_hidden; +extern __typeof (__logb) __logb_power7 attribute_hidden; + +libc_ifunc (__logb, + (hwcap & PPC_FEATURE_ARCH_2_06) + ? __logb_power7 + : __logb_ppc32); + +weak_alias (__logb, logb) + +#ifdef NO_LONG_DOUBLE +strong_alias (__logb, __logbl) +weak_alias (__logb, logbl) +#endif + +#if LONG_DOUBLE_COMPAT (libm, GLIBC_2_0) +compat_symbol (libm, logb, logbl, GLIBC_2_0); +#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_logbf-power7.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_logbf-power7.c new file mode 100644 index 0000000..f454c75 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_logbf-power7.c @@ -0,0 +1,26 @@ +/* logbf(). PowerPC32/POWER7 version. + 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> + +#undef weak_alias +#define weak_alias(a, b) + +#define __logbf __logbf_power7 + +#include <sysdeps/powerpc/power7/fpu/s_logbf.c> diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_logbf-ppc32.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_logbf-ppc32.c new file mode 100644 index 0000000..7d51041 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_logbf-ppc32.c @@ -0,0 +1,26 @@ +/* logbf(). PowerPC32 default implementation. + 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> + +#undef weak_alias +#define weak_alias(a, b) + +#define __logbf __logbf_ppc32 + +#include <sysdeps/ieee754/flt-32/s_logbf.c> diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_logbf.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_logbf.c new file mode 100644 index 0000000..cf66af4 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_logbf.c @@ -0,0 +1,32 @@ +/* Multiple versions of logbf. + 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 (__logbf) __logbf_ppc32 attribute_hidden; +extern __typeof (__logbf) __logbf_power7 attribute_hidden; + +libc_ifunc (__logbf, + (hwcap & PPC_FEATURE_ARCH_2_06) + ? __logbf_power7 + : __logbf_ppc32); + +weak_alias (__logbf, logbf) diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_logbl-power7.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_logbl-power7.c new file mode 100644 index 0000000..b5adcd2 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_logbl-power7.c @@ -0,0 +1,21 @@ +/* logbl(). PowerPC32/POWER7 version. + 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/>. */ + +#define __logbl __logbl_power7 + +#include <sysdeps/powerpc/power7/fpu/s_logbl.c> diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_logbl-ppc32.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_logbl-ppc32.c new file mode 100644 index 0000000..3308957 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_logbl-ppc32.c @@ -0,0 +1,21 @@ +/* logbl(). PowerPC32/POWER7 version. + Copyright (C) 2012-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/>. */ + +#define __logbl __logbl_ppc32 + +#include <sysdeps/ieee754/ldbl-128ibm/s_logbl.c> diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_logbl.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_logbl.c new file mode 100644 index 0000000..acc6700 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_logbl.c @@ -0,0 +1,32 @@ +/* Multiple versions of logbl. + 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 (__logbl) __logbl_ppc32 attribute_hidden; +extern __typeof (__logbl) __logbl_power7 attribute_hidden; + +libc_ifunc (__logbl, + (hwcap & PPC_FEATURE_ARCH_2_06) + ? __logbl_power7 + : __logbl_ppc32); + +long_double_symbol (libm, __logbl, logbl); diff --git a/sysdeps/powerpc/powerpc64/power7/fpu/s_logb.c b/sysdeps/powerpc/powerpc64/power7/fpu/s_logb.c index ff3a9e0..2599c77 100644 --- a/sysdeps/powerpc/powerpc64/power7/fpu/s_logb.c +++ b/sysdeps/powerpc/powerpc64/power7/fpu/s_logb.c @@ -1 +1 @@ -#include <sysdeps/powerpc/powerpc32/power7/fpu/s_logb.c> +#include <sysdeps/powerpc/power7/fpu/s_logb.c> diff --git a/sysdeps/powerpc/powerpc64/power7/fpu/s_logbf.c b/sysdeps/powerpc/powerpc64/power7/fpu/s_logbf.c index e79a28f..7a5a803 100644 --- a/sysdeps/powerpc/powerpc64/power7/fpu/s_logbf.c +++ b/sysdeps/powerpc/powerpc64/power7/fpu/s_logbf.c @@ -1 +1 @@ -#include <sysdeps/powerpc/powerpc32/power7/fpu/s_logbf.c> +#include <sysdeps/powerpc/power7/fpu/s_logbf.c> diff --git a/sysdeps/powerpc/powerpc64/power7/fpu/s_logbl.c b/sysdeps/powerpc/powerpc64/power7/fpu/s_logbl.c index 463e411..524ae2c 100644 --- a/sysdeps/powerpc/powerpc64/power7/fpu/s_logbl.c +++ b/sysdeps/powerpc/powerpc64/power7/fpu/s_logbl.c @@ -1 +1 @@ -#include <sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c> +#include <sysdeps/powerpc/power7/fpu/s_logbl.c> http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=2ac2dcbf75a3a2903935b3bfb995435755720a1f commit 2ac2dcbf75a3a2903935b3bfb995435755720a1f Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 09:20:50 2013 -0500 PowerPC: modf/modff multilib for PowerPC32 diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile index cba3170..7a6e3fc 100644 --- a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile @@ -3,7 +3,8 @@ sysdep_routines += s_isnan-power7 s_isnan-power6 s_isnan-power5 s_isnan-ppc32 \ s_isnanf-power6 s_isnanf-power5 s_isnanf-ppc32 \ s_isinf-power7 s_isinf-ppc32 s_isinff-ppc32 \ s_finite-power7 s_finite-ppc32 s_finitef-ppc32 \ - s_copysign-power6 s_copysign-ppc32 + s_copysign-power6 s_copysign-ppc32 s_modf-power5+ \ + s_modf-ppc32 s_modff-power5+ s_modff-ppc32 libm-sysdep_routines += s_llrintf-power6 s_llrintf-power4 s_llrintf-ppc32 \ s_llrint-power6 s_llrint-power4 s_llrint-ppc32 \ @@ -22,7 +23,10 @@ libm-sysdep_routines += s_llrintf-power6 s_llrintf-power4 s_llrintf-ppc32 \ s_trunc-ppc32 s_truncf-power5+ s_truncf-ppc32 \ s_copysign-power6 s_copysign-ppc32 s_lround-power6x \ s_lround-power5+ s_lround-ppc32 s_lrint-power6x \ - s_lrint-ppc32 + s_lrint-ppc32 s_modf-power5+ s_modf-ppc32 \ + s_modff-power5+ s_modff-ppc32 CFLAGS-s_llround.c = -fno-builtin-llroundf +CFLAGS-s_modf-power5+.c = -mcpu=power5+ +CFLAGS-s_modff-power5+.c = -mcpu=power5+ endif diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_modf-power5+.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_modf-power5+.c new file mode 100644 index 0000000..ec0b42c --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_modf-power5+.c @@ -0,0 +1,31 @@ +/* PowerPC/POWER5+ implementation for modf. + 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> + +#undef weak_alias +#define weak_alias(a,b) +#undef strong_alias +#define strong_alias(a,b) +#undef compat_symbol +#define compat_symbol(a,b,c,d) + +#define __modf __modf_power5plus + +#include <sysdeps/powerpc/power5+/fpu/s_modf.c> diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_modf-ppc32.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_modf-ppc32.c new file mode 100644 index 0000000..666bf66 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_modf-ppc32.c @@ -0,0 +1,29 @@ +/* PowerPC32 default implementation for modf. + 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> + +#undef weak_alias +#define weak_alias(a,b) +#undef strong_alias +#define strong_alias(a,b) + +#define __modf __modf_ppc32 + +#include <sysdeps/ieee754/dbl-64/s_modf.c> diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_modf.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_modf.c new file mode 100644 index 0000000..3f98083 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_modf.c @@ -0,0 +1,44 @@ +/* Multiple versions of modf. + 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 (__modf) __modf_ppc32 attribute_hidden; +extern __typeof (__modf) __modf_power5plus attribute_hidden; + +libc_ifunc (__modf, + (hwcap & PPC_FEATURE_POWER5_PLUS) + ? __modf_power5plus + : __modf_ppc32); + +weak_alias (__modf, modf) + +#ifdef NO_LONG_DOUBLE +strong_alias (__modf, __modfl) +weak_alias (__modf, modfl) +#endif +#ifdef IS_IN_libm +# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) +compat_symbol (libm, __modf, modfl, GLIBC_2_0); +# endif +#elif LONG_DOUBLE_COMPAT(libc, GLIBC_2_0) +compat_symbol (libc, __modf, modfl, GLIBC_2_0); +#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_modff-power5+.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_modff-power5+.c new file mode 100644 index 0000000..e729a38 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_modff-power5+.c @@ -0,0 +1,27 @@ +/* PowerPC/POWER5+ implementation for modff. + 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> + +#undef weak_alias +#define weak_alias(a,b) + +#define __modff __modff_power5plus + +#include <sysdeps/powerpc/power5+/fpu/s_modff.c> diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_modff-ppc32.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_modff-ppc32.c new file mode 100644 index 0000000..08476b4 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_modff-ppc32.c @@ -0,0 +1,26 @@ +/* PowerPC32 default implementation for modff. + 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> + +#undef weak_alias +#define weak_alias(a,b) + +#define __modff __modff_ppc32 + +#include <sysdeps/ieee754/flt-32/s_modff.c> diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_modff.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_modff.c new file mode 100644 index 0000000..0e591ba --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_modff.c @@ -0,0 +1,30 @@ +/* Multiple versions of modff. + 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 "init-arch.h" + +extern __typeof (__modff) __modff_ppc32 attribute_hidden; +extern __typeof (__modff) __modff_power5plus attribute_hidden; + +libc_ifunc (__modff, + (hwcap & PPC_FEATURE_POWER5_PLUS) + ? __modff_power5plus + : __modff_ppc32); + +weak_alias (__modff, modff) http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=e8dd09272f06d08370e33b71b4bea8a2862961ed commit e8dd09272f06d08370e33b71b4bea8a2862961ed Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 09:19:56 2013 -0500 PowerPC: lrint/lrintf multilib for PowerPC32 diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile index a9b2fc3..cba3170 100644 --- a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile @@ -21,7 +21,8 @@ libm-sysdep_routines += s_llrintf-power6 s_llrintf-power4 s_llrintf-ppc32 \ s_roundf-power5+ s_roundf-ppc32 s_trunc-power5+ \ s_trunc-ppc32 s_truncf-power5+ s_truncf-ppc32 \ s_copysign-power6 s_copysign-ppc32 s_lround-power6x \ - s_lround-power5+ s_lround-ppc32 + s_lround-power5+ s_lround-ppc32 s_lrint-power6x \ + s_lrint-ppc32 CFLAGS-s_llround.c = -fno-builtin-llroundf endif diff --git a/sysdeps/powerpc/powerpc32/power6x/fpu/s_lrint.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_lrint-power6x.S similarity index 76% copy from sysdeps/powerpc/powerpc32/power6x/fpu/s_lrint.S copy to sysdeps/powerpc/powerpc32/fpu/multiarch/s_lrint-power6x.S index d0cc159..f752895 100644 --- a/sysdeps/powerpc/powerpc32/power6x/fpu/s_lrint.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_lrint-power6x.S @@ -21,21 +21,8 @@ .machine "power6" /* long int[r3] __lrint (double x[fp1]) */ -ENTRY (__lrint) +ENTRY (__lrint_power6x) fctiw fp13,fp1 mftgpr r3,fp13 blr - END (__lrint) - -weak_alias (__lrint, lrint) - -strong_alias (__lrint, __lrintf) -weak_alias (__lrint, lrintf) - -#ifdef NO_LONG_DOUBLE -strong_alias (__lrint, __lrintl) -weak_alias (__lrint, lrintl) -#endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __lrint, lrintl, GLIBC_2_1) -#endif +END (__lrint_power6x) diff --git a/sysdeps/powerpc/powerpc32/power6x/fpu/s_lrint.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_lrint-ppc32.S similarity index 59% copy from sysdeps/powerpc/powerpc32/power6x/fpu/s_lrint.S copy to sysdeps/powerpc/powerpc32/fpu/multiarch/s_lrint-ppc32.S index d0cc159..bdece6f 100644 --- a/sysdeps/powerpc/powerpc32/power6x/fpu/s_lrint.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_lrint-ppc32.S @@ -1,5 +1,5 @@ -/* Round double to long int. POWER6x PowerPC32 version. - Copyright (C) 2006-2013 Free Software Foundation, Inc. +/* Round double to long int. PowerPC32 default version. + 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 @@ -19,23 +19,13 @@ #include <sysdep.h> #include <math_ldbl_opt.h> - .machine "power6" -/* long int[r3] __lrint (double x[fp1]) */ -ENTRY (__lrint) - fctiw fp13,fp1 - mftgpr r3,fp13 - blr - END (__lrint) +#undef weak_alias +#define weak_alias(a,b) +#undef strong_alias +#define strong_alias(a,b) +#undef compat_symbol +#define compat_symbol(a,b,c,d) -weak_alias (__lrint, lrint) +#define __lrint __lrint_ppc32 -strong_alias (__lrint, __lrintf) -weak_alias (__lrint, lrintf) - -#ifdef NO_LONG_DOUBLE -strong_alias (__lrint, __lrintl) -weak_alias (__lrint, lrintl) -#endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __lrint, lrintl, GLIBC_2_1) -#endif +#include <sysdeps/powerpc/powerpc32/fpu/s_lrint.S> diff --git a/sysdeps/powerpc/powerpc32/power6x/fpu/s_lrint.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_lrint.c similarity index 68% copy from sysdeps/powerpc/powerpc32/power6x/fpu/s_lrint.S copy to sysdeps/powerpc/powerpc32/fpu/multiarch/s_lrint.c index d0cc159..03cf83e 100644 --- a/sysdeps/powerpc/powerpc32/power6x/fpu/s_lrint.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_lrint.c @@ -1,5 +1,5 @@ -/* Round double to long int. POWER6x PowerPC32 version. - Copyright (C) 2006-2013 Free Software Foundation, Inc. +/* Multiple versions of lrint. + 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 @@ -16,26 +16,25 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> +#include <math.h> #include <math_ldbl_opt.h> +#include <shlib-compat.h> +#include "init-arch.h" - .machine "power6" -/* long int[r3] __lrint (double x[fp1]) */ -ENTRY (__lrint) - fctiw fp13,fp1 - mftgpr r3,fp13 - blr - END (__lrint) +extern __typeof (__lrint) __lrint_ppc32 attribute_hidden; +extern __typeof (__lrint) __lrint_power6x attribute_hidden; -weak_alias (__lrint, lrint) +libc_ifunc (__lrint, + (hwcap & PPC_FEATURE_POWER6_EXT) ? + __lrint_power6x + : __lrint_ppc32); -strong_alias (__lrint, __lrintf) -weak_alias (__lrint, lrintf) +weak_alias (__lrint, lrint) #ifdef NO_LONG_DOUBLE -strong_alias (__lrint, __lrintl) weak_alias (__lrint, lrintl) +strong_alias (__lrint, __lrintl) #endif #if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __lrint, lrintl, GLIBC_2_1) +compat_symbol (libm, __lrint, lrintl, GLIBC_2_1); #endif diff --git a/sysdeps/powerpc/powerpc32/power6x/fpu/s_lrint.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_lrintf.c similarity index 56% rename from sysdeps/powerpc/powerpc32/power6x/fpu/s_lrint.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_lrintf.c index d0cc159..350c8b9 100644 --- a/sysdeps/powerpc/powerpc32/power6x/fpu/s_lrint.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_lrintf.c @@ -1,5 +1,5 @@ -/* Round double to long int. POWER6x PowerPC32 version. - Copyright (C) 2006-2013 Free Software Foundation, Inc. +/* Multiple versions of lrintf. + 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 @@ -16,26 +16,16 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> -#include <math_ldbl_opt.h> +#include <math.h> +#include "init-arch.h" - .machine "power6" -/* long int[r3] __lrint (double x[fp1]) */ -ENTRY (__lrint) - fctiw fp13,fp1 - mftgpr r3,fp13 - blr - END (__lrint) +/* It's safe to use double-precision implementation for single-precision. */ +extern __typeof (__lrint) __lrint_ppc32 attribute_hidden; +extern __typeof (__lrint) __lrint_power6x attribute_hidden; -weak_alias (__lrint, lrint) +libc_ifunc (__lrintf, + (hwcap & PPC_FEATURE_POWER6_EXT) ? + __lrint_power6x + : __lrint_ppc32); -strong_alias (__lrint, __lrintf) -weak_alias (__lrint, lrintf) - -#ifdef NO_LONG_DOUBLE -strong_alias (__lrint, __lrintl) -weak_alias (__lrint, lrintl) -#endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __lrint, lrintl, GLIBC_2_1) -#endif +weak_alias (__lrintf, lrintf) http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=069ec9bc73216aa7e97559e5c22fc4754a13462e commit 069ec9bc73216aa7e97559e5c22fc4754a13462e Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 09:18:58 2013 -0500 PowerPC: lround/lrounf multilib for PowerPC32 diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile index afe1210..a9b2fc3 100644 --- a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile @@ -20,7 +20,8 @@ libm-sysdep_routines += s_llrintf-power6 s_llrintf-power4 s_llrintf-ppc32 \ s_floorf-ppc32 s_round-power5+ s_round-ppc32 \ s_roundf-power5+ s_roundf-ppc32 s_trunc-power5+ \ s_trunc-ppc32 s_truncf-power5+ s_truncf-ppc32 \ - s_copysign-power6 s_copysign-ppc32 + s_copysign-power6 s_copysign-ppc32 s_lround-power6x \ + s_lround-power5+ s_lround-ppc32 CFLAGS-s_llround.c = -fno-builtin-llroundf endif diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_lround-power5+.S similarity index 83% rename from sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_lround-power5+.S index 0fa359d..5e664be 100644 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_lround-power5+.S @@ -15,21 +15,22 @@ 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 <sysdep.h> #include <math_ldbl_opt.h> - + /* long [r3] lround (float x [fp1]) - IEEE 1003.1 lround function. IEEE specifies "round to the nearest + IEEE 1003.1 lround function. IEEE specifies "round to the nearest integer value, rounding halfway cases away from zero, regardless of the current rounding mode." However PowerPC Architecture defines - "round to Nearest" as "Choose the best approximation. In case of a - tie, choose the one that is even (least significant bit o).". + "round to Nearest" as "Choose the best approximation. In case of a + tie, choose the one that is even (least significant bit o).". So we pre-round using the V2.02 Floating Round to Integer Nearest instruction before we use the Floating Convert to Integer Word with round to zero instruction. */ .machine "power5" -ENTRY (__lround) +ENTRY (__lround_power5plus) stwu r1,-16(r1) cfi_adjust_cfa_offset (16) frin fp2,fp1 @@ -41,17 +42,4 @@ ENTRY (__lround) lwz r3,12(r1) addi r1,r1,16 blr - END (__lround) - -weak_alias (__lround, lround) - -strong_alias (__lround, __lroundf) -weak_alias (__lround, lroundf) - -#ifdef NO_LONG_DOUBLE -weak_alias (__lround, lroundl) -strong_alias (__lround, __lroundl) -#endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __lround, lroundl, GLIBC_2_1) -#endif +END (__lround_power5plus) diff --git a/sysdeps/powerpc/powerpc32/power6x/fpu/s_lround.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_lround-power6x.S similarity index 82% rename from sysdeps/powerpc/powerpc32/power6x/fpu/s_lround.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_lround-power6x.S index 950b695..49c5a71 100644 --- a/sysdeps/powerpc/powerpc32/power6x/fpu/s_lround.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_lround-power6x.S @@ -18,34 +18,21 @@ #include <sysdep.h> #include <math_ldbl_opt.h> - + /* long [r3] lround (float x [fp1]) - IEEE 1003.1 lround function. IEEE specifies "round to the nearest + IEEE 1003.1 lround function. IEEE specifies "round to the nearest integer value, rounding halfway cases away from zero, regardless of the current rounding mode." However PowerPC Architecture defines - "round to Nearest" as "Choose the best approximation. In case of a - tie, choose the one that is even (least significant bit o).". + "round to Nearest" as "Choose the best approximation. In case of a + tie, choose the one that is even (least significant bit o).". So we pre-round using the V2.02 Floating Round to Integer Nearest instruction before we use the Floating Convert to Integer Word with round to zero instruction. */ .machine "power6" -ENTRY (__lround) +ENTRY (__lround_power6x) frin fp2,fp1 /* Pre-round +-0.5. */ fctiwz fp3,fp2 /* Convert To Integer Word lround toward 0. */ mftgpr r3,fp3 /* Transfer fpr3 to r3. */ blr - END (__lround) - -weak_alias (__lround, lround) - -strong_alias (__lround, __lroundf) -weak_alias (__lround, lroundf) - -#ifdef NO_LONG_DOUBLE -weak_alias (__lround, lroundl) -strong_alias (__lround, __lroundl) -#endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __lround, lroundl, GLIBC_2_1) -#endif +END (__lround_power6x) diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_lround-ppc32.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_lround-ppc32.S new file mode 100644 index 0000000..8124cd7 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_lround-ppc32.S @@ -0,0 +1,31 @@ +/* lround function. PowerPC32 default version. + 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 <sysdep.h> +#include <math_ldbl_opt.h> + +#undef weak_alias +#define weak_alias(a,b) +#undef strong_alias +#define strong_alias(a,b) +#undef compat_symbol +#define compat_symbol(a,b,c,d) + +#define __lround __lround_ppc32 + +#include <sysdeps/powerpc/powerpc32/fpu/s_lround.S> diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_lround.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_lround.c new file mode 100644 index 0000000..f21a7e8 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_lround.c @@ -0,0 +1,43 @@ +/* Multiple versions of lround. + 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 (__lround) __lround_ppc32 attribute_hidden; +extern __typeof (__lround) __lround_power5plus attribute_hidden; +extern __typeof (__lround) __lround_power6x attribute_hidden; + +libc_ifunc (__lround, + (hwcap & PPC_FEATURE_POWER6_EXT) ? + __lround_power6x + : (hwcap & PPC_FEATURE_POWER5_PLUS) ? + __lround_power5plus + : __lround_ppc32); + +weak_alias (__lround, lround) + +#ifdef NO_LONG_DOUBLE +weak_alias (__lround, lroundl) +strong_alias (__lround, __lroundl) +#endif +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) +compat_symbol (libm, __lround, lroundl, GLIBC_2_1); +#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_lroundf.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_lroundf.c new file mode 100644 index 0000000..9a42330 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_lroundf.c @@ -0,0 +1,34 @@ +/* Multiple versions of lroundf. + 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 "init-arch.h" + +/* It's safe to use double-precision implementation for single-precision. */ +extern __typeof (__lround) __lround_ppc32 attribute_hidden; +extern __typeof (__lround) __lround_power5plus attribute_hidden; +extern __typeof (__lround) __lround_power6x attribute_hidden; + +libc_ifunc (__lroundf, + (hwcap & PPC_FEATURE_POWER6_EXT) ? + __lround_power6x + : (hwcap & PPC_FEATURE_POWER5_PLUS) ? + __lround_power5plus + : __lround_ppc32); + +weak_alias (__lroundf, lroundf) http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=23d551c41e349ea2df2deffce7e5004f2dcfba4c commit 23d551c41e349ea2df2deffce7e5004f2dcfba4c Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 09:18:11 2013 -0500 PowerPC: copysign/copysignf multilib for PowerPC32 diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile index d7850a1..afe1210 100644 --- a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile @@ -2,7 +2,8 @@ ifeq ($(subdir),math) sysdep_routines += s_isnan-power7 s_isnan-power6 s_isnan-power5 s_isnan-ppc32 \ s_isnanf-power6 s_isnanf-power5 s_isnanf-ppc32 \ s_isinf-power7 s_isinf-ppc32 s_isinff-ppc32 \ - s_finite-power7 s_finite-ppc32 s_finitef-ppc32 + s_finite-power7 s_finite-ppc32 s_finitef-ppc32 \ + s_copysign-power6 s_copysign-ppc32 libm-sysdep_routines += s_llrintf-power6 s_llrintf-power4 s_llrintf-ppc32 \ s_llrint-power6 s_llrint-power4 s_llrint-ppc32 \ @@ -18,7 +19,8 @@ libm-sysdep_routines += s_llrintf-power6 s_llrintf-power4 s_llrintf-ppc32 \ s_floor-power5+ s_floor-ppc32 s_floorf-power5+ \ s_floorf-ppc32 s_round-power5+ s_round-ppc32 \ s_roundf-power5+ s_roundf-ppc32 s_trunc-power5+ \ - s_trunc-ppc32 s_truncf-power5+ s_truncf-ppc32 + s_trunc-ppc32 s_truncf-power5+ s_truncf-ppc32 \ + s_copysign-power6 s_copysign-ppc32 CFLAGS-s_llround.c = -fno-builtin-llroundf endif diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_copysign.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_copysign-power6.S similarity index 65% rename from sysdeps/powerpc/powerpc32/power6/fpu/s_copysign.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_copysign-power6.S index 1b8d73a..7aa28e1 100644 --- a/sysdeps/powerpc/powerpc32/power6/fpu/s_copysign.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_copysign-power6.S @@ -27,32 +27,8 @@ .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) diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_copysign-ppc32.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_copysign-ppc32.S new file mode 100644 index 0000000..41af555 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_copysign-ppc32.S @@ -0,0 +1,35 @@ +/* copysign(). PowerPC32 default version. + Copyright (C) 2010-2013 Free Software Foundation, Inc. + Contributed by Luis Machado <luisgpm@br.ibm.com>. + 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 <sysdep.h> +#include <math_ldbl_opt.h> + +#undef weak_alias +#define weak_alias(a,b) +#unded strong_alias +#define strong_alias(a,b) +#undef compat_symbol +#define compat_symbol(a, b, c, d) + +#define __copysign __copysign_ppc32 +#undef hidden_def +#define hidden_def(name) + strong_alias (__copysign_ppc32, __GI___copysign) + +#include <sysdeps/powerpc/powerpc32/fpu/s_copysign.S> diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_copysign.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_copysign.c new file mode 100644 index 0000000..a4b5239 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_copysign.c @@ -0,0 +1,51 @@ +/* Multiple versions of 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/>. */ + +/* Redefine copysign so that the compiler won't complain about the type + mismatch with the IFUNC selector in strong_alias below. */ +#undef __copysign +#define __copysign __redirect_copysign +#include <math.h> +#include <math_ldbl_opt.h> +#undef __copysign +#include <shlib-compat.h> +#include "init-arch.h" + +extern __typeof (__redirect_copysign) __copysign_ppc32 attribute_hidden; +extern __typeof (__redirect_copysign) __copysign_power6 attribute_hidden; + +extern __typeof (__redirect_copysign) __libm_copysign; +libc_ifunc (__libm_copysign, + (hwcap & PPC_FEATURE_ARCH_2_05) + ? __copysign_power6 + : __copysign_ppc32); + +strong_alias (__libm_copysign, __copysign) +weak_alias (__copysign, copysign) + +#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 diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_copysignf.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_copysignf.c new file mode 100644 index 0000000..1304d66 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_copysignf.c @@ -0,0 +1,32 @@ +/* Multiple versions of copysignf. + 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 <shlib-compat.h> +#include "init-arch.h" + +/* It's safe to use double-precision implementation for single-precision. */ +extern __typeof (__copysign) __copysign_ppc32 attribute_hidden; +extern __typeof (__copysign) __copysign_power6 attribute_hidden; + +libc_ifunc (__copysignf, + (hwcap & PPC_FEATURE_ARCH_2_05) + ? __copysign_power6 + : __copysign_ppc32); + +weak_alias (__copysignf, copysignf) diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_copysignf.S b/sysdeps/powerpc/powerpc32/power6/fpu/s_copysignf.S deleted file mode 100644 index d4aa702..0000000 --- a/sysdeps/powerpc/powerpc32/power6/fpu/s_copysignf.S +++ /dev/null @@ -1 +0,0 @@ -/* This function uses the same code as s_copysign.S. */ http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ac78a47129ef7483d6399d67de2282bb28715389 commit ac78a47129ef7483d6399d67de2282bb28715389 Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 09:17:15 2013 -0500 PowerPC: trunc/truncf multilib for PowerPC32 diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile index 54a3e39..d7850a1 100644 --- a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile @@ -17,7 +17,8 @@ libm-sysdep_routines += s_llrintf-power6 s_llrintf-power4 s_llrintf-ppc32 \ s_ceil-ppc32 s_ceilf-power5+ s_ceilf-ppc32 \ s_floor-power5+ s_floor-ppc32 s_floorf-power5+ \ s_floorf-ppc32 s_round-power5+ s_round-ppc32 \ - s_roundf-power5+ s_roundf-ppc32 + s_roundf-power5+ s_roundf-ppc32 s_trunc-power5+ \ + s_trunc-ppc32 s_truncf-power5+ s_truncf-ppc32 CFLAGS-s_llround.c = -fno-builtin-llroundf endif diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_trunc-power5+.S similarity index 78% copy from sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S copy to sysdeps/powerpc/powerpc32/fpu/multiarch/s_trunc-power5+.S index 2d4ec5a..d9fc987 100644 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_trunc-power5+.S @@ -20,17 +20,7 @@ #include <math_ldbl_opt.h> .machine "power5" -EALIGN (__trunc, 4, 0) +EALIGN (__trunc_power5plus, 4, 0) friz fp1, fp1 blr - END (__trunc) - -weak_alias (__trunc, trunc) - -#ifdef NO_LONG_DOUBLE -weak_alias (__trunc, truncl) -strong_alias (__trunc, __truncl) -#endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __trunc, truncl, GLIBC_2_1) -#endif +END (__trunc_power5plus) diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_trunc-ppc32.S similarity index 68% copy from sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S copy to sysdeps/powerpc/powerpc32/fpu/multiarch/s_trunc-ppc32.S index 0ca5b5c..541b4ed 100644 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_trunc-ppc32.S @@ -1,5 +1,5 @@ -/* truncf function. PowerPC32/power5+ version. - Copyright (C) 2006-2013 Free Software Foundation, Inc. +/* trunc function. PowerPC32 default version. + 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 @@ -17,13 +17,15 @@ <http://www.gnu.org/licenses/>. */ #include <sysdep.h> +#include <math_ldbl_opt.h> - .machine "power5" -EALIGN (__truncf, 4, 0) - friz fp1, fp1 /* The rounding instructions are double. */ - frsp fp1, fp1 /* But we need to set ooverflow for float. */ - blr - END (__truncf) +#undef weak_alias +#define weak_alias(a,b) +#undef strong_alias +#define strong_alias(a,b) +#undef compat_symbol +#define compat_symbol(a,b,c,d) -weak_alias (__truncf, truncf) +#define __trunc __trunc_ppc32 +#include <sysdeps/powerpc/powerpc32/fpu/s_trunc.S> diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_trunc.c similarity index 67% rename from sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_trunc.c index 2d4ec5a..1fdef37 100644 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_trunc.c @@ -1,5 +1,5 @@ -/* trunc function. PowerPC32/power5+ version. - Copyright (C) 2006-2013 Free Software Foundation, Inc. +/* Multiple versions of trunc. + 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 @@ -16,21 +16,25 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> +#include <math.h> #include <math_ldbl_opt.h> +#include <shlib-compat.h> +#include "init-arch.h" - .machine "power5" -EALIGN (__trunc, 4, 0) - friz fp1, fp1 - blr - END (__trunc) +extern __typeof (__trunc) __trunc_ppc32 attribute_hidden; +extern __typeof (__trunc) __trunc_power5plus attribute_hidden; + +libc_ifunc (__trunc, + (hwcap & PPC_FEATURE_POWER5_PLUS) + ? __trunc_power5plus + : __trunc_ppc32); weak_alias (__trunc, trunc) #ifdef NO_LONG_DOUBLE -weak_alias (__trunc, truncl) strong_alias (__trunc, __truncl) +weak_alias (__trunc, truncl) #endif #if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __trunc, truncl, GLIBC_2_1) +compat_symbol (libm, __trunc, truncl, GLIBC_2_1); #endif diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_truncf-power5+.S similarity index 87% copy from sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S copy to sysdeps/powerpc/powerpc32/fpu/multiarch/s_truncf-power5+.S index 0ca5b5c..35cd65a 100644 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_truncf-power5+.S @@ -19,11 +19,8 @@ #include <sysdep.h> .machine "power5" -EALIGN (__truncf, 4, 0) +EALIGN (__truncf_power5plus, 4, 0) friz fp1, fp1 /* The rounding instructions are double. */ - frsp fp1, fp1 /* But we need to set ooverflow for float. */ + frsp fp1, fp1 /* But we need to set overflow for float. */ blr - END (__truncf) - -weak_alias (__truncf, truncf) - +END (__truncf_power5plus) diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_truncf-ppc32.S similarity index 70% copy from sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S copy to sysdeps/powerpc/powerpc32/fpu/multiarch/s_truncf-ppc32.S index 0ca5b5c..a83f413 100644 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_truncf-ppc32.S @@ -1,5 +1,5 @@ -/* truncf function. PowerPC32/power5+ version. - Copyright (C) 2006-2013 Free Software Foundation, Inc. +/* truncf function. PowerPC32 default version. + 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 @@ -17,13 +17,11 @@ <http://www.gnu.org/licenses/>. */ #include <sysdep.h> +#include <math_ldbl_opt.h> - .machine "power5" -EALIGN (__truncf, 4, 0) - friz fp1, fp1 /* The rounding instructions are double. */ - frsp fp1, fp1 /* But we need to set ooverflow for float. */ - blr - END (__truncf) +#undef weak_alias +#define weak_alias(a,b) -weak_alias (__truncf, truncf) +#define __truncf __truncf_ppc32 +#include <sysdeps/powerpc/powerpc32/fpu/s_truncf.S> diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_truncf.c similarity index 64% rename from sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_truncf.c index 0ca5b5c..779a614 100644 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_truncf.c @@ -1,5 +1,5 @@ -/* truncf function. PowerPC32/power5+ version. - Copyright (C) 2006-2013 Free Software Foundation, Inc. +/* Multiple versions of truncf. + 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 @@ -16,14 +16,17 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> +#include <math.h> +#include <math_ldbl_opt.h> +#include <shlib-compat.h> +#include "init-arch.h" - .machine "power5" -EALIGN (__truncf, 4, 0) - friz fp1, fp1 /* The rounding instructions are double. */ - frsp fp1, fp1 /* But we need to set ooverflow for float. */ - blr - END (__truncf) +extern __typeof (__truncf) __truncf_ppc32 attribute_hidden; +extern __typeof (__truncf) __truncf_power5plus attribute_hidden; -weak_alias (__truncf, truncf) +libc_ifunc (__truncf, + (hwcap & PPC_FEATURE_POWER5_PLUS) + ? __truncf_power5plus + : __truncf_ppc32); +weak_alias (__truncf, truncf) http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=28d1b98ef66ca5a05526158f35b259434bea36c3 commit 28d1b98ef66ca5a05526158f35b259434bea36c3 Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 09:16:13 2013 -0500 PowerPC: round/roundf multilib for PowerPC32 diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile index 63f3807..54a3e39 100644 --- a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile @@ -16,7 +16,8 @@ libm-sysdep_routines += s_llrintf-power6 s_llrintf-power4 s_llrintf-ppc32 \ s_finite-ppc32 s_finitef-ppc32 s_ceil-power5+ \ s_ceil-ppc32 s_ceilf-power5+ s_ceilf-ppc32 \ s_floor-power5+ s_floor-ppc32 s_floorf-power5+ \ - s_floorf-ppc32 + s_floorf-ppc32 s_round-power5+ s_round-ppc32 \ + s_roundf-power5+ s_roundf-ppc32 CFLAGS-s_llround.c = -fno-builtin-llroundf endif diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_round-power5+.S similarity index 78% copy from sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S copy to sysdeps/powerpc/powerpc32/fpu/multiarch/s_round-power5+.S index 3cc72d3..276ba45 100644 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_round-power5+.S @@ -20,17 +20,7 @@ #include <math_ldbl_opt.h> .machine "power5" -EALIGN (__round, 4, 0) +EALIGN (__round_power5plus, 4, 0) frin fp1, fp1 blr - END (__round) - -weak_alias (__round, round) - -#ifdef NO_LONG_DOUBLE -weak_alias (__round, roundl) -strong_alias (__round, __roundl) -#endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __round, roundl, GLIBC_2_1) -#endif +END (__round_power5plus) diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_round-ppc32.S similarity index 68% copy from sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S copy to sysdeps/powerpc/powerpc32/fpu/multiarch/s_round-ppc32.S index 8bd2d0a..889318a 100644 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_round-ppc32.S @@ -1,5 +1,5 @@ -/* roundf function. PowerPC32/power5+ version. - Copyright (C) 2006-2013 Free Software Foundation, Inc. +/* round function. PowerPC32 default version. + 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 @@ -17,13 +17,15 @@ <http://www.gnu.org/licenses/>. */ #include <sysdep.h> +#include <math_ldbl_opt.h> - .machine "power5" -EALIGN (__roundf, 4, 0) - frin fp1, fp1 /* The rounding instructions are double. */ - frsp fp1, fp1 /* But we need to set ooverflow for float. */ - blr - END (__roundf) +#undef weak_alias +#define weak_alias(a,b) +#undef strong_alias +#define strong_alias(a,b) +#undef compat_symbol +#define compat_symbol(a,b,c,d) -weak_alias (__roundf, roundf) +#define __round __round_ppc32 +#include <sysdeps/powerpc/powerpc32/fpu/s_round.S> diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_round.c similarity index 67% rename from sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_round.c index 3cc72d3..c21dfaf 100644 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_round.c @@ -1,5 +1,5 @@ -/* round function. PowerPC32/power5+ version. - Copyright (C) 2006-2013 Free Software Foundation, Inc. +/* Multiple versions of round. + 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 @@ -16,21 +16,25 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> +#include <math.h> #include <math_ldbl_opt.h> +#include <shlib-compat.h> +#include "init-arch.h" - .machine "power5" -EALIGN (__round, 4, 0) - frin fp1, fp1 - blr - END (__round) +extern __typeof (__round) __round_ppc32 attribute_hidden; +extern __typeof (__round) __round_power5plus attribute_hidden; + +libc_ifunc (__round, + (hwcap & PPC_FEATURE_POWER5_PLUS) + ? __round_power5plus + : __round_ppc32); weak_alias (__round, round) #ifdef NO_LONG_DOUBLE -weak_alias (__round, roundl) strong_alias (__round, __roundl) +weak_alias (__round, roundl) #endif #if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __round, roundl, GLIBC_2_1) +compat_symbol (libm, __round, roundl, GLIBC_2_1); #endif diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_roundf-power5+.S similarity index 87% copy from sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S copy to sysdeps/powerpc/powerpc32/fpu/multiarch/s_roundf-power5+.S index 8bd2d0a..644d976 100644 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_roundf-power5+.S @@ -19,11 +19,8 @@ #include <sysdep.h> .machine "power5" -EALIGN (__roundf, 4, 0) +EALIGN (__roundf_power5plus, 4, 0) frin fp1, fp1 /* The rounding instructions are double. */ - frsp fp1, fp1 /* But we need to set ooverflow for float. */ + frsp fp1, fp1 /* But we need to set overflow for float. */ blr - END (__roundf) - -weak_alias (__roundf, roundf) - +END (__roundf_power5plus) diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_roundf-ppc32.S similarity index 70% copy from sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S copy to sysdeps/powerpc/powerpc32/fpu/multiarch/s_roundf-ppc32.S index 8bd2d0a..9787c5c 100644 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_roundf-ppc32.S @@ -1,5 +1,5 @@ -/* roundf function. PowerPC32/power5+ version. - Copyright (C) 2006-2013 Free Software Foundation, Inc. +/* roundf function. PowerPC32 default version. + 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 @@ -17,13 +17,11 @@ <http://www.gnu.org/licenses/>. */ #include <sysdep.h> +#include <math_ldbl_opt.h> - .machine "power5" -EALIGN (__roundf, 4, 0) - frin fp1, fp1 /* The rounding instructions are double. */ - frsp fp1, fp1 /* But we need to set ooverflow for float. */ - blr - END (__roundf) +#undef weak_alias +#define weak_alias(a,b) -weak_alias (__roundf, roundf) +#define __roundf __roundf_ppc32 +#include <sysdeps/powerpc/powerpc32/fpu/s_roundf.S> diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_roundf.c similarity index 64% rename from sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_roundf.c index 8bd2d0a..94e66e1 100644 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_roundf.c @@ -1,5 +1,5 @@ -/* roundf function. PowerPC32/power5+ version. - Copyright (C) 2006-2013 Free Software Foundation, Inc. +/* Multiple versions of roundf. + 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 @@ -16,14 +16,17 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> +#include <math.h> +#include <math_ldbl_opt.h> +#include <shlib-compat.h> +#include "init-arch.h" - .machine "power5" -EALIGN (__roundf, 4, 0) - frin fp1, fp1 /* The rounding instructions are double. */ - frsp fp1, fp1 /* But we need to set ooverflow for float. */ - blr - END (__roundf) +extern __typeof (__roundf) __roundf_ppc32 attribute_hidden; +extern __typeof (__roundf) __roundf_power5plus attribute_hidden; -weak_alias (__roundf, roundf) +libc_ifunc (__roundf, + (hwcap & PPC_FEATURE_POWER5_PLUS) + ? __roundf_power5plus + : __roundf_ppc32); +weak_alias (__roundf, roundf) http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=7747e874b713455997a2e7ca793886c59e6a37bc commit 7747e874b713455997a2e7ca793886c59e6a37bc Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 09:15:35 2013 -0500 PowerPC: floor/floorf multilib for PowerPC32 diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile index 9021e02..63f3807 100644 --- a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile @@ -14,7 +14,9 @@ libm-sysdep_routines += s_llrintf-power6 s_llrintf-power4 s_llrintf-ppc32 \ s_isnanf-power5 s_isnanf-ppc32 s_isinf-power7 \ s_isinf-ppc32 s_isinff-ppc32 s_finite-power7 \ s_finite-ppc32 s_finitef-ppc32 s_ceil-power5+ \ - s_ceil-ppc32 s_ceilf-power5+ s_ceilf-ppc32 + s_ceil-ppc32 s_ceilf-power5+ s_ceilf-ppc32 \ + s_floor-power5+ s_floor-ppc32 s_floorf-power5+ \ + s_floorf-ppc32 CFLAGS-s_llround.c = -fno-builtin-llroundf endif diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_floor.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_floor-power5+.S similarity index 78% copy from sysdeps/powerpc/powerpc32/power5+/fpu/s_floor.S copy to sysdeps/powerpc/powerpc32/fpu/multiarch/s_floor-power5+.S index 215c67c..c9515df 100644 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_floor.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_floor-power5+.S @@ -20,17 +20,7 @@ #include <math_ldbl_opt.h> .machine "power5" -EALIGN (__floor, 4, 0) +EALIGN (__floor_power5plus, 4, 0) frim fp1, fp1 blr - END (__floor) - -weak_alias (__floor, floor) - -#ifdef NO_LONG_DOUBLE -weak_alias (__floor, floorl) -strong_alias (__floor, __floorl) -#endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) -compat_symbol (libm, __floor, floorl, GLIBC_2_0) -#endif +END (__floor_power5plus) diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_floorf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_floor-ppc32.S similarity index 68% copy from sysdeps/powerpc/powerpc32/power5+/fpu/s_floorf.S copy to sysdeps/powerpc/powerpc32/fpu/multiarch/s_floor-ppc32.S index eb228da..bfc6c0b 100644 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_floorf.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_floor-ppc32.S @@ -1,5 +1,5 @@ -/* floorf function. PowerPC32/power5+ version. - Copyright (C) 2006-2013 Free Software Foundation, Inc. +/* floor function. PowerPC32 default version. + 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 @@ -17,13 +17,15 @@ <http://www.gnu.org/licenses/>. */ #include <sysdep.h> +#include <math_ldbl_opt.h> - .machine "power5" -EALIGN (__floorf, 4, 0) - frim fp1, fp1 /* The rounding instructions are double. */ - frsp fp1, fp1 /* But we need to set ooverflow for float. */ - blr - END (__floorf) +#undef weak_alias +#define weak_alias(a,b) +#undef strong_alias +#define strong_alias(a,b) +#undef compat_symbol +#define compat_symbol(a,b,c,d) -weak_alias (__floorf, floorf) +#define __floor __floor_ppc32 +#include <sysdeps/powerpc/powerpc32/fpu/s_floor.S> diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_floor.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_floor.c similarity index 67% rename from sysdeps/powerpc/powerpc32/power5+/fpu/s_floor.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_floor.c index 215c67c..c56e067 100644 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_floor.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_floor.c @@ -1,5 +1,5 @@ -/* floor function. PowerPC32/power5+ version. - Copyright (C) 2006-2013 Free Software Foundation, Inc. +/* Multiple versions of floor. + 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 @@ -16,21 +16,25 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> +#include <math.h> #include <math_ldbl_opt.h> +#include <shlib-compat.h> +#include "init-arch.h" - .machine "power5" -EALIGN (__floor, 4, 0) - frim fp1, fp1 - blr - END (__floor) +extern __typeof (__floor) __floor_ppc32 attribute_hidden; +extern __typeof (__floor) __floor_power5plus attribute_hidden; + +libc_ifunc (__floor, + (hwcap & PPC_FEATURE_POWER5_PLUS) + ? __floor_power5plus + : __floor_ppc32); weak_alias (__floor, floor) #ifdef NO_LONG_DOUBLE -weak_alias (__floor, floorl) strong_alias (__floor, __floorl) +weak_alias (__floor, floorl) #endif #if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) -compat_symbol (libm, __floor, floorl, GLIBC_2_0) +compat_symbol (libm, __floor, floorl, GLIBC_2_0); #endif diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_floorf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_floorf-power5+.S similarity index 93% copy from sysdeps/powerpc/powerpc32/power5+/fpu/s_floorf.S copy to sysdeps/powerpc/powerpc32/fpu/multiarch/s_floorf-power5+.S index eb228da..bece550 100644 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_floorf.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_floorf-power5+.S @@ -19,11 +19,8 @@ #include <sysdep.h> .machine "power5" -EALIGN (__floorf, 4, 0) +EALIGN (__floorf_power5plus, 4, 0) frim fp1, fp1 /* The rounding instructions are double. */ frsp fp1, fp1 /* But we need to set ooverflow for float. */ blr - END (__floorf) - -weak_alias (__floorf, floorf) - +END (__floorf_power5plus) diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_floorf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_floorf-ppc32.S similarity index 70% copy from sysdeps/powerpc/powerpc32/power5+/fpu/s_floorf.S copy to sysdeps/powerpc/powerpc32/fpu/multiarch/s_floorf-ppc32.S index eb228da..5ea62cc 100644 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_floorf.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_floorf-ppc32.S @@ -1,5 +1,5 @@ -/* floorf function. PowerPC32/power5+ version. - Copyright (C) 2006-2013 Free Software Foundation, Inc. +/* floorf function. PowerPC32 default version. + 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 @@ -17,13 +17,11 @@ <http://www.gnu.org/licenses/>. */ #include <sysdep.h> +#include <math_ldbl_opt.h> - .machine "power5" -EALIGN (__floorf, 4, 0) - frim fp1, fp1 /* The rounding instructions are double. */ - frsp fp1, fp1 /* But we need to set ooverflow for float. */ - blr - END (__floorf) +#undef weak_alias +#define weak_alias(a,b) -weak_alias (__floorf, floorf) +#define __floorf __floorf_ppc32 +#include <sysdeps/powerpc/powerpc32/fpu/s_floorf.S> diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_floorf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_floorf.c similarity index 64% rename from sysdeps/powerpc/powerpc32/power5+/fpu/s_floorf.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_floorf.c index eb228da..df73148 100644 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_floorf.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_floorf.c @@ -1,5 +1,5 @@ -/* floorf function. PowerPC32/power5+ version. - Copyright (C) 2006-2013 Free Software Foundation, Inc. +/* Multiple versions of floorf. + 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 @@ -16,14 +16,17 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> +#include <math.h> +#include <math_ldbl_opt.h> +#include <shlib-compat.h> +#include "init-arch.h" - .machine "power5" -EALIGN (__floorf, 4, 0) - frim fp1, fp1 /* The rounding instructions are double. */ - frsp fp1, fp1 /* But we need to set ooverflow for float. */ - blr - END (__floorf) +extern __typeof (__floorf) __floorf_ppc32 attribute_hidden; +extern __typeof (__floorf) __floorf_power5plus attribute_hidden; -weak_alias (__floorf, floorf) +libc_ifunc (__floorf, + (hwcap & PPC_FEATURE_POWER5_PLUS) + ? __floorf_power5plus + : __floorf_ppc32); +weak_alias (__floorf, floorf) http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=a9597756bb5cfcdb84c7fb0d77fb59b49e710d15 commit a9597756bb5cfcdb84c7fb0d77fb59b49e710d15 Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 09:10:06 2013 -0500 PowerPC: ceil/ceilf multilib for PowerPC32 diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile index 3bf3e52..9021e02 100644 --- a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile @@ -13,7 +13,8 @@ libm-sysdep_routines += s_llrintf-power6 s_llrintf-power4 s_llrintf-ppc32 \ s_isnan-power5 s_isnan-ppc32 s_isnanf-power6 \ s_isnanf-power5 s_isnanf-ppc32 s_isinf-power7 \ s_isinf-ppc32 s_isinff-ppc32 s_finite-power7 \ - s_finite-ppc32 s_finitef-ppc32 + s_finite-ppc32 s_finitef-ppc32 s_ceil-power5+ \ + s_ceil-ppc32 s_ceilf-power5+ s_ceilf-ppc32 CFLAGS-s_llround.c = -fno-builtin-llroundf endif diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_ceil-power5+.S similarity index 79% copy from sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S copy to sysdeps/powerpc/powerpc32/fpu/multiarch/s_ceil-power5+.S index 0469831..6f76b2f 100644 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_ceil-power5+.S @@ -20,17 +20,7 @@ #include <math_ldbl_opt.h> .machine "power5" -EALIGN (__ceil, 4, 0) +EALIGN (__ceil_power5plus, 4, 0) frip fp1, fp1 blr - END (__ceil) - -weak_alias (__ceil, ceil) - -#ifdef NO_LONG_DOUBLE -weak_alias (__ceil, ceill) -strong_alias (__ceil, __ceill) -#endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) -compat_symbol (libm, __ceil, ceill, GLIBC_2_0) -#endif +END (__ceil_power5plus) diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_ceil-ppc32.S similarity index 68% copy from sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S copy to sysdeps/powerpc/powerpc32/fpu/multiarch/s_ceil-ppc32.S index 43f74a1..d5c9d42 100644 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_ceil-ppc32.S @@ -1,5 +1,5 @@ -/* ceilf function. PowerPC32/power5+ version. - Copyright (C) 2006-2013 Free Software Foundation, Inc. +/* ceil function. PowerPC32 default version. + 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 @@ -17,13 +17,15 @@ <http://www.gnu.org/licenses/>. */ #include <sysdep.h> +#include <math_ldbl_opt.h> - .machine "power5" -EALIGN (__ceilf, 4, 0) - frip fp1, fp1 /* The rounding instructions are double. */ - frsp fp1, fp1 /* But we need to set ooverflow for float. */ - blr - END (__ceilf) +#undef weak_alias +#define weak_alias(a,b) +#undef strong_alias +#define strong_alias(a,b) +#undef compat_symbol +#define compat_symbol(a,b,c,d) -weak_alias (__ceilf, ceilf) +#define __ceil __ceil_ppc32 +#include <sysdeps/powerpc/powerpc32/fpu/s_ceil.S> diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_ceil.c similarity index 68% rename from sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_ceil.c index 0469831..a4e31d1 100644 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_ceil.c @@ -1,5 +1,5 @@ -/* ceil function. PowerPC32/power5+ version. - Copyright (C) 2006-2013 Free Software Foundation, Inc. +/* Multiple versions of ceil. + 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 @@ -16,21 +16,25 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> +#include <math.h> #include <math_ldbl_opt.h> +#include <shlib-compat.h> +#include "init-arch.h" - .machine "power5" -EALIGN (__ceil, 4, 0) - frip fp1, fp1 - blr - END (__ceil) +extern __typeof (__ceil) __ceil_ppc32 attribute_hidden; +extern __typeof (__ceil) __ceil_power5plus attribute_hidden; + +libc_ifunc (__ceil, + (hwcap & PPC_FEATURE_POWER5_PLUS) + ? __ceil_power5plus + : __ceil_ppc32); weak_alias (__ceil, ceil) #ifdef NO_LONG_DOUBLE -weak_alias (__ceil, ceill) strong_alias (__ceil, __ceill) +weak_alias (__ceil, ceill) #endif #if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) -compat_symbol (libm, __ceil, ceill, GLIBC_2_0) +compat_symbol (libm, __ceil, ceill, GLIBC_2_0); #endif diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_ceilf-power5+.S similarity index 93% copy from sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S copy to sysdeps/powerpc/powerpc32/fpu/multiarch/s_ceilf-power5+.S index 43f74a1..eef69b4 100644 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_ceilf-power5+.S @@ -19,11 +19,8 @@ #include <sysdep.h> .machine "power5" -EALIGN (__ceilf, 4, 0) +EALIGN (__ceilf_power5plus, 4, 0) frip fp1, fp1 /* The rounding instructions are double. */ frsp fp1, fp1 /* But we need to set ooverflow for float. */ blr - END (__ceilf) - -weak_alias (__ceilf, ceilf) - +END (__ceilf_power5plus) diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_ceilf-ppc32.S similarity index 70% copy from sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S copy to sysdeps/powerpc/powerpc32/fpu/multiarch/s_ceilf-ppc32.S index 43f74a1..da0a504 100644 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_ceilf-ppc32.S @@ -1,5 +1,5 @@ -/* ceilf function. PowerPC32/power5+ version. - Copyright (C) 2006-2013 Free Software Foundation, Inc. +/* ceilf function. PowerPC32 default version. + 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 @@ -17,13 +17,11 @@ <http://www.gnu.org/licenses/>. */ #include <sysdep.h> +#include <math_ldbl_opt.h> - .machine "power5" -EALIGN (__ceilf, 4, 0) - frip fp1, fp1 /* The rounding instructions are double. */ - frsp fp1, fp1 /* But we need to set ooverflow for float. */ - blr - END (__ceilf) +#undef weak_alias +#define weak_alias(a,b) -weak_alias (__ceilf, ceilf) +#define __ceilf __ceilf_ppc32 +#include <sysdeps/powerpc/powerpc32/fpu/s_ceilf.S> diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_ceilf.c similarity index 64% rename from sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_ceilf.c index 43f74a1..e8f66f9 100644 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_ceilf.c @@ -1,5 +1,5 @@ -/* ceilf function. PowerPC32/power5+ version. - Copyright (C) 2006-2013 Free Software Foundation, Inc. +/* Multiple versions of ceilf. + 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 @@ -16,14 +16,17 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> +#include <math.h> +#include <math_ldbl_opt.h> +#include <shlib-compat.h> +#include "init-arch.h" - .machine "power5" -EALIGN (__ceilf, 4, 0) - frip fp1, fp1 /* The rounding instructions are double. */ - frsp fp1, fp1 /* But we need to set ooverflow for float. */ - blr - END (__ceilf) +extern __typeof (__ceilf) __ceilf_ppc32 attribute_hidden; +extern __typeof (__ceilf) __ceilf_power5plus attribute_hidden; -weak_alias (__ceilf, ceilf) +libc_ifunc (__ceilf, + (hwcap & PPC_FEATURE_POWER5_PLUS) + ? __ceilf_power5plus + : __ceilf_ppc32); +weak_alias (__ceilf, ceilf) http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=bf52feecf4ec733b1e9102dfb35672817cbb2532 commit bf52feecf4ec733b1e9102dfb35672817cbb2532 Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 09:07:35 2013 -0500 PowerPC: finite/finitef multilib for PowerPC32 diff --git a/sysdeps/ieee754/dbl-64/s_finite.c b/sysdeps/ieee754/dbl-64/s_finite.c index 47dad5d..b7fe951 100644 --- a/sysdeps/ieee754/dbl-64/s_finite.c +++ b/sysdeps/ieee754/dbl-64/s_finite.c @@ -22,7 +22,6 @@ static char rcsid[] = "$NetBSD: s_finite.c,v 1.8 1995/05/10 20:47:17 jtc Exp $"; #include <math.h> #include <math_private.h> -#undef __finite int __finite(double x) { int32_t hx; diff --git a/sysdeps/ieee754/flt-32/s_finitef.c b/sysdeps/ieee754/flt-32/s_finitef.c index dfdf4ad..b7c7638 100644 --- a/sysdeps/ieee754/flt-32/s_finitef.c +++ b/sysdeps/ieee754/flt-32/s_finitef.c @@ -25,7 +25,6 @@ static char rcsid[] = "$NetBSD: s_finitef.c,v 1.4 1995/05/10 20:47:18 jtc Exp $" #include <math.h> #include <math_private.h> -#undef __finitef int __finitef(float x) { int32_t ix; diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile index 7a2ceff..3bf3e52 100644 --- a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile @@ -2,9 +2,7 @@ ifeq ($(subdir),math) sysdep_routines += s_isnan-power7 s_isnan-power6 s_isnan-power5 s_isnan-ppc32 \ s_isnanf-power6 s_isnanf-power5 s_isnanf-ppc32 \ s_isinf-power7 s_isinf-ppc32 s_isinff-ppc32 \ - s_finite-power7 s_finite-c s_finitef-c s_copysign-power6 \ - s_copysign-ppc32 s_modf-power5+ s_modf-c s_modff-power5+ \ - s_modff-c + s_finite-power7 s_finite-ppc32 s_finitef-ppc32 libm-sysdep_routines += s_llrintf-power6 s_llrintf-power4 s_llrintf-ppc32 \ s_llrint-power6 s_llrint-power4 s_llrint-ppc32 \ @@ -14,7 +12,8 @@ libm-sysdep_routines += s_llrintf-power6 s_llrintf-power4 s_llrintf-ppc32 \ w_sqrtf-ppc32 s_isnan-power7 s_isnan-power6 \ s_isnan-power5 s_isnan-ppc32 s_isnanf-power6 \ s_isnanf-power5 s_isnanf-ppc32 s_isinf-power7 \ - s_isinf-ppc32 s_isinff-ppc32 + s_isinf-ppc32 s_isinff-ppc32 s_finite-power7 \ + s_finite-ppc32 s_finitef-ppc32 CFLAGS-s_llround.c = -fno-builtin-llroundf endif diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_finite-power7.S similarity index 71% rename from sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_finite-power7.S index b2ab5bf..c9bebd6 100644 --- a/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_finite-power7.S @@ -29,7 +29,7 @@ .section ".text" .type __finite, @function .machine power7 -ENTRY (__finite) +ENTRY (__finite_power7) #ifdef SHARED mflr r11 cfi_register(lr,r11) @@ -63,32 +63,5 @@ ENTRY (__finite) bltlr cr7 /* LT means we have a denormal. */ li r3,0 blr - END (__finite) - -hidden_def (__finite) -weak_alias (__finite, finite) - -/* It turns out that the 'double' version will also always work for - single-precision. */ -strong_alias (__finite, __finitef) -hidden_def (__finitef) -weak_alias (__finitef, finitef) - -#ifdef NO_LONG_DOUBLE -strong_alias (__finite, __finitel) -weak_alias (__finite, finitel) -#endif - -#ifdef IS_IN_libm -# if LONG_DOUBLE_COMPAT (libm, GLIBC_2_0) -compat_symbol (libm, finite, finitel, GLIBC_2_0) -# endif -# if LONG_DOUBLE_COMPAT (libm, GLIBC_2_1) -compat_symbol (libm, __finite, __finitel, GLIBC_2_1) -# endif -#else -# if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) -compat_symbol (libc, __finite, __finitel, GLIBC_2_0); -compat_symbol (libc, finite, finitel, GLIBC_2_0); -# endif -#endif +END (__finite_power7) +weak_alias (__finite_power7, __finitef_power7) diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_finite-ppc32.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_finite-ppc32.c new file mode 100644 index 0000000..e7075f1 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_finite-ppc32.c @@ -0,0 +1,32 @@ +/* finite(). PowerPC32 default version. + Copyright (C) 2013 Free Software Foundation, Inc. + Contributed by Luis Machado <luisgpm@br.ibm.com>. + 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> + +#undef weak_alias +#define weak_alias(a, b) +#undef strong_alias +#define strong_alias(a, b) + +#define __finite __finite_ppc32 +#undef hidden_def +#define hidden_def(a) \ + __hidden_ver1 (__finite_ppc32, __GI___finite, __finite_ppc32); + +#include <sysdeps/ieee754/dbl-64/s_finite.c> diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_finite.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_finite.c new file mode 100644 index 0000000..85a6341 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_finite.c @@ -0,0 +1,51 @@ +/* Multiple versions of finite. + 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 (__finite) __finite_ppc32 attribute_hidden; +extern __typeof (__finite) __finite_power7 attribute_hidden; + +libc_ifunc (__finite, + (hwcap & PPC_FEATURE_ARCH_2_06) + ? __finite_power7 + : __finite_ppc32); + +weak_alias (__finite, finite) + +#ifdef NO_LONG_DOUBLE +strong_alias (__finite, __finitel) +weak_alias (__finite, finitel) +#endif + +#ifdef IS_IN_libm +# if LONG_DOUBLE_COMPAT (libm, GLIBC_2_0) +compat_symbol (libm, finite, finitel, GLIBC_2_0); +# endif +# if LONG_DOUBLE_COMPAT (libm, GLIBC_2_1) +compat_symbol (libm, __finite, __finitel, GLIBC_2_1); +# endif +#else +# if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) +compat_symbol (libc, __finite, __finitel, GLIBC_2_0); +compat_symbol (libc, finite, finitel, GLIBC_2_0); +# endif +#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_finitef-ppc32.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_finitef-ppc32.c new file mode 100644 index 0000000..2d394d7 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_finitef-ppc32.c @@ -0,0 +1,30 @@ +/* finitef(). PowerPC32 default version. + Copyright (C) 2013 Free Software Foundation, Inc. + Contributed by Luis Machado <luisgpm@br.ibm.com>. + 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> + +#undef weak_alias +#define weak_alias(a, b) + +#define __finitef __finitef_ppc32 +#undef hidden_def +#define hidden_def(a) \ + __hidden_ver1 (__finitef_ppc32, __GI___finitef, __finitef_ppc32); + +#include <sysdeps/ieee754/flt-32/s_finitef.c> diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_finitef.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_finitef.c new file mode 100644 index 0000000..5ffc1d7 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_finitef.c @@ -0,0 +1,31 @@ +/* Multiple versions of finitef. + 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 <shlib-compat.h> +#include "init-arch.h" + +extern __typeof (__finitef) __finitef_ppc32 attribute_hidden; +extern __typeof (__finitef) __finitef_power7 attribute_hidden; + +libc_ifunc (__finitef, + (hwcap & PPC_FEATURE_ARCH_2_06) + ? __finitef_power7 + : __finitef_ppc32); + +weak_alias (__finitef, finitef) diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_finitef.S b/sysdeps/powerpc/powerpc32/power7/fpu/s_finitef.S deleted file mode 100644 index 54bd941..0000000 --- a/sysdeps/powerpc/powerpc32/power7/fpu/s_finitef.S +++ /dev/null @@ -1 +0,0 @@ -/* This function uses the same code as s_finite.S. */ http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=e4795ed813c665ad51f8eb074e477cc64b54652f commit e4795ed813c665ad51f8eb074e477cc64b54652f Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 09:06:48 2013 -0500 PowerPC: isinf/isinff multilib for PowerPC32 diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile index de2cbda..7a2ceff 100644 --- a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile @@ -1,6 +1,10 @@ ifeq ($(subdir),math) sysdep_routines += s_isnan-power7 s_isnan-power6 s_isnan-power5 s_isnan-ppc32 \ - s_isnanf-power6 s_isnanf-power5 s_isnanf-ppc32 + s_isnanf-power6 s_isnanf-power5 s_isnanf-ppc32 \ + s_isinf-power7 s_isinf-ppc32 s_isinff-ppc32 \ + s_finite-power7 s_finite-c s_finitef-c s_copysign-power6 \ + s_copysign-ppc32 s_modf-power5+ s_modf-c s_modff-power5+ \ + s_modff-c libm-sysdep_routines += s_llrintf-power6 s_llrintf-power4 s_llrintf-ppc32 \ s_llrint-power6 s_llrint-power4 s_llrint-ppc32 \ @@ -9,7 +13,8 @@ libm-sysdep_routines += s_llrintf-power6 s_llrintf-power4 s_llrintf-ppc32 \ w_sqrt-ppc32 w_sqrtf-power5 w_sqrtf-power4 \ w_sqrtf-ppc32 s_isnan-power7 s_isnan-power6 \ s_isnan-power5 s_isnan-ppc32 s_isnanf-power6 \ - s_isnanf-power5 s_isnanf-ppc32 + s_isnanf-power5 s_isnanf-ppc32 s_isinf-power7 \ + s_isinf-ppc32 s_isinff-ppc32 CFLAGS-s_llround.c = -fno-builtin-llroundf endif diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinf-power7.S similarity index 78% rename from sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinf-power7.S index 3f8af60..0771ce2 100644 --- a/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinf-power7.S @@ -29,7 +29,7 @@ .section ".text" .type __isinf, @function .machine power7 -ENTRY (__isinf) +ENTRY (__isinf_power7) #ifdef SHARED mflr r11 cfi_register(lr,r11) @@ -62,25 +62,5 @@ ENTRY (__isinf) beqlr cr7 /* EQ means INF, otherwise -INF. */ li r3,-1 blr - END (__isinf) - -hidden_def (__isinf) -weak_alias (__isinf, isinf) - -/* It turns out that the 'double' version will also always work for - single-precision. */ -strong_alias (__isinf, __isinff) -hidden_def (__isinff) -weak_alias (__isinff, isinff) - -#ifdef NO_LONG_DOUBLE -strong_alias (__isinf, __isinfl) -weak_alias (__isinf, isinfl) -#endif - -#ifndef IS_IN_libm -# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0) -compat_symbol (libc, __isinf, __isinfl, GLIBC_2_0); -compat_symbol (libc, isinf, isinfl, GLIBC_2_0); -# endif -#endif +END (__isinf_power7) +weak_alias (__isinf_power7, __isinff_power7) diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinf-ppc32.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinf-ppc32.c new file mode 100644 index 0000000..e5ed5a1 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinf-ppc32.c @@ -0,0 +1,32 @@ +/* isinf(). PowerPC32 default version. + Copyright (C) 2013 Free Software Foundation, Inc. + Contributed by Luis Machado <luisgpm@br.ibm.com>. + 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> + +#undef weak_alias +#define weak_alias(a, b) +#undef strong_alias +#define strong_alias(a, b) + +#define __isinf __isinf_ppc32 +#undef hidden_def +#define hidden_def(a) \ + __hidden_ver1 (__isinf_ppc32, __GI___isinf, __isinf_ppc32); + +#include <sysdeps/ieee754/dbl-64/s_isinf.c> diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinf.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinf.c new file mode 100644 index 0000000..afbae86 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinf.c @@ -0,0 +1,44 @@ +/* Multiple versions of isinf. + 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 (__isinf) __isinf_ppc32 attribute_hidden; +extern __typeof (__isinf) __isinf_power7 attribute_hidden; + +libc_ifunc (__isinf, + (hwcap & PPC_FEATURE_ARCH_2_06) + ? __isinf_power7 + : __isinf_ppc32); + +weak_alias (__isinf, isinf) + +#ifdef NO_LONG_DOUBLE +strong_alias (__isinf, __isinfl) +weak_alias (__isinf, isinfl) +#endif + +#ifndef IS_IN_libm +# if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) +compat_symbol (libc, __isinf, __isinfl, GLIBC_2_0); +compat_symbol (libc, isinf, isinfl, GLIBC_2_0); +# endif +#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinff-ppc32.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinff-ppc32.c new file mode 100644 index 0000000..f2c49d8 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinff-ppc32.c @@ -0,0 +1,29 @@ +/* isinff(). PowerPC32 default version. + 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> + +#undef weak_alias +#define weak_alias(a, b) + +#define __isinff __isinff_ppc32 +#undef hidden_def +#define hidden_def(a) \ + __hidden_ver1 (__isinff_ppc32, __GI___isinff, __isinff_ppc32); + +#include <sysdeps/ieee754/flt-32/s_isinff.c> diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinff.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinff.c new file mode 100644 index 0000000..6090d3a --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinff.c @@ -0,0 +1,32 @@ +/* Multiple versions of isinf. + 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 (__isinff) __isinff_ppc32 attribute_hidden; +extern __typeof (__isinff) __isinff_power7 attribute_hidden; + +libc_ifunc (__isinff, + (hwcap & PPC_FEATURE_ARCH_2_06) + ? __isinff_power7 + : __isinff_ppc32); + +weak_alias (__isinff, isinff) diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_isinff.S b/sysdeps/powerpc/powerpc32/power7/fpu/s_isinff.S deleted file mode 100644 index be759e0..0000000 --- a/sysdeps/powerpc/powerpc32/power7/fpu/s_isinff.S +++ /dev/null @@ -1 +0,0 @@ -/* This function uses the same code as s_isinf.S. */ http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=74aadb8718ae5bfa9d79a9af8ec9bac27a15adc1 commit 74aadb8718ae5bfa9d79a9af8ec9bac27a15adc1 Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 08:58:48 2013 -0500 PowerPC: isnan/isnanf multilib for PowerPC32 diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile index 22e07ce..de2cbda 100644 --- a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile @@ -1,10 +1,15 @@ ifeq ($(subdir),math) +sysdep_routines += s_isnan-power7 s_isnan-power6 s_isnan-power5 s_isnan-ppc32 \ + s_isnanf-power6 s_isnanf-power5 s_isnanf-ppc32 + libm-sysdep_routines += s_llrintf-power6 s_llrintf-power4 s_llrintf-ppc32 \ s_llrint-power6 s_llrint-power4 s_llrint-ppc32 \ s_llround-power6 s_llround-power5+ s_llround-power4 \ s_llround-ppc32 w_sqrt-power5 w_sqrt-power4 \ w_sqrt-ppc32 w_sqrtf-power5 w_sqrtf-power4 \ - w_sqrtf-ppc32 + w_sqrtf-ppc32 s_isnan-power7 s_isnan-power6 \ + s_isnan-power5 s_isnan-ppc32 s_isnanf-power6 \ + s_isnanf-power5 s_isnanf-ppc32 CFLAGS-s_llround.c = -fno-builtin-llroundf endif diff --git a/sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan-power5.S similarity index 77% rename from sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan-power5.S index f2417fd..ba28c4d 100644 --- a/sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan-power5.S @@ -1,4 +1,4 @@ -/* isnan(). PowerPC32 version. +/* isnan(). PowerPC32/POWER5 version. Copyright (C) 2008-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -21,7 +21,7 @@ /* int __isnan(x) */ .machine power5 -EALIGN (__isnan, 4, 0) +EALIGN (__isnan_power5, 4, 0) stwu r1,-32(r1) cfi_adjust_cfa_offset (32) ori r1,r1,0 @@ -42,20 +42,4 @@ EALIGN (__isnan, 4, 0) L(NaN): li r3,1 /* else return 1 */ blr - END (__isnan) - -hidden_def (__isnan) -weak_alias (__isnan, isnan) - -#ifdef NO_LONG_DOUBLE -strong_alias (__isnan, __isnanl) -weak_alias (__isnan, isnanl) -#endif - -#ifndef IS_IN_libm -# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0) -compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0); -compat_symbol (libc, isnan, isnanl, GLIBC_2_0); -# endif -#endif - +END (__isnan_power5) diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan-power6.S similarity index 77% rename from sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan-power6.S index 2c095db..eebe69f 100644 --- a/sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan-power6.S @@ -1,4 +1,4 @@ -/* isnan(). PowerPC32 version. +/* isnan(). PowerPC32/POWER6 version. Copyright (C) 2008-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -21,7 +21,7 @@ /* int __isnan(x) */ .machine power6 -EALIGN (__isnan, 4, 0) +EALIGN (__isnan_power6, 4, 0) stwu r1,-32(r1) cfi_adjust_cfa_offset (32) ori r1,r1,0 @@ -42,20 +42,4 @@ EALIGN (__isnan, 4, 0) L(NaN): li r3,1 /* else return 1 */ blr - END (__isnan) - -hidden_def (__isnan) -weak_alias (__isnan, isnan) - -#ifdef NO_LONG_DOUBLE -strong_alias (__isnan, __isnanl) -weak_alias (__isnan, isnanl) -#endif - -#ifndef IS_IN_libm -# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0) -compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0); -compat_symbol (libc, isnan, isnanl, GLIBC_2_0); -# endif -#endif - +END (__isnan_power6) diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan-power7.S similarity index 84% rename from sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan-power7.S index 99ff126..54cc998 100644 --- a/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan-power7.S @@ -29,7 +29,7 @@ .section ".text" .type __isnan, @function .machine power7 -ENTRY (__isnan) +ENTRY (__isnan_power7) #ifdef SHARED mflr r11 cfi_register(lr,r11) @@ -66,25 +66,10 @@ ENTRY (__isnan) L(NaN): li r3,1 /* x == NaN? */ blr - END (__isnan) - -hidden_def (__isnan) -weak_alias (__isnan, isnan) +END (__isnan_power7) /* It turns out that the 'double' version will also always work for single-precision. */ -strong_alias (__isnan, __isnanf) -hidden_def (__isnanf) -weak_alias (__isnanf, isnanf) - -#ifdef NO_LONG_DOUBLE -strong_alias (__isnan, __isnanl) -weak_alias (__isnan, isnanl) -#endif - -#ifndef IS_IN_libm -# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0) -compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0); -compat_symbol (libc, isnan, isnanl, GLIBC_2_0); -# endif -#endif +strong_alias (__isnan_power7, __isnanf_power7) +hidden_def (__isnanf_power7) +weak_alias (__isnanf_power7, isnanf_power7) diff --git a/sysdeps/powerpc/powerpc32/power5/fpu/s_isnanf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan-ppc32.S similarity index 57% copy from sysdeps/powerpc/powerpc32/power5/fpu/s_isnanf.S copy to sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan-ppc32.S index 0373f01..774f99c 100644 --- a/sysdeps/powerpc/powerpc32/power5/fpu/s_isnanf.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan-ppc32.S @@ -1,5 +1,6 @@ -/* isnan(). PowerPC32 version. - Copyright (C) 2008-2013 Free Software Foundation, Inc. +/* isnan(). PowerPC32 default version. + Copyright (C) 2013 Free Software Foundation, Inc. + Contributed by Luis Machado <luisgpm@br.ibm.com>. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,27 +20,9 @@ #include <sysdep.h> #include <math_ldbl_opt.h> -/* int __isnanf(x) */ - .machine power5 -EALIGN (__isnanf, 4, 0) - stwu r1,-32(r1) - cfi_adjust_cfa_offset (32) - stfs fp1,28(r1) /* copy FPR to GPR */ - nop - nop - lwz r4,28(r1) - lis r0,0x7f80 /* const long r0 0x7f800000 */ - clrlwi r4,r4,1 /* x = fabs(x) */ - cmpw cr7,r4,r0 /* if (fabs(x) =< inf) */ - li r3,0 /* then return 0 */ - addi r1,r1,32 - cfi_adjust_cfa_offset (-32) - blelr+ cr7 -L(NaN): - li r3,1 /* else return 1 */ - blr - END (__isnanf) - -hidden_def (__isnanf) -weak_alias (__isnanf, isnanf) +#define __isnan __isnan_ppc32 +#undef hidden_def +#define hidden_def(name) + strong_alias (__isnan_ppc32, __GI___isnan) +#include <sysdeps/powerpc/powerpc32/fpu/s_isnan.S> diff --git a/sysdeps/powerpc/powerpc32/fpu/s_isnan.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan.c similarity index 63% copy from sysdeps/powerpc/powerpc32/fpu/s_isnan.S copy to sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan.c index ac8b088..a45091f 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_isnan.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan.c @@ -1,5 +1,5 @@ -/* isnan(). PowerPC32 version. - Copyright (C) 2008-2013 Free Software Foundation, Inc. +/* Multiple versions of isnan. + 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 @@ -16,31 +16,27 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> +#include <math.h> #include <math_ldbl_opt.h> +#include <shlib-compat.h> +#include "init-arch.h" + +extern __typeof (__isnan) __isnan_ppc32 attribute_hidden; +extern __typeof (__isnan) __isnan_power5 attribute_hidden; +extern __typeof (__isnan) __isnan_power6 attribute_hidden; +extern __typeof (__isnan) __isnan_power7 attribute_hidden; + +libc_ifunc (__isnan, + (hwcap & PPC_FEATURE_ARCH_2_06) + ? __isnan_power7 : + (hwcap & PPC_FEATURE_ARCH_2_05) + ? __isnan_power6 : + (hwcap & PPC_FEATURE_POWER5) + ? __isnan_power5 + : __isnan_ppc32); -/* int __isnan(x) */ - .machine power4 -EALIGN (__isnan, 4, 0) - mffs fp0 - mtfsb0 4*cr6+lt /* reset_fpscr_bit (FPSCR_VE) */ - fcmpu cr7,fp1,fp1 - mtfsf 255,fp0 - li r3,0 - beqlr+ cr7 /* (x == x) then not a NAN */ - li r3,1 /* else must be a NAN */ - blr - END (__isnan) - -hidden_def (__isnan) weak_alias (__isnan, isnan) -/* It turns out that the 'double' version will also always work for - single-precision. */ -strong_alias (__isnan, __isnanf) -hidden_def (__isnanf) -weak_alias (__isnanf, isnanf) - #ifdef NO_LONG_DOUBLE strong_alias (__isnan, __isnanl) weak_alias (__isnan, isnanl) @@ -52,4 +48,3 @@ compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0); compat_symbol (libc, isnan, isnanl, GLIBC_2_0); # endif #endif - diff --git a/sysdeps/powerpc/powerpc32/power5/fpu/s_isnanf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf-power5.S similarity index 90% copy from sysdeps/powerpc/powerpc32/power5/fpu/s_isnanf.S copy to sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf-power5.S index 0373f01..640f992 100644 --- a/sysdeps/powerpc/powerpc32/power5/fpu/s_isnanf.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf-power5.S @@ -1,4 +1,4 @@ -/* isnan(). PowerPC32 version. +/* isnanf(). PowerPC32/POWER5 version. Copyright (C) 2008-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -21,7 +21,7 @@ /* int __isnanf(x) */ .machine power5 -EALIGN (__isnanf, 4, 0) +EALIGN (__isnanf_power5, 4, 0) stwu r1,-32(r1) cfi_adjust_cfa_offset (32) stfs fp1,28(r1) /* copy FPR to GPR */ @@ -38,8 +38,4 @@ EALIGN (__isnanf, 4, 0) L(NaN): li r3,1 /* else return 1 */ blr - END (__isnanf) - -hidden_def (__isnanf) -weak_alias (__isnanf, isnanf) - +END (__isnanf_power5) diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf-power6.S similarity index 90% rename from sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf-power6.S index 483f0f9..4345c5a 100644 --- a/sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf-power6.S @@ -1,4 +1,4 @@ -/* isnanf(). PowerPC32 version. +/* isnanf(). PowerPC32/POWER6 version. Copyright (C) 2008-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -21,7 +21,7 @@ /* int __isnanf(x) */ .machine power6 -EALIGN (__isnanf, 4, 0) +EALIGN (__isnanf_power6, 4, 0) stwu r1,-32(r1) cfi_adjust_cfa_offset (32) ori r1,r1,0 @@ -38,7 +38,4 @@ EALIGN (__isnanf, 4, 0) L(NaN): li r3,1 /* else return 1 */ blr - END (__isnanf) - -hidden_def (__isnanf) -weak_alias (__isnanf, isnanf) +END (__isnanf_power6) diff --git a/sysdeps/powerpc/powerpc32/power5/fpu/s_isnanf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf-ppc32.S similarity index 61% copy from sysdeps/powerpc/powerpc32/power5/fpu/s_isnanf.S copy to sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf-ppc32.S index 0373f01..e1fd2f3 100644 --- a/sysdeps/powerpc/powerpc32/power5/fpu/s_isnanf.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf-ppc32.S @@ -1,4 +1,4 @@ -/* isnan(). PowerPC32 version. +/* Default isnanf implementation for PowerPC32. Copyright (C) 2008-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -19,27 +19,14 @@ #include <sysdep.h> #include <math_ldbl_opt.h> -/* int __isnanf(x) */ - .machine power5 -EALIGN (__isnanf, 4, 0) - stwu r1,-32(r1) - cfi_adjust_cfa_offset (32) - stfs fp1,28(r1) /* copy FPR to GPR */ - nop - nop - lwz r4,28(r1) - lis r0,0x7f80 /* const long r0 0x7f800000 */ - clrlwi r4,r4,1 /* x = fabs(x) */ - cmpw cr7,r4,r0 /* if (fabs(x) =< inf) */ - li r3,0 /* then return 0 */ - addi r1,r1,32 - cfi_adjust_cfa_offset (-32) - blelr+ cr7 -L(NaN): - li r3,1 /* else return 1 */ - blr - END (__isnanf) +#undef weak_alias +#define weak_alias(a, b) +#undef compat_symbol +#define compat_symbol(a, b, c, d) -hidden_def (__isnanf) -weak_alias (__isnanf, isnanf) +#define __isnan __isnanf_ppc32 +#undef hidden_def +#define hidden_def(name) \ + strong_alias (__isnanf_ppc32, __GI___isnanf) +#include <sysdeps/powerpc/powerpc32/fpu/s_isnan.S> diff --git a/sysdeps/powerpc/powerpc32/power5/fpu/s_isnanf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf.c similarity index 54% rename from sysdeps/powerpc/powerpc32/power5/fpu/s_isnanf.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf.c index 0373f01..5647841 100644 --- a/sysdeps/powerpc/powerpc32/power5/fpu/s_isnanf.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf.c @@ -1,5 +1,5 @@ -/* isnan(). PowerPC32 version. - Copyright (C) 2008-2013 Free Software Foundation, Inc. +/* Multiple versions of isnanf. + 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 @@ -16,30 +16,22 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> -#include <math_ldbl_opt.h> +#include <math.h> +#include <shlib-compat.h> +#include "init-arch.h" -/* int __isnanf(x) */ - .machine power5 -EALIGN (__isnanf, 4, 0) - stwu r1,-32(r1) - cfi_adjust_cfa_offset (32) - stfs fp1,28(r1) /* copy FPR to GPR */ - nop - nop - lwz r4,28(r1) - lis r0,0x7f80 /* const long r0 0x7f800000 */ - clrlwi r4,r4,1 /* x = fabs(x) */ - cmpw cr7,r4,r0 /* if (fabs(x) =< inf) */ - li r3,0 /* then return 0 */ - addi r1,r1,32 - cfi_adjust_cfa_offset (-32) - blelr+ cr7 -L(NaN): - li r3,1 /* else return 1 */ - blr - END (__isnanf) +extern __typeof (__isnanf) __isnanf_ppc32 attribute_hidden; +extern __typeof (__isnanf) __isnanf_power5 attribute_hidden; +extern __typeof (__isnanf) __isnanf_power6 attribute_hidden; +extern __typeof (__isnanf) __isnanf_power7 attribute_hidden; -hidden_def (__isnanf) -weak_alias (__isnanf, isnanf) +libc_ifunc (__isnanf, + (hwcap & PPC_FEATURE_ARCH_2_06) + ? __isnanf_power7 : + (hwcap & PPC_FEATURE_ARCH_2_05) + ? __isnanf_power6 : + (hwcap & PPC_FEATURE_POWER5) + ? __isnanf_power5 + : __isnanf_ppc32); +weak_alias (__isnanf, isnanf) diff --git a/sysdeps/powerpc/powerpc32/fpu/s_isnan.S b/sysdeps/powerpc/powerpc32/fpu/s_isnan.S index ac8b088..5a78b51 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_isnan.S +++ b/sysdeps/powerpc/powerpc32/fpu/s_isnan.S @@ -37,9 +37,11 @@ weak_alias (__isnan, isnan) /* It turns out that the 'double' version will also always work for single-precision. */ +#ifndef __isnan strong_alias (__isnan, __isnanf) hidden_def (__isnanf) weak_alias (__isnanf, isnanf) +#endif #ifdef NO_LONG_DOUBLE strong_alias (__isnan, __isnanl) diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_isnanf.S b/sysdeps/powerpc/powerpc32/power7/fpu/s_isnanf.S deleted file mode 100644 index b48c85e..0000000 --- a/sysdeps/powerpc/powerpc32/power7/fpu/s_isnanf.S +++ /dev/null @@ -1 +0,0 @@ -/* This function uses the same code as s_isnan.S. */ http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=18a8158ced448b99e89c3d3c7afb826791aa801b commit 18a8158ced448b99e89c3d3c7afb826791aa801b Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 08:58:01 2013 -0500 PowerPC: sqrt/sqrtf multilib for PowerPC32 diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile index 7c50805..22e07ce 100644 --- a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile @@ -2,7 +2,9 @@ ifeq ($(subdir),math) libm-sysdep_routines += s_llrintf-power6 s_llrintf-power4 s_llrintf-ppc32 \ s_llrint-power6 s_llrint-power4 s_llrint-ppc32 \ s_llround-power6 s_llround-power5+ s_llround-power4 \ - s_llround-ppc32 + s_llround-ppc32 w_sqrt-power5 w_sqrt-power4 \ + w_sqrt-ppc32 w_sqrtf-power5 w_sqrtf-power4 \ + w_sqrtf-ppc32 CFLAGS-s_llround.c = -fno-builtin-llroundf endif diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/w_sqrt-power4.S similarity index 91% rename from sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/w_sqrt-power4.S index 4f1c176..35e638f 100644 --- a/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/w_sqrt-power4.S @@ -1,4 +1,4 @@ -/* sqrt function. PowerPC32 version. +/* sqrt function. PowerPC32/POWER4 version. Copyright (C) 2007-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -25,27 +25,27 @@ sets the appropriate floating point exceptions. Extended checking is only needed to set errno (via __kernel_standard) if the input value is negative. - + The fsqrt will set FPCC and FU (Floating Point Unordered or NaN to indicated that the input value was negative or NaN. Use Move to Condition Register from FPSCR to copy the FPCC field to cr1. The branch on summary overflow transfers control to w_sqrt to process any error conditions. Otherwise we can return the result directly. - + This part of the function is a leaf routine, so no need to stack a frame or execute prologue/epilogue code. This means it is safe to transfer directly to w_sqrt as long as the input value (f1) is preserved. Putting the sqrt result into f2 (double parameter 2) allows passing both the input value and sqrt result into the extended wrapper so there is no need to recompute. - + This tactic avoids the overhead of stacking a frame for the normal (non-error) case. Until gcc supports prologue shrink-wrapping this is the best we can do. */ .section ".text" .machine power4 -EALIGN (__sqrt, 5, 0) +EALIGN (__sqrt_power4, 5, 0) fsqrt fp2,fp1 mcrfs cr1,4 bso- cr1,.Lw_sqrt @@ -95,15 +95,4 @@ EALIGN (__sqrt, 5, 0) bl __kernel_standard@plt fmr fp12,fp1 b .L4 - END (__sqrt) - -weak_alias (__sqrt, sqrt) - -#ifdef NO_LONG_DOUBLE -weak_alias (__sqrt, sqrtl) -strong_alias (__sqrt, __sqrtl) -#endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) -compat_symbol (libm, __sqrt, sqrtl, GLIBC_2_0) -#endif - +END(__sqrt_power4) diff --git a/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/w_sqrt-power5.S similarity index 90% rename from sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/w_sqrt-power5.S index 23559aa..fcb3043 100644 --- a/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/w_sqrt-power5.S @@ -1,4 +1,4 @@ -/* sqrt function. PowerPC32 version. +/* sqrt function. PowerPC32/POWER5 version. Copyright (C) 2007-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -25,26 +25,26 @@ sets the appropriate floating point exceptions. Extended checking is only needed to set errno (via __kernel_standard) if the input value is negative. - + So compare the input value against the absolute value of itself. This will compare equal unless the value is negative (EDOM) or a NAN, in which case we branch to the extend wrapper. If equal we can return the result directly. - + This part of the function looks like a leaf routine, so no need to stack a frame or execute prologue/epilogue code. It is safe to branch directly to w_sqrt as long as the input value (f1) is preserved. Putting the sqrt result into f2 (float parameter 2) allows passing both the input value and sqrt result into the extended wrapper so there is no need to recompute. - + This tactic avoids the overhead of stacking a frame for the normal (non-error) case. Until gcc supports prologue shrink-wrapping this is the best we can do. */ .section ".text" - .machine power4 -EALIGN (__sqrt, 5, 0) + .machine power5 +EALIGN (__sqrt_power5, 5, 0) fabs fp0,fp1 fsqrt fp2,fp1 fcmpu cr1,fp0,fp1 @@ -93,15 +93,4 @@ EALIGN (__sqrt, 5, 0) bl __kernel_standard@plt fmr fp12,fp1 b .L4 - END (__sqrt) - -weak_alias (__sqrt, sqrt) - -#ifdef NO_LONG_DOUBLE -weak_alias (__sqrt, sqrtl) -strong_alias (__sqrt, __sqrtl) -#endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) -compat_symbol (libm, __sqrt, sqrtl, GLIBC_2_0) -#endif - +END (__sqrt_power5) diff --git a/sysdeps/powerpc/fpu/w_sqrt.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/w_sqrt-ppc32.c similarity index 51% copy from sysdeps/powerpc/fpu/w_sqrt.c copy to sysdeps/powerpc/powerpc32/fpu/multiarch/w_sqrt-ppc32.c index 70f28dd..5d07a7b 100644 --- a/sysdeps/powerpc/fpu/w_sqrt.c +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/w_sqrt-ppc32.c @@ -1,5 +1,5 @@ -/* Double-precision floating point square root wrapper. - Copyright (C) 2004-2013 Free Software Foundation, Inc. +/* PowerPC32 default implementation for sqrt. + 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 @@ -17,32 +17,14 @@ <http://www.gnu.org/licenses/>. */ #include <math.h> -#include <math_private.h> -#include <fenv_libc.h> -#include <math_ldbl_opt.h> -double -__sqrt (double x) /* wrapper sqrt */ -{ -#ifdef _IEEE_LIBM - return __ieee754_sqrt (x); -#else - double z; - z = __ieee754_sqrt (x); - if (_LIB_VERSION == _IEEE_ || (x != x)) - return z; +/* The PPC32 default implementation will fallback to __ieee754_sqrt symbol + from sysdeps/powerpc/fpu/e_sqrt.c */ - if (x < 0.0) - return __kernel_standard (x, x, 26); /* sqrt(negative) */ - else - return z; -#endif -} +#define __sqrtf __sqrtf_ppc32 +#undef weak_alias +#define weak_alias(a, b) +#undef strong_alias +#define strong_alias(a, b) -weak_alias (__sqrt, sqrt) -#ifdef NO_LONG_DOUBLE - strong_alias (__sqrt, __sqrtl) weak_alias (__sqrt, sqrtl) -#endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) -compat_symbol (libm, __sqrt, sqrtl, GLIBC_2_0); -#endif +#include <math/w_sqrtf.c> diff --git a/sysdeps/powerpc/fpu/w_sqrt.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/w_sqrt.c similarity index 63% copy from sysdeps/powerpc/fpu/w_sqrt.c copy to sysdeps/powerpc/powerpc32/fpu/multiarch/w_sqrt.c index 70f28dd..f77eeb2 100644 --- a/sysdeps/powerpc/fpu/w_sqrt.c +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/w_sqrt.c @@ -1,5 +1,5 @@ -/* Double-precision floating point square root wrapper. - Copyright (C) 2004-2013 Free Software Foundation, Inc. +/* Multiple versions of sqrt. + 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 @@ -17,31 +17,26 @@ <http://www.gnu.org/licenses/>. */ #include <math.h> -#include <math_private.h> -#include <fenv_libc.h> #include <math_ldbl_opt.h> +#include <shlib-compat.h> +#include "init-arch.h" -double -__sqrt (double x) /* wrapper sqrt */ -{ -#ifdef _IEEE_LIBM - return __ieee754_sqrt (x); -#else - double z; - z = __ieee754_sqrt (x); - if (_LIB_VERSION == _IEEE_ || (x != x)) - return z; - - if (x < 0.0) - return __kernel_standard (x, x, 26); /* sqrt(negative) */ - else - return z; -#endif -} +extern __typeof (__sqrt) __sqrt_ppc32 attribute_hidden; +extern __typeof (__sqrt) __sqrt_power4 attribute_hidden; +extern __typeof (__sqrt) __sqrt_power5 attribute_hidden; + +libc_ifunc (__sqrt, + (hwcap & PPC_FEATURE_POWER5) + ? __sqrt_power5 : + (hwcap & PPC_FEATURE_POWER4) + ? __sqrt_power4 + : __sqrt_ppc32); weak_alias (__sqrt, sqrt) + #ifdef NO_LONG_DOUBLE - strong_alias (__sqrt, __sqrtl) weak_alias (__sqrt, sqrtl) +strong_alias (__sqrt, __sqrtl) +weak_alias (__sqrt, sqrtl) #endif #if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) compat_symbol (libm, __sqrt, sqrtl, GLIBC_2_0); diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/w_sqrtf-power4.S similarity index 96% rename from sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/w_sqrtf-power4.S index 0da5b7a..f3524a2 100644 --- a/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/w_sqrtf-power4.S @@ -1,4 +1,4 @@ -/* sqrtf function. PowerPC32 version. +/* sqrtf function. PowerPC32/POWER4 version. Copyright (C) 2007-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -25,27 +25,27 @@ sets the appropriate floating point exceptions. Extended checking is only needed to set errno (via __kernel_standard) if the input value is negative. - + The fsqrts will set FPCC and FU (Floating Point Unordered or NaN to indicated that the input value was negative or NaN. Use Move to Condition Register from FPSCR to copy the FPCC field to cr1. The branch on summary overflow transfers control to w_sqrt to process any error conditions. Otherwise we can return the result directly. - + This part of the function is a leaf routine, so no need to stack a frame or execute prologue/epilogue code. This means it is safe to transfer directly to w_sqrt as long as the input value (f1) is preserved. Putting the sqrt result into f2 (float parameter 2) allows passing both the input value and sqrt result into the extended wrapper so there is no need to recompute. - + This tactic avoids the overhead of stacking a frame for the normal (non-error) case. Until gcc supports prologue shrink-wrapping this is the best we can do. */ .section ".text" .machine power4 -EALIGN (__sqrtf, 5, 0) +EALIGN (__sqrtf_power4, 5, 0) fsqrts fp2,fp1 mcrfs cr1,4 bso- cr1,.Lw_sqrtf @@ -95,7 +95,4 @@ EALIGN (__sqrtf, 5, 0) bl __kernel_standard@plt fmr fp12,fp1 b .L4 - END (__sqrtf) - -weak_alias (__sqrtf, sqrtf) - +END (__sqrtf_power4) diff --git a/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/w_sqrtf-power5.S similarity index 95% rename from sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/w_sqrtf-power5.S index 590c24c..aae9e91 100644 --- a/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/w_sqrtf-power5.S @@ -1,4 +1,4 @@ -/* sqrtf function. PowerPC32 version. +/* sqrtf function. PowerPC32/POWER5 version. Copyright (C) 2007-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -25,26 +25,26 @@ sets the appropriate floating point exceptions. Extended checking is only needed to set errno (via __kernel_standard) if the input value is negative. - + So compare the input value against the absolute value of itself. This will compare equal unless the value is negative (EDOM) or a NAN, in which case we branch to the extend wrapper. If equal we can return the result directly. - + This part of the function looks like a leaf routine, so no need to stack a frame or execute prologue/epilogue code. It is safe to branch directly to w_sqrt as long as the input value (f1) is preserved. Putting the sqrt result into f2 (float parameter 2) allows passing both the input value and sqrt result into the extended wrapper so there is no need to recompute. - + This tactic avoids the overhead of stacking a frame for the normal (non-error) case. Until gcc supports prologue shrink-wrapping this is the best we can do. */ .section ".text" - .machine power4 -EALIGN (__sqrtf, 5, 0) + .machine power5 +EALIGN (__sqrtf_power5, 5, 0) fabs fp0,fp1 fsqrts fp2,fp1 fcmpu cr1,fp0,fp1 @@ -93,7 +93,4 @@ EALIGN (__sqrtf, 5, 0) bl __kernel_standard@plt fmr fp12,fp1 b .L4 - END (__sqrtf) - -weak_alias (__sqrtf, sqrtf) - +END (__sqrtf_power5) diff --git a/sysdeps/powerpc/fpu/w_sqrt.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/w_sqrtf-ppc32.c similarity index 51% copy from sysdeps/powerpc/fpu/w_sqrt.c copy to sysdeps/powerpc/powerpc32/fpu/multiarch/w_sqrtf-ppc32.c index 70f28dd..3702e44 100644 --- a/sysdeps/powerpc/fpu/w_sqrt.c +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/w_sqrtf-ppc32.c @@ -1,5 +1,5 @@ -/* Double-precision floating point square root wrapper. - Copyright (C) 2004-2013 Free Software Foundation, Inc. +/* PowerPC32 default implementation for sqrtf. + 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 @@ -17,32 +17,14 @@ <http://www.gnu.org/licenses/>. */ #include <math.h> -#include <math_private.h> -#include <fenv_libc.h> -#include <math_ldbl_opt.h> -double -__sqrt (double x) /* wrapper sqrt */ -{ -#ifdef _IEEE_LIBM - return __ieee754_sqrt (x); -#else - double z; - z = __ieee754_sqrt (x); - if (_LIB_VERSION == _IEEE_ || (x != x)) - return z; +/* The PPC32 default implementation will fallback to __ieee754_sqrt symbol + from sysdeps/powerpc/fpu/e_sqrt.c */ - if (x < 0.0) - return __kernel_standard (x, x, 26); /* sqrt(negative) */ - else - return z; -#endif -} +#define __sqrt __sqrt_ppc32 +#undef weak_alias +#define weak_alias(a, b) +#undef strong_alias +#define strong_alias(a, b) -weak_alias (__sqrt, sqrt) -#ifdef NO_LONG_DOUBLE - strong_alias (__sqrt, __sqrtl) weak_alias (__sqrt, sqrtl) -#endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) -compat_symbol (libm, __sqrt, sqrtl, GLIBC_2_0); -#endif +#include <math/w_sqrt.c> diff --git a/sysdeps/powerpc/fpu/w_sqrt.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/w_sqrtf.c similarity index 53% rename from sysdeps/powerpc/fpu/w_sqrt.c rename to sysdeps/powerpc/powerpc32/fpu/multiarch/w_sqrtf.c index 70f28dd..8af86c4 100644 --- a/sysdeps/powerpc/fpu/w_sqrt.c +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/w_sqrtf.c @@ -1,5 +1,5 @@ -/* Double-precision floating point square root wrapper. - Copyright (C) 2004-2013 Free Software Foundation, Inc. +/* Multiple versions of sqrtf. + 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 @@ -17,32 +17,19 @@ <http://www.gnu.org/licenses/>. */ #include <math.h> -#include <math_private.h> -#include <fenv_libc.h> #include <math_ldbl_opt.h> +#include <shlib-compat.h> +#include "init-arch.h" -double -__sqrt (double x) /* wrapper sqrt */ -{ -#ifdef _IEEE_LIBM - return __ieee754_sqrt (x); -#else - double z; - z = __ieee754_sqrt (x); - if (_LIB_VERSION == _IEEE_ || (x != x)) - return z; +extern __typeof (__sqrtf) __sqrtf_ppc32 attribute_hidden; +extern __typeof (__sqrtf) __sqrtf_power4 attribute_hidden; +extern __typeof (__sqrtf) __sqrtf_power5 attribute_hidden; - if (x < 0.0) - return __kernel_standard (x, x, 26); /* sqrt(negative) */ - else - return z; -#endif -} +libc_ifunc (__sqrtf, + (hwcap & PPC_FEATURE_POWER5) + ? __sqrtf_power5 : + (hwcap & PPC_FEATURE_POWER4) + ? __sqrtf_power4 + : __sqrtf_ppc32); -weak_alias (__sqrt, sqrt) -#ifdef NO_LONG_DOUBLE - strong_alias (__sqrt, __sqrtl) weak_alias (__sqrt, sqrtl) -#endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) -compat_symbol (libm, __sqrt, sqrtl, GLIBC_2_0); -#endif +weak_alias (__sqrtf, sqrtf) http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=80a94f9ecdf802ce5d81dc40e365486a188ac97a commit 80a94f9ecdf802ce5d81dc40e365486a188ac97a Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 08:57:09 2013 -0500 PowerPC: llround multilib for PowerPC32 diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile index 8119417..7c50805 100644 --- a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile @@ -1,4 +1,8 @@ ifeq ($(subdir),math) libm-sysdep_routines += s_llrintf-power6 s_llrintf-power4 s_llrintf-ppc32 \ - s_llrint-power6 s_llrint-power4 s_llrint-ppc32 + s_llrint-power6 s_llrint-power4 s_llrint-ppc32 \ + s_llround-power6 s_llround-power5+ s_llround-power4 \ + s_llround-ppc32 + +CFLAGS-s_llround.c = -fno-builtin-llroundf endif diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llround-power4.S similarity index 88% rename from sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_llround-power4.S index 07beb0a..1080771 100644 --- a/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llround-power4.S @@ -1,4 +1,4 @@ -/* llround function. PowerPC32 on PowerPC64 version. +/* llround function. PowerPC32/POWER4 version. Copyright (C) 2004-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -29,11 +29,11 @@ .section ".text" /* long [r3] lround (float x [fp1]) - IEEE 1003.1 lround function. IEEE specifies "round to the nearest + IEEE 1003.1 lround function. IEEE specifies "round to the nearest integer value, rounding halfway cases away from zero, regardless of the current rounding mode." However PowerPC Architecture defines - "round to Nearest" as "Choose the best approximation. In case of a - tie, choose the one that is even (least significant bit o).". + "round to Nearest" as "Choose the best approximation. In case of a + tie, choose the one that is even (least significant bit o).". So we can't use the PowerPC "round to Nearest" mode. Instead we set "round toward Zero" mode and round by adding +-0.5 before rounding to the integer value. @@ -46,7 +46,8 @@ is greater/less than +-2^52 we don't need to bias the number with +-0.5. */ -ENTRY (__llround) + .machine power4 +ENTRY (__llround_power4) stwu r1,-16(r1) cfi_adjust_cfa_offset (16) #ifdef SHARED @@ -92,17 +93,4 @@ ENTRY (__llround) .Lnobias: fmr fp3,fp1 b .Lconvert - END (__llround) - -weak_alias (__llround, llround) - -strong_alias (__llround, __llroundf) -weak_alias (__llround, llroundf) - -#ifdef NO_LONG_DOUBLE -weak_alias (__llround, llroundl) -strong_alias (__llround, __llroundl) -#endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __llround, llroundl, GLIBC_2_1) -#endif +END (__llround_power4) diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llround-power5+.S similarity index 80% rename from sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_llround-power5+.S index 558bd2a..90765de 100644 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llround-power5+.S @@ -1,4 +1,4 @@ -/* lround function. POWER5+, PowerPC32 version. +/* lround function. PowerPC32/POWER5+ version. Copyright (C) 2006-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -18,19 +18,19 @@ #include <sysdep.h> #include <math_ldbl_opt.h> - + /* long [r3] llround (float x [fp1]) - IEEE 1003.1 lround function. IEEE specifies "round to the nearest + IEEE 1003.1 lround function. IEEE specifies "round to the nearest integer value, rounding halfway cases away from zero, regardless of the current rounding mode." However PowerPC Architecture defines - "round to Nearest" as "Choose the best approximation. In case of a - tie, choose the one that is even (least significant bit o).". + "round to Nearest" as "Choose the best approximation. In case of a + tie, choose the one that is even (least significant bit o).". So we pre-round using the V2.02 Floating Round to Integer Nearest instruction before we use the Floating Convert to Integer Word with round to zero instruction. */ .machine "power5" -ENTRY (__llround) +ENTRY (__llround_power5) stwu r1,-16(r1) cfi_adjust_cfa_offset (16) frin fp2,fp1 @@ -43,17 +43,4 @@ ENTRY (__llround) lwz r3,8(r1) addi r1,r1,16 blr - END (__llround) - -weak_alias (__llround, llround) - -strong_alias (__llround, __llroundf) -weak_alias (__llround, llroundf) - -#ifdef NO_LONG_DOUBLE -weak_alias (__llround, llroundl) -strong_alias (__llround, __llroundl) -#endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __llround, llroundl, GLIBC_2_1) -#endif +END (__llround_power5) diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llround-power6.S similarity index 79% rename from sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_llround-power6.S index bfc5efb..fa61586 100644 --- a/sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llround-power6.S @@ -1,4 +1,4 @@ -/* lround function. POWER5+, PowerPC32 version. +/* lround function. PowerPC32/POWER6 version. Copyright (C) 2006-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -18,19 +18,19 @@ #include <sysdep.h> #include <math_ldbl_opt.h> - + /* long [r3] llround (float x [fp1]) - IEEE 1003.1 lround function. IEEE specifies "round to the nearest + IEEE 1003.1 lround function. IEEE specifies "round to the nearest integer value, rounding halfway cases away from zero, regardless of the current rounding mode." However PowerPC Architecture defines - "round to Nearest" as "Choose the best approximation. In case of a - tie, choose the one that is even (least significant bit o).". + "round to Nearest" as "Choose the best approximation. In case of a + tie, choose the one that is even (least significant bit o).". So we pre-round using the V2.02 Floating Round to Integer Nearest instruction before we use the Floating Convert to Integer Word with round to zero instruction. */ - .machine "power5" -ENTRY (__llround) + .machine "power6" +ENTRY (__llround_power6) stwu r1,-16(r1) cfi_adjust_cfa_offset (16) frin fp2,fp1 @@ -43,17 +43,4 @@ ENTRY (__llround) lwz r3,8(r1) addi r1,r1,16 blr - END (__llround) - -weak_alias (__llround, llround) - -strong_alias (__llround, __llroundf) -weak_alias (__llround, llroundf) - -#ifdef NO_LONG_DOUBLE -weak_alias (__llround, llroundl) -strong_alias (__llround, __llroundl) -#endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __llround, llroundl, GLIBC_2_1) -#endif +END (__llround_power6) diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llround-ppc32.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llround-ppc32.c new file mode 100644 index 0000000..fad664e --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llround-ppc32.c @@ -0,0 +1,32 @@ +/* llround function. PowerPC32 default version. + Copyright (C) 2004-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> + +#undef __llround +#define __llround __llround_ppc32 + +#undef weak_alias +#define weak_alias(a,b) +#undef strong_alias +#define strong_alias(a,b) +#undef compat_symbol +#define compat_symbol(a,b,c,d) + +#include <sysdeps/powerpc/fpu/s_llround.c> diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llround.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llround.c new file mode 100644 index 0000000..9ca54e0 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llround.c @@ -0,0 +1,46 @@ +/* Multiple versions of llround. + 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 (__llround) __llround_ppc32 attribute_hidden; +extern __typeof (__llround) __llround_power4 attribute_hidden; +extern __typeof (__llround) __llround_power5 attribute_hidden; +extern __typeof (__llround) __llround_power6 attribute_hidden; + +libc_ifunc (__llround, + (hwcap & PPC_FEATURE_ARCH_2_05) + ? __llround_power6 : + (hwcap & PPC_FEATURE_POWER5_PLUS) + ? __llround_power5 : + (hwcap & PPC_FEATURE_POWER4) + ? __llround_power4 + : __llround_ppc32); + +weak_alias (__llround, llround) + +#ifdef NO_LONG_DOUBLE +strong_alias (__llround, __llroundl) +weak_alias (__llround, llroundl) +#endif +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) +compat_symbol (libm, __llround, llroundl, GLIBC_2_1); +#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llroundf.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llroundf.c new file mode 100644 index 0000000..37a6f0d --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llroundf.c @@ -0,0 +1,37 @@ +/* Multiple versions of llroundf. + 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 "init-arch.h" + +/* It's safe to use double-precision implementation for single-precision. */ +extern __typeof (__llround) __llround_ppc32 attribute_hidden; +extern __typeof (__llround) __llround_power4 attribute_hidden; +extern __typeof (__llround) __llround_power5 attribute_hidden; +extern __typeof (__llround) __llround_power6 attribute_hidden; + +libc_ifunc (__llroundf, + (hwcap & PPC_FEATURE_ARCH_2_05) + ? __llround_power6 : + (hwcap & PPC_FEATURE_POWER5_PLUS) + ? __llround_power5 : + (hwcap & PPC_FEATURE_POWER4) + ? __llround_power4 + : __llround_ppc32); + +weak_alias (__llroundf, llroundf) diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/s_llroundf.S b/sysdeps/powerpc/powerpc32/power4/fpu/s_llroundf.S deleted file mode 100644 index 72d6181..0000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/s_llroundf.S +++ /dev/null @@ -1 +0,0 @@ -/* __llroundf is in s_llround.S */ diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_llroundf.S b/sysdeps/powerpc/powerpc32/power5+/fpu/s_llroundf.S deleted file mode 100644 index 030d2fd..0000000 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_llroundf.S +++ /dev/null @@ -1 +0,0 @@ -/* __llroundf is in s_llround.S */ diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_llroundf.S b/sysdeps/powerpc/powerpc32/power6/fpu/s_llroundf.S deleted file mode 100644 index 030d2fd..0000000 --- a/sysdeps/powerpc/powerpc32/power6/fpu/s_llroundf.S +++ /dev/null @@ -1 +0,0 @@ -/* __llroundf is in s_llround.S */ http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=56df8141a55b3fb50f37a68c68d1e43f76f64281 commit 56df8141a55b3fb50f37a68c68d1e43f76f64281 Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 08:56:27 2013 -0500 PowerPC: llrint/llrintf multilib for PowerPC32 diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile new file mode 100644 index 0000000..8119417 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile @@ -0,0 +1,4 @@ +ifeq ($(subdir),math) +libm-sysdep_routines += s_llrintf-power6 s_llrintf-power4 s_llrintf-ppc32 \ + s_llrint-power6 s_llrint-power4 s_llrint-ppc32 +endif diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-power4.S similarity index 77% rename from sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-power4.S index 2ac986d..2d1f201 100644 --- a/sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-power4.S @@ -1,4 +1,4 @@ -/* Round double to long int. PowerPC32 on PowerPC64 version. +/* Round double to long int. PowerPC32/POWER4 version. Copyright (C) 2004-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -20,7 +20,8 @@ #include <math_ldbl_opt.h> /* long long int[r3, r4] __llrint (double x[fp1]) */ -ENTRY (__llrint) + .machine power4 +ENTRY (__llrint_power4) CALL_MCOUNT stwu r1,-16(r1) cfi_adjust_cfa_offset (16) @@ -31,16 +32,6 @@ ENTRY (__llrint) nop lwz r3,8(r1) lwz r4,12(r1) - addi r1,r1,16 + addi r1,r1,16 blr - END (__llrint) - -weak_alias (__llrint, llrint) - -#ifdef NO_LONG_DOUBLE -strong_alias (__llrint, __llrintl) -weak_alias (__llrint, llrintl) -#endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __llrint, llrintl, GLIBC_2_1) -#endif +END (__llrint_power4) diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-power6.S similarity index 77% copy from sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S copy to sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-power6.S index 86f51bb..8a0ffd6 100644 --- a/sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-power6.S @@ -1,4 +1,4 @@ -/* Round double to long int. PowerPC32 on PowerPC64 version. +/* Round double to long int. PowerPC32/POWER6 version. Copyright (C) 2004-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -20,7 +20,8 @@ #include <math_ldbl_opt.h> /* long long int[r3, r4] __llrint (double x[fp1]) */ -ENTRY (__llrint) + .machine power6 +ENTRY (__llrint_power6) CALL_MCOUNT stwu r1,-16(r1) cfi_adjust_cfa_offset (16) @@ -31,16 +32,6 @@ ENTRY (__llrint) ori r1,r1,0 lwz r3,8(r1) lwz r4,12(r1) - addi r1,r1,16 + addi r1,r1,16 blr - END (__llrint) - -weak_alias (__llrint, llrint) - -#ifdef NO_LONG_DOUBLE -strong_alias (__llrint, __llrintl) -weak_alias (__llrint, llrintl) -#endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __llrint, llrintl, GLIBC_2_1) -#endif +END (__llrint_power6) diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-ppc32.c similarity index 58% copy from sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S copy to sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-ppc32.c index 1b06e2b..ed1d685 100644 --- a/sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-ppc32.c @@ -1,5 +1,5 @@ -/* Round float to long int. PowerPC32 on PowerPC64 version. - Copyright (C) 2004-2013 Free Software Foundation, Inc. +/* Round double to long int. PowerPC32 default version. + 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 @@ -16,23 +16,16 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> +#include <math_ldbl_opt.h> -/* long long int[r3, r4] __llrintf (float x[fp1]) */ -ENTRY (__llrintf) - CALL_MCOUNT - stwu r1,-16(r1) - cfi_adjust_cfa_offset (16) - fctid fp13,fp1 - stfd fp13,8(r1) -/* Insure the following load is in a different dispatch group by - inserting "group ending nop". */ - ori r1,r1,0 - lwz r3,8(r1) - lwz r4,12(r1) - addi r1,r1,16 - blr - END (__llrintf) +#undef __llrint +#define __llrint __llrint_ppc32 -weak_alias (__llrintf, llrintf) +#undef weak_alias +#define weak_alias(a, b) +#undef strong_alias +#define strong_alias(a, b) +#undef compat_symbol +#define compat_symbol(a, b, c, d) +#include <sysdeps/powerpc/powerpc32/fpu/s_llrint.c> diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint.c similarity index 62% rename from sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint.c index 86f51bb..15a9c10 100644 --- a/sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint.c @@ -1,5 +1,5 @@ -/* Round double to long int. PowerPC32 on PowerPC64 version. - Copyright (C) 2004-2013 Free Software Foundation, Inc. +/* Multiple versions of llrint. + 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 @@ -16,24 +16,21 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> +#include <math.h> #include <math_ldbl_opt.h> +#include <shlib-compat.h> +#include "init-arch.h" -/* long long int[r3, r4] __llrint (double x[fp1]) */ -ENTRY (__llrint) - CALL_MCOUNT - stwu r1,-16(r1) - cfi_adjust_cfa_offset (16) - fctid fp13,fp1 - stfd fp13,8(r1) -/* Insure the following load is in a different dispatch group by - inserting "group ending nop". */ - ori r1,r1,0 - lwz r3,8(r1) - lwz r4,12(r1) - addi r1,r1,16 - blr - END (__llrint) +extern __typeof (__llrint) __llrint_ppc32 attribute_hidden; +extern __typeof (__llrint) __llrint_power4 attribute_hidden; +extern __typeof (__llrint) __llrint_power6 attribute_hidden; + +libc_ifunc (__llrint, + (hwcap & PPC_FEATURE_ARCH_2_05) + ? __llrint_power6 : + (hwcap & PPC_FEATURE_POWER4) + ? __llrint_power4 + : __llrint_ppc32); weak_alias (__llrint, llrint) @@ -42,5 +39,5 @@ strong_alias (__llrint, __llrintl) weak_alias (__llrint, llrintl) #endif #if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __llrint, llrintl, GLIBC_2_1) +compat_symbol (libm, __llrint, llrintl, GLIBC_2_1); #endif diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-power4.S similarity index 88% copy from sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S copy to sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-power4.S index 98e3aaf..02799fd 100644 --- a/sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-power4.S @@ -1,4 +1,4 @@ -/* Round float to long int. PowerPC32 on PowerPC64 version. +/* Round float to long int. PowerPC32/POWER4 version. Copyright (C) 2004-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -19,7 +19,8 @@ #include <sysdep.h> /* long long int[r3, r4] __llrintf (float x[fp1]) */ -ENTRY (__llrintf) + .machine power4 +ENTRY (__llrintf_power4) CALL_MCOUNT stwu r1,-16(r1) cfi_adjust_cfa_offset (16) @@ -30,9 +31,6 @@ ENTRY (__llrintf) nop lwz r3,8(r1) lwz r4,12(r1) - addi r1,r1,16 + addi r1,r1,16 blr - END (__llrintf) - -weak_alias (__llrintf, llrintf) - +END (__llrintf_power4) diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-power6.S similarity index 88% copy from sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S copy to sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-power6.S index 1b06e2b..07af3cc 100644 --- a/sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-power6.S @@ -1,4 +1,4 @@ -/* Round float to long int. PowerPC32 on PowerPC64 version. +/* Round float to long int. PowerPC32/POWER6 version. Copyright (C) 2004-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -19,7 +19,8 @@ #include <sysdep.h> /* long long int[r3, r4] __llrintf (float x[fp1]) */ -ENTRY (__llrintf) + .machine power6 +ENTRY (__llrintf_power6) CALL_MCOUNT stwu r1,-16(r1) cfi_adjust_cfa_offset (16) @@ -30,9 +31,6 @@ ENTRY (__llrintf) ori r1,r1,0 lwz r3,8(r1) lwz r4,12(r1) - addi r1,r1,16 + addi r1,r1,16 blr - END (__llrintf) - -weak_alias (__llrintf, llrintf) - +END (__llrintf_power6) diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-ppc32.c similarity index 63% rename from sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-ppc32.c index 1b06e2b..2ea3c4a 100644 --- a/sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-ppc32.c @@ -1,4 +1,4 @@ -/* Round float to long int. PowerPC32 on PowerPC64 version. +/* Round float to long int. PowerPC32 default version. Copyright (C) 2004-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -16,23 +16,12 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> +#include <math.h> -/* long long int[r3, r4] __llrintf (float x[fp1]) */ -ENTRY (__llrintf) - CALL_MCOUNT - stwu r1,-16(r1) - cfi_adjust_cfa_offset (16) - fctid fp13,fp1 - stfd fp13,8(r1) -/* Insure the following load is in a different dispatch group by - inserting "group ending nop". */ - ori r1,r1,0 - lwz r3,8(r1) - lwz r4,12(r1) - addi r1,r1,16 - blr - END (__llrintf) +#undef __llrintf +#define __llrintf __llrintf_ppc32 -weak_alias (__llrintf, llrintf) +#undef weak_alias +#define weak_alias(a,b) +#include <sysdeps/powerpc/powerpc32/fpu/s_llrintf.c> diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf.c similarity index 59% rename from sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf.c index 98e3aaf..d4aeed1 100644 --- a/sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf.c @@ -1,5 +1,5 @@ -/* Round float to long int. PowerPC32 on PowerPC64 version. - Copyright (C) 2004-2013 Free Software Foundation, Inc. +/* Multiple versions of llrintf. + 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 @@ -16,23 +16,19 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> +#include <math.h> +#include <shlib-compat.h> +#include "init-arch.h" -/* long long int[r3, r4] __llrintf (float x[fp1]) */ -ENTRY (__llrintf) - CALL_MCOUNT - stwu r1,-16(r1) - cfi_adjust_cfa_offset (16) - fctid fp13,fp1 - stfd fp13,8(r1) - nop /* Insure the following load is in a different dispatch group */ - nop /* to avoid pipe stall on POWER4&5. */ - nop - lwz r3,8(r1) - lwz r4,12(r1) - addi r1,r1,16 - blr - END (__llrintf) +extern __typeof (__llrintf) __llrintf_ppc32 attribute_hidden; +extern __typeof (__llrintf) __llrintf_power4 attribute_hidden; +extern __typeof (__llrintf) __llrintf_power6 attribute_hidden; -weak_alias (__llrintf, llrintf) +libc_ifunc (__llrintf, + (hwcap & PPC_FEATURE_ARCH_2_05) + ? __llrintf_power6 : + (hwcap & PPC_FEATURE_POWER4) + ? __llrintf_power4 + : __llrintf_ppc32); +weak_alias (__llrintf, llrintf) http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=419b213681085f0261a8f55a3c8922bda907b5c7 commit 419b213681085f0261a8f55a3c8922bda907b5c7 Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 08:55:21 2013 -0500 PowerPC: change sysdeps fpu folder This patch makes the fpu/multiarch folder appears in front of the powerpc/fpu folder. diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/Implies deleted file mode 100644 index 9f70f79..0000000 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/Implies +++ /dev/null @@ -1,2 +0,0 @@ -# Override ldbl-opt with powerpc32 specific routines. -powerpc/powerpc32/fpu http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=98d255d5873b72cc0cf49099d3548f87f5d20414 commit 98d255d5873b72cc0cf49099d3548f87f5d20414 Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 08:54:43 2013 -0500 PowerPC: wordcopy multilib functions for PowerPC32 diff --git a/string/wordcopy.c b/string/wordcopy.c index 726894b..51c1fad 100644 --- a/string/wordcopy.c +++ b/string/wordcopy.c @@ -26,11 +26,12 @@ block beginning at DSTP with LEN `op_t' words (not LEN bytes!). Both SRCP and DSTP should be aligned for memory operations on `op_t's. */ +#ifndef WORDCOPY_FWD_ALIGNED +# define WORDCOPY_FWD_ALIGNED _wordcopy_fwd_aligned +#endif + void -_wordcopy_fwd_aligned (dstp, srcp, len) - long int dstp; - long int srcp; - size_t len; +WORDCOPY_FWD_ALIGNED (long int dstp, long int srcp, size_t len) { op_t a0, a1; @@ -134,11 +135,12 @@ _wordcopy_fwd_aligned (dstp, srcp, len) DSTP should be aligned for memory operations on `op_t's, but SRCP must *not* be aligned. */ +#ifndef WORDCOPY_FWD_DEST_ALIGNED +# define WORDCOPY_FWD_DEST_ALIGNED _wordcopy_fwd_dest_aligned +#endif + void -_wordcopy_fwd_dest_aligned (dstp, srcp, len) - long int dstp; - long int srcp; - size_t len; +WORDCOPY_FWD_DEST_ALIGNED (long int dstp, long int srcp, size_t len) { op_t a0, a1, a2, a3; int sh_1, sh_2; @@ -221,11 +223,12 @@ _wordcopy_fwd_dest_aligned (dstp, srcp, len) (not LEN bytes!). Both SRCP and DSTP should be aligned for memory operations on `op_t's. */ +#ifndef WORDCOPY_BWD_ALIGNED +# define WORDCOPY_BWD_ALIGNED _wordcopy_bwd_aligned +#endif + void -_wordcopy_bwd_aligned (dstp, srcp, len) - long int dstp; - long int srcp; - size_t len; +WORDCOPY_BWD_ALIGNED (long int dstp, long int srcp, size_t len) { op_t a0, a1; @@ -329,11 +332,12 @@ _wordcopy_bwd_aligned (dstp, srcp, len) words (not LEN bytes!). DSTP should be aligned for memory operations on `op_t', but SRCP must *not* be aligned. */ +#ifndef WORDCOPY_BWD_DEST_ALIGNED +# define WORDCOPY_BWD_DEST_ALIGNED _wordcopy_bwd_dest_aligned +#endif + void -_wordcopy_bwd_dest_aligned (dstp, srcp, len) - long int dstp; - long int srcp; - size_t len; +WORDCOPY_BWD_DEST_ALIGNED (long int dstp, long int srcp, size_t len) { op_t a0, a1, a2, a3; int sh_1, sh_2; diff --git a/sysdeps/powerpc/powerpc32/power4/wordcopy.c b/sysdeps/powerpc/power4/wordcopy.c similarity index 87% rename from sysdeps/powerpc/powerpc32/power4/wordcopy.c rename to sysdeps/powerpc/power4/wordcopy.c index 6dd0fa3..f4ba355 100644 --- a/sysdeps/powerpc/powerpc32/power4/wordcopy.c +++ b/sysdeps/powerpc/power4/wordcopy.c @@ -26,18 +26,19 @@ block beginning at DSTP with LEN `op_t' words (not LEN bytes!). Both SRCP and DSTP should be aligned for memory operations on `op_t's. */ +#ifndef WORDCOPY_FWD_ALIGNED +# define WORDCOPY_FWD_ALIGNED _wordcopy_fwd_aligned +#endif + void -_wordcopy_fwd_aligned (dstp, srcp, len) - long int dstp; - long int srcp; - size_t len; +WORDCOPY_FWD_ALIGNED (long int dstp, long int srcp, size_t len) { op_t a0, a1; if (len & 1) { ((op_t *) dstp)[0] = ((op_t *) srcp)[0]; - + if (len == 1) return; srcp += OPSIZ; @@ -64,11 +65,12 @@ _wordcopy_fwd_aligned (dstp, srcp, len) DSTP should be aligned for memory operations on `op_t's, but SRCP must *not* be aligned. */ +#ifndef WORDCOPY_FWD_DEST_ALIGNED +# define WORDCOPY_FWD_DEST_ALIGNED _wordcopy_fwd_dest_aligned +#endif + void -_wordcopy_fwd_dest_aligned (dstp, srcp, len) - long int dstp; - long int srcp; - size_t len; +WORDCOPY_FWD_DEST_ALIGNED (long int dstp, long int srcp, size_t len) { op_t a0, a1, a2; int sh_1, sh_2; @@ -88,10 +90,10 @@ _wordcopy_fwd_dest_aligned (dstp, srcp, len) { a1 = ((op_t *) srcp)[1]; ((op_t *) dstp)[0] = MERGE (a0, sh_1, a1, sh_2); - + if (len == 1) return; - + a0 = a1; srcp += OPSIZ; dstp += OPSIZ; @@ -118,11 +120,12 @@ _wordcopy_fwd_dest_aligned (dstp, srcp, len) (not LEN bytes!). Both SRCP and DSTP should be aligned for memory operations on `op_t's. */ +#ifndef WORDCOPY_BWD_ALIGNED +# define WORDCOPY_BWD_ALIGNED _wordcopy_bwd_aligned +#endif + void -_wordcopy_bwd_aligned (dstp, srcp, len) - long int dstp; - long int srcp; - size_t len; +WORDCOPY_BWD_ALIGNED (long int dstp, long int srcp, size_t len) { op_t a0, a1; @@ -131,7 +134,7 @@ _wordcopy_bwd_aligned (dstp, srcp, len) srcp -= OPSIZ; dstp -= OPSIZ; ((op_t *) dstp)[0] = ((op_t *) srcp)[0]; - + if (len == 1) return; len -= 1; @@ -157,11 +160,12 @@ _wordcopy_bwd_aligned (dstp, srcp, len) words (not LEN bytes!). DSTP should be aligned for memory operations on `op_t', but SRCP must *not* be aligned. */ +#ifndef WORDCOPY_BWD_DEST_ALIGNED +# define WORDCOPY_BWD_DEST_ALIGNED _wordcopy_bwd_dest_aligned +#endif + void -_wordcopy_bwd_dest_aligned (dstp, srcp, len) - long int dstp; - long int srcp; - size_t len; +WORDCOPY_BWD_DEST_ALIGNED (long int dstp, long int srcp, size_t len) { op_t a0, a1, a2; int sh_1, sh_2; diff --git a/sysdeps/powerpc/powerpc32/power6/wordcopy.c b/sysdeps/powerpc/power6/wordcopy.c similarity index 89% rename from sysdeps/powerpc/powerpc32/power6/wordcopy.c rename to sysdeps/powerpc/power6/wordcopy.c index bcb6176..a6add27 100644 --- a/sysdeps/powerpc/powerpc32/power6/wordcopy.c +++ b/sysdeps/powerpc/power6/wordcopy.c @@ -27,18 +27,19 @@ block beginning at DSTP with LEN `op_t' words (not LEN bytes!). Both SRCP and DSTP should be aligned for memory operations on `op_t's. */ +#ifndef WORDCOPY_FWD_ALIGNED +# define WORDCOPY_FWD_ALIGNED _wordcopy_fwd_aligned +#endif + void -_wordcopy_fwd_aligned (dstp, srcp, len) - long int dstp; - long int srcp; - size_t len; +WORDCOPY_FWD_ALIGNED (long int dstp, long int srcp, size_t len) { op_t a0, a1; if (len & 1) { ((op_t *) dstp)[0] = ((op_t *) srcp)[0]; - + if (len == 1) return; srcp += OPSIZ; @@ -65,6 +66,10 @@ _wordcopy_fwd_aligned (dstp, srcp, len) DSTP should be aligned for memory operations on `op_t's, but SRCP must *not* be aligned. */ +#ifndef WORDCOPY_FWD_DEST_ALIGNED +# define WORDCOPY_FWD_DEST_ALIGNED _wordcopy_fwd_dest_aligned +#endif + #define fwd_align_merge(align) \ do \ { \ @@ -80,10 +85,7 @@ _wordcopy_fwd_aligned (dstp, srcp, len) while (len != 0) void -_wordcopy_fwd_dest_aligned (dstp, srcp, len) - long int dstp; - long int srcp; - size_t len; +WORDCOPY_FWD_DEST_ALIGNED (long int dstp, long int srcp, size_t len) { op_t a0, a1, a2; int sh_1, sh_2; @@ -105,10 +107,10 @@ _wordcopy_fwd_dest_aligned (dstp, srcp, len) { a1 = ((op_t *) srcp)[1]; ((op_t *) dstp)[0] = MERGE (a0, sh_1, a1, sh_2); - + if (len == 1) return; - + a0 = a1; srcp += OPSIZ; dstp += OPSIZ; @@ -124,11 +126,12 @@ _wordcopy_fwd_dest_aligned (dstp, srcp, len) (not LEN bytes!). Both SRCP and DSTP should be aligned for memory operations on `op_t's. */ +#ifndef WORDCOPY_BWD_ALIGNED +# define WORDCOPY_BWD_ALIGNED _wordcopy_bwd_aligned +#endif + void -_wordcopy_bwd_aligned (dstp, srcp, len) - long int dstp; - long int srcp; - size_t len; +WORDCOPY_BWD_ALIGNED (long int dstp, long int srcp, size_t len) { op_t a0, a1; @@ -137,7 +140,7 @@ _wordcopy_bwd_aligned (dstp, srcp, len) srcp -= OPSIZ; dstp -= OPSIZ; ((op_t *) dstp)[0] = ((op_t *) srcp)[0]; - + if (len == 1) return; len -= 1; @@ -158,6 +161,16 @@ _wordcopy_bwd_aligned (dstp, srcp, len) while (len != 0); } + +/* _wordcopy_bwd_dest_aligned -- Copy block finishing right + before SRCP to block finishing right before DSTP with LEN `op_t' + words (not LEN bytes!). DSTP should be aligned for memory + operations on `op_t', but SRCP must *not* be aligned. */ + +#ifndef WORDCOPY_BWD_DEST_ALIGNED +# define WORDCOPY_BWD_DEST_ALIGNED _wordcopy_bwd_dest_aligned +#endif + #define bwd_align_merge(align) \ do \ { \ @@ -172,16 +185,8 @@ _wordcopy_bwd_aligned (dstp, srcp, len) } \ while (len != 0) -/* _wordcopy_bwd_dest_aligned -- Copy block finishing right - before SRCP to block finishing right before DSTP with LEN `op_t' - words (not LEN bytes!). DSTP should be aligned for memory - operations on `op_t', but SRCP must *not* be aligned. */ - void -_wordcopy_bwd_dest_aligned (dstp, srcp, len) - long int dstp; - long int srcp; - size_t len; +WORDCOPY_BWD_DEST_ALIGNED (long int dstp, long int srcp, size_t len) { op_t a0, a1, a2; int sh_1, sh_2; diff --git a/sysdeps/powerpc/powerpc32/multiarch/Makefile b/sysdeps/powerpc/powerpc32/multiarch/Makefile index 3c6d09e..57994be 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/multiarch/Makefile @@ -10,7 +10,9 @@ sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \ strncase-power7 strncase_l-power7 strchrnul-power7 \ strchrnul-ppc32 strchr-power7 strchr-ppc32 wcschr-power7 \ wcschr-power6 wcschr-ppc32 wcsrchr-power7 wcsrchr-power6 \ - wcsrchr-ppc32 + wcsrchr-ppc32 wcscpy-power7 wcscpy-power6 wcscpy-ppc32 \ + wordcopy-power7 wordcopy-power6 wordcopy-power5 \ + wordcopy-power4 wordcopy-ppc32 CFLAGS-strncase-power7.c += -mcpu=power7 -funroll-loops CFLAGS-strncase_l-power7.c += -mcpu=power7 -funroll-loops @@ -18,4 +20,6 @@ CFLAGS-wcschr-power7.c += -mcpu=power7 CFLAGS-wcschr-power6.c += -mcpu=power6 CFLAGS-wcsrchr-power7.c += -mcpu=power7 CFLAGS-wcsrchr-power6.c += -mcpu=power6 +CFLAGS-wcscpy-power7.c += -mcpu=power7 +CFLAGS-wcscpy-power6.c += -mcpu=power6 endif diff --git a/sysdeps/powerpc/powerpc32/multiarch/wordcopy-power4.c b/sysdeps/powerpc/powerpc32/multiarch/wordcopy-power4.c new file mode 100644 index 0000000..866f549 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/wordcopy-power4.c @@ -0,0 +1,23 @@ +/* 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/>. */ + +#define WORDCOPY_FWD_ALIGNED _wordcopy_fwd_aligned_power4 +#define WORDCOPY_FWD_DEST_ALIGNED _wordcopy_fwd_dest_aligned_power4 +#define WORDCOPY_BWD_ALIGNED _wordcopy_bwd_aligned_power4 +#define WORDCOPY_BWD_DEST_ALIGNED _wordcopy_bwd_dest_aligned_power4 + +#include <sysdeps/powerpc/power4/wordcopy.c> diff --git a/sysdeps/powerpc/powerpc32/multiarch/wordcopy-power5.c b/sysdeps/powerpc/powerpc32/multiarch/wordcopy-power5.c new file mode 100644 index 0000000..7652180 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/wordcopy-power5.c @@ -0,0 +1,23 @@ +/* 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/>. */ + +#define WORDCOPY_FWD_ALIGNED _wordcopy_fwd_aligned_power5 +#define WORDCOPY_FWD_DEST_ALIGNED _wordcopy_fwd_dest_aligned_power5 +#define WORDCOPY_BWD_ALIGNED _wordcopy_bwd_aligned_power5 +#define WORDCOPY_BWD_DEST_ALIGNED _wordcopy_bwd_dest_aligned_power5 + +#include <sysdeps/powerpc/power4/wordcopy.c> diff --git a/sysdeps/powerpc/powerpc32/multiarch/wordcopy-power6.c b/sysdeps/powerpc/powerpc32/multiarch/wordcopy-power6.c new file mode 100644 index 0000000..b8edd10 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/wordcopy-power6.c @@ -0,0 +1,23 @@ +/* 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/>. */ + +#define WORDCOPY_FWD_ALIGNED _wordcopy_fwd_aligned_power6 +#define WORDCOPY_FWD_DEST_ALIGNED _wordcopy_fwd_dest_aligned_power6 +#define WORDCOPY_BWD_ALIGNED _wordcopy_bwd_aligned_power6 +#define WORDCOPY_BWD_DEST_ALIGNED _wordcopy_bwd_dest_aligned_power6 + +#include <sysdeps/powerpc/power6/wordcopy.c> diff --git a/sysdeps/powerpc/powerpc32/multiarch/wordcopy-power7.c b/sysdeps/powerpc/powerpc32/multiarch/wordcopy-power7.c new file mode 100644 index 0000000..e7999c3 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/wordcopy-power7.c @@ -0,0 +1,23 @@ +/* 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/>. */ + +#define WORDCOPY_FWD_ALIGNED _wordcopy_fwd_aligned_power7 +#define WORDCOPY_FWD_DEST_ALIGNED _wordcopy_fwd_dest_aligned_power7 +#define WORDCOPY_BWD_ALIGNED _wordcopy_bwd_aligned_power7 +#define WORDCOPY_BWD_DEST_ALIGNED _wordcopy_bwd_dest_aligned_power7 + +#include <sysdeps/powerpc/power6/wordcopy.c> diff --git a/sysdeps/powerpc/powerpc32/multiarch/wordcopy-ppc32.c b/sysdeps/powerpc/powerpc32/multiarch/wordcopy-ppc32.c new file mode 100644 index 0000000..3e8c471 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/wordcopy-ppc32.c @@ -0,0 +1,23 @@ +/* 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/>. */ + +#define WORDCOPY_FWD_ALIGNED _wordcopy_fwd_aligned_ppc32 +#define WORDCOPY_FWD_DEST_ALIGNED _wordcopy_fwd_dest_aligned_ppc32 +#define WORDCOPY_BWD_ALIGNED _wordcopy_bwd_aligned_ppc32 +#define WORDCOPY_BWD_DEST_ALIGNED _wordcopy_bwd_dest_aligned_ppc32 + +#include <string/wordcopy.c> diff --git a/sysdeps/powerpc/powerpc32/multiarch/wordcopy.c b/sysdeps/powerpc/powerpc32/multiarch/wordcopy.c new file mode 100644 index 0000000..9d2fe34 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/wordcopy.c @@ -0,0 +1,118 @@ +/* Multiple versions of wordcopy functions. + 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/>. */ + +#ifndef NOT_IN_libc +# include <stddef.h> +# include <memcopy.h> +# include <shlib-compat.h> +# include "init-arch.h" + +extern __typeof (_wordcopy_fwd_aligned) _wordcopy_fwd_aligned_ppc32 +attribute_hidden; +extern __typeof (_wordcopy_fwd_aligned) _wordcopy_fwd_aligned_power4 +attribute_hidden; +extern __typeof (_wordcopy_fwd_aligned) _wordcopy_fwd_aligned_power5 +attribute_hidden; +extern __typeof (_wordcopy_fwd_aligned) _wordcopy_fwd_aligned_power6 +attribute_hidden; +extern __typeof (_wordcopy_fwd_aligned) _wordcopy_fwd_aligned_power7 +attribute_hidden; + +libc_ifunc (_wordcopy_fwd_aligned, + (hwcap & PPC_FEATURE_HAS_VSX) + ? _wordcopy_fwd_aligned_power7 : + (hwcap & PPC_FEATURE_ARCH_2_05) + ? _wordcopy_fwd_aligned_power6 : + (hwcap & PPC_FEATURE_POWER5) + ? _wordcopy_fwd_aligned_power5 : + (hwcap & PPC_FEATURE_POWER4) + ? _wordcopy_fwd_aligned_power4 + : _wordcopy_fwd_aligned_ppc32); + + +extern __typeof (_wordcopy_fwd_dest_aligned) _wordcopy_fwd_dest_aligned_ppc32 +attribute_hidden; +extern __typeof (_wordcopy_fwd_dest_aligned) _wordcopy_fwd_dest_aligned_power4 +attribute_hidden; +extern __typeof (_wordcopy_fwd_dest_aligned) _wordcopy_fwd_dest_aligned_power5 +attribute_hidden; +extern __typeof (_wordcopy_fwd_dest_aligned) _wordcopy_fwd_dest_aligned_power6 +attribute_hidden; +extern __typeof (_wordcopy_fwd_dest_aligned) _wordcopy_fwd_dest_aligned_power7 +attribute_hidden; + +libc_ifunc (_wordcopy_fwd_dest_aligned, + (hwcap & PPC_FEATURE_HAS_VSX) + ? _wordcopy_fwd_dest_aligned_power7 : + (hwcap & PPC_FEATURE_ARCH_2_05) + ? _wordcopy_fwd_dest_aligned_power6 : + (hwcap & PPC_FEATURE_POWER5) + ? _wordcopy_fwd_dest_aligned_power5 : + (hwcap & PPC_FEATURE_POWER4) + ? _wordcopy_fwd_dest_aligned_power4 + : _wordcopy_fwd_dest_aligned_ppc32); + + +extern __typeof (_wordcopy_bwd_aligned) _wordcopy_bwd_aligned_ppc32 +attribute_hidden; +extern __typeof (_wordcopy_bwd_aligned) _wordcopy_bwd_aligned_power4 +attribute_hidden; +extern __typeof (_wordcopy_bwd_aligned) _wordcopy_bwd_aligned_power5 +attribute_hidden; +extern __typeof (_wordcopy_bwd_aligned) _wordcopy_bwd_aligned_power6 +attribute_hidden; +extern __typeof (_wordcopy_bwd_aligned) _wordcopy_bwd_aligned_power7 +attribute_hidden; + +libc_ifunc (_wordcopy_bwd_aligned, + (hwcap & PPC_FEATURE_HAS_VSX) + ? _wordcopy_bwd_aligned_power7 : + (hwcap & PPC_FEATURE_ARCH_2_05) + ? _wordcopy_bwd_aligned_power6 : + (hwcap & PPC_FEATURE_POWER5) + ? _wordcopy_bwd_aligned_power5 : + (hwcap & PPC_FEATURE_POWER4) + ? _wordcopy_bwd_aligned_power4 + : _wordcopy_bwd_aligned_ppc32); + + +extern __typeof (_wordcopy_bwd_dest_aligned) _wordcopy_bwd_dest_aligned_ppc32 +attribute_hidden; +extern __typeof (_wordcopy_bwd_dest_aligned) _wordcopy_bwd_dest_aligned_power4 +attribute_hidden; +extern __typeof (_wordcopy_bwd_dest_aligned) _wordcopy_bwd_dest_aligned_power5 +attribute_hidden; +extern __typeof (_wordcopy_bwd_dest_aligned) _wordcopy_bwd_dest_aligned_power6 +attribute_hidden; +extern __typeof (_wordcopy_bwd_dest_aligned) _wordcopy_bwd_dest_aligned_power7 +attribute_hidden; + +libc_ifunc (_wordcopy_bwd_dest_aligned, + (hwcap & PPC_FEATURE_HAS_VSX) + ? _wordcopy_bwd_dest_aligned_power7 : + (hwcap & PPC_FEATURE_ARCH_2_05) + ? _wordcopy_bwd_dest_aligned_power6 : + (hwcap & PPC_FEATURE_POWER5) + ? _wordcopy_bwd_dest_aligned_power5 : + (hwcap & PPC_FEATURE_POWER4) + ? _wordcopy_bwd_dest_aligned_power4 + : _wordcopy_bwd_dest_aligned_ppc32); + +#else +#include "string/wordcopy.c" +#endif http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=1c117d120c6ae02a44d0c43fa600b1b1ddbdf4a8 commit 1c117d120c6ae02a44d0c43fa600b1b1ddbdf4a8 Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 08:48:51 2013 -0500 PowerPC: wcscpy multilib for PowerPC32 diff --git a/sysdeps/powerpc/powerpc32/power6/wcscpy.c b/sysdeps/powerpc/power6/wcscpy.c similarity index 96% rename from sysdeps/powerpc/powerpc32/power6/wcscpy.c rename to sysdeps/powerpc/power6/wcscpy.c index 5950ef3..fccb19e 100644 --- a/sysdeps/powerpc/powerpc32/power6/wcscpy.c +++ b/sysdeps/powerpc/power6/wcscpy.c @@ -19,12 +19,13 @@ #include <stddef.h> #include <wchar.h> +#ifndef WCSCPY +# define WCSCPY wcscpy +#endif /* Copy SRC to DEST. */ wchar_t * -wcscpy (dest, src) - wchar_t *dest; - const wchar_t *src; +WCSCPY (wchar_t *dest, const wchar_t *src) { wint_t c,d; wchar_t *wcp, *wcp2; diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c index b39e3f0..43f6de4 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c +++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c @@ -146,6 +146,17 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, IFUNC_IMPL_ADD (array, i, wcsrchr, 1, __wcsrchr_ppc32)) + /* Support sysdeps/powerpc/powerpc32/multiarch/wcscpy.c. */ + IFUNC_IMPL (i, name, wcscpy, + IFUNC_IMPL_ADD (array, i, wcscpy, + hwcap & PPC_FEATURE_HAS_VSX, + __wcscpy_power7) + IFUNC_IMPL_ADD (array, i, wcscpy, + hwcap & PPC_FEATURE_ARCH_2_05, + __wcscpy_power6) + IFUNC_IMPL_ADD (array, i, wcscpy, 1, + __wcscpy_ppc32)) + #ifdef SHARED /* Support sysdeps/powerpc/powerpc32/multiarch/memset.c. */ IFUNC_IMPL (i, name, memset, diff --git a/sysdeps/powerpc/powerpc32/multiarch/wcscpy-power6.c b/sysdeps/powerpc/powerpc32/multiarch/wcscpy-power6.c new file mode 100644 index 0000000..33f9b2c --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/wcscpy-power6.c @@ -0,0 +1,20 @@ +/* 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/>. */ + +#define WCSCPY __wcscpy_power6 + +#include <sysdeps/powerpc/power6/wcscpy.c> diff --git a/sysdeps/powerpc/powerpc32/multiarch/wcscpy-power7.c b/sysdeps/powerpc/powerpc32/multiarch/wcscpy-power7.c new file mode 100644 index 0000000..2dbec11 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/wcscpy-power7.c @@ -0,0 +1,20 @@ +/* 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/>. */ + +#define WCSCPY __wcscpy_power7 + +#include <sysdeps/powerpc/power6/wcscpy.c> diff --git a/wcsmbs/wcscpy.c b/sysdeps/powerpc/powerpc32/multiarch/wcscpy-ppc32.c similarity index 55% copy from wcsmbs/wcscpy.c copy to sysdeps/powerpc/powerpc32/multiarch/wcscpy-ppc32.c index 3b1e0c6..c56b519 100644 --- a/wcsmbs/wcscpy.c +++ b/sysdeps/powerpc/powerpc32/multiarch/wcscpy-ppc32.c @@ -1,6 +1,5 @@ -/* Copyright (C) 1995-2013 Free Software Foundation, Inc. +/* Copyright (C) 2013 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -16,43 +15,12 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <stddef.h> #include <wchar.h> +#ifndef NOT_IN_libc +# define WCSCPY __wcscpy_ppc32 +#endif -/* Copy SRC to DEST. */ -wchar_t * -wcscpy (dest, src) - wchar_t *dest; - const wchar_t *src; -{ - wint_t c; - wchar_t *wcp; +extern __typeof (wcscpy) __wcscpy_ppc32; - if (__alignof__ (wchar_t) >= sizeof (wchar_t)) - { - const ptrdiff_t off = dest - src - 1; - - wcp = (wchar_t *) src; - - do - { - c = *wcp++; - wcp[off] = c; - } - while (c != L'\0'); - } - else - { - wcp = dest; - - do - { - c = *src++; - *wcp++ = c; - } - while (c != L'\0'); - } - - return dest; -} +#include <wcsmbs/wcscpy.c> diff --git a/wcsmbs/wcscpy.c b/sysdeps/powerpc/powerpc32/multiarch/wcscpy.c similarity index 53% copy from wcsmbs/wcscpy.c copy to sysdeps/powerpc/powerpc32/multiarch/wcscpy.c index 3b1e0c6..9e41688 100644 --- a/wcsmbs/wcscpy.c +++ b/sysdeps/powerpc/powerpc32/multiarch/wcscpy.c @@ -1,6 +1,6 @@ -/* Copyright (C) 1995-2013 Free Software Foundation, Inc. +/* Multiple versions of wcscpy + Copyright (C) 2013 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -16,43 +16,21 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <stddef.h> -#include <wchar.h> - - -/* Copy SRC to DEST. */ -wchar_t * -wcscpy (dest, src) - wchar_t *dest; - const wchar_t *src; -{ - wint_t c; - wchar_t *wcp; - - if (__alignof__ (wchar_t) >= sizeof (wchar_t)) - { - const ptrdiff_t off = dest - src - 1; - - wcp = (wchar_t *) src; - - do - { - c = *wcp++; - wcp[off] = c; - } - while (c != L'\0'); - } - else - { - wcp = dest; - - do - { - c = *src++; - *wcp++ = c; - } - while (c != L'\0'); - } - - return dest; -} +#ifndef NOT_IN_libc +# include <wchar.h> +# include <shlib-compat.h> +# include "init-arch.h" + +extern __typeof (wcscpy) __wcscpy_ppc32 attribute_hidden; +extern __typeof (wcscpy) __wcscpy_power6 attribute_hidden; +extern __typeof (wcscpy) __wcscpy_power7 attribute_hidden; + +libc_ifunc (wcscpy, + (hwcap & PPC_FEATURE_HAS_VSX) + ? __wcscpy_power7 : + (hwcap & PPC_FEATURE_ARCH_2_05) + ? __wcscpy_power6 + : __wcscpy_ppc32); +#else +#include <wcsmbs/wcscpy.c> +#endif diff --git a/sysdeps/powerpc/powerpc64/power6/wcscpy.c b/sysdeps/powerpc/powerpc64/power6/wcscpy.c index 57b706a..722c8f9 100644 --- a/sysdeps/powerpc/powerpc64/power6/wcscpy.c +++ b/sysdeps/powerpc/powerpc64/power6/wcscpy.c @@ -1 +1 @@ -#include "../../powerpc32/power6/wcscpy.c" +#include <sysdeps/powerpc/power6/wcscpy.c> diff --git a/wcsmbs/wcscpy.c b/wcsmbs/wcscpy.c index 3b1e0c6..8ee2ed3 100644 --- a/wcsmbs/wcscpy.c +++ b/wcsmbs/wcscpy.c @@ -21,8 +21,12 @@ /* Copy SRC to DEST. */ +#ifndef WCSCPY +# define WCSCPY wcscpy +#endif + wchar_t * -wcscpy (dest, src) +WCSCPY (dest, src) wchar_t *dest; const wchar_t *src; { http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=82fe5402de3d158e2fd7a44b4c127a3547ec8814 commit 82fe5402de3d158e2fd7a44b4c127a3547ec8814 Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 08:46:32 2013 -0500 PowerPC: wcsrchr multilib for PowerPC32 diff --git a/sysdeps/powerpc/power6/wcschr.c b/sysdeps/powerpc/power6/wcschr.c new file mode 100644 index 0000000..7d8b5bd --- /dev/null +++ b/sysdeps/powerpc/power6/wcschr.c @@ -0,0 +1,89 @@ +/* wcschr.c - Wide Character Search for powerpc32/power6. + Copyright (C) 2012-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; see the file COPYING.LIB. If + not, see <http://www.gnu.org/licenses/>. */ + +#include <wchar.h> + +#ifndef WCSCHR +# define WCSCHR wcschr +#endif + +/* Find the first occurrence of WC in WCS. */ +wchar_t * +WCSCHR (register const wchar_t *wcs, register const wchar_t wc) +{ + register const wchar_t *wcs2 = wcs + 1; + + if (*wcs == wc) + return (wchar_t *) wcs; + if (*wcs == L'\0') + return NULL; + + do + { + wcs += 2; + + if (*wcs2 == wc) + return (wchar_t *) wcs2; + if (*wcs2 == L'\0') + return NULL; + wcs2 += 2; + + if (*wcs == wc) + return (wchar_t *) wcs; + if (*wcs == L'\0') + return NULL; + wcs += 2; + + if (*wcs2 == wc) + return (wchar_t *) wcs2; + if (*wcs2 == L'\0') + return NULL; + wcs2 += 2; + + if (*wcs == wc) + return (wchar_t *) wcs; + if (*wcs == L'\0') + return NULL; + wcs += 2; + + if (*wcs2 == wc) + return (wchar_t *) wcs2; + if (*wcs2 == L'\0') + return NULL; + wcs2 += 2; + + if (*wcs == wc) + return (wchar_t *) wcs; + if (*wcs == L'\0') + return NULL; + wcs += 2; + + if (*wcs2 == wc) + return (wchar_t *) wcs2; + if (*wcs2 == L'\0') + return NULL; + wcs2 += 2; + + if (*wcs == wc) + return (wchar_t *) wcs; + } + while (*wcs != L'\0'); + + return NULL; +} +libc_hidden_def (wcschr) diff --git a/sysdeps/powerpc/powerpc32/power6/wcsrchr.c b/sysdeps/powerpc/power6/wcsrchr.c similarity index 94% rename from sysdeps/powerpc/powerpc32/power6/wcsrchr.c rename to sysdeps/powerpc/power6/wcsrchr.c index d0ff9f6..672b2ec 100644 --- a/sysdeps/powerpc/powerpc32/power6/wcsrchr.c +++ b/sysdeps/powerpc/power6/wcsrchr.c @@ -18,12 +18,13 @@ #include <wchar.h> +#ifndef WCSRCHR +# define WCSRCHR wcsrchr +#endif /* Find the last occurrence of WC in WCS. */ wchar_t * -wcsrchr (wcs, wc) - register const wchar_t *wcs; - register const wchar_t wc; +WCSRCHR (register const wchar_t *wcs, register const wchar_t wc) { register const wchar_t *wcs2 = wcs + 1; const wchar_t *retval = NULL; diff --git a/sysdeps/powerpc/powerpc32/multiarch/Makefile b/sysdeps/powerpc/powerpc32/multiarch/Makefile index 83b26a5..3c6d09e 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/multiarch/Makefile @@ -8,8 +8,14 @@ sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \ strnlen-power7 strnlen-ppc32 strncmp-power7 strncmp-power4 \ strncmp-ppc32 strcasecmp-power7 strcasecmp_l-power7 \ strncase-power7 strncase_l-power7 strchrnul-power7 \ - strchrnul-ppc32 strchr-power7 strchr-ppc32 + strchrnul-ppc32 strchr-power7 strchr-ppc32 wcschr-power7 \ + wcschr-power6 wcschr-ppc32 wcsrchr-power7 wcsrchr-power6 \ + wcsrchr-ppc32 CFLAGS-strncase-power7.c += -mcpu=power7 -funroll-loops CFLAGS-strncase_l-power7.c += -mcpu=power7 -funroll-loops +CFLAGS-wcschr-power7.c += -mcpu=power7 +CFLAGS-wcschr-power6.c += -mcpu=power6 +CFLAGS-wcsrchr-power7.c += -mcpu=power7 +CFLAGS-wcsrchr-power6.c += -mcpu=power6 endif diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c index 5ce8bb0..b39e3f0 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c +++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c @@ -135,6 +135,17 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, IFUNC_IMPL_ADD (array, i, wcschr, 1, __wcschr_ppc32)) + /* Support sysdeps/powerpc/powerpc32/multiarch/wcsrchr.c. */ + IFUNC_IMPL (i, name, wcsrchr, + IFUNC_IMPL_ADD (array, i, wcsrchr, + hwcap & PPC_FEATURE_HAS_VSX, + __wcsrchr_power7) + IFUNC_IMPL_ADD (array, i, wcsrchr, + hwcap & PPC_FEATURE_ARCH_2_05, + __wcsrchr_power6) + IFUNC_IMPL_ADD (array, i, wcsrchr, 1, + __wcsrchr_ppc32)) + #ifdef SHARED /* Support sysdeps/powerpc/powerpc32/multiarch/memset.c. */ IFUNC_IMPL (i, name, memset, diff --git a/wcsmbs/wcsrchr.c b/sysdeps/powerpc/powerpc32/multiarch/wcsrchr-power6.c similarity index 63% copy from wcsmbs/wcsrchr.c copy to sysdeps/powerpc/powerpc32/multiarch/wcsrchr-power6.c index 7c3bc96..68fe477 100644 --- a/wcsmbs/wcsrchr.c +++ b/sysdeps/powerpc/powerpc32/multiarch/wcsrchr-power6.c @@ -1,6 +1,5 @@ -/* Copyright (C) 1995-2013 Free Software Foundation, Inc. +/* Copyright (C) 2013 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu> The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -16,21 +15,6 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <wchar.h> +#define WCSRCHR __wcsrchr_power6 - -/* Find the last occurrence of WC in WCS. */ -wchar_t * -wcsrchr (wcs, wc) - register const wchar_t *wcs; - register const wchar_t wc; -{ - const wchar_t *retval = NULL; - - do - if (*wcs == wc) - retval = wcs; - while (*wcs++ != L'\0'); - - return (wchar_t *) retval; -} +#include <sysdeps/powerpc/power6/wcsrchr.c> diff --git a/wcsmbs/wcsrchr.c b/sysdeps/powerpc/powerpc32/multiarch/wcsrchr-power7.c similarity index 63% copy from wcsmbs/wcsrchr.c copy to sysdeps/powerpc/powerpc32/multiarch/wcsrchr-power7.c index 7c3bc96..3422816 100644 --- a/wcsmbs/wcsrchr.c +++ b/sysdeps/powerpc/powerpc32/multiarch/wcsrchr-power7.c @@ -1,6 +1,5 @@ -/* Copyright (C) 1995-2013 Free Software Foundation, Inc. +/* Copyright (C) 2013 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu> The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -16,21 +15,6 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <wchar.h> +#define WCSRCHR __wcsrchr_power7 - -/* Find the last occurrence of WC in WCS. */ -wchar_t * -wcsrchr (wcs, wc) - register const wchar_t *wcs; - register const wchar_t wc; -{ - const wchar_t *retval = NULL; - - do - if (*wcs == wc) - retval = wcs; - while (*wcs++ != L'\0'); - - return (wchar_t *) retval; -} +#include <sysdeps/powerpc/power6/wcsrchr.c> diff --git a/wcsmbs/wcsrchr.c b/sysdeps/powerpc/powerpc32/multiarch/wcsrchr-ppc32.c similarity index 65% copy from wcsmbs/wcsrchr.c copy to sysdeps/powerpc/powerpc32/multiarch/wcsrchr-ppc32.c index 7c3bc96..f1ef823 100644 --- a/wcsmbs/wcsrchr.c +++ b/sysdeps/powerpc/powerpc32/multiarch/wcsrchr-ppc32.c @@ -1,6 +1,5 @@ -/* Copyright (C) 1995-2013 Free Software Foundation, Inc. +/* Copyright (C) 2013 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu> The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -18,19 +17,10 @@ #include <wchar.h> +#ifndef NOT_IN_libc +# define WCSRCHR __wcsrchr_ppc32 +#endif -/* Find the last occurrence of WC in WCS. */ -wchar_t * -wcsrchr (wcs, wc) - register const wchar_t *wcs; - register const wchar_t wc; -{ - const wchar_t *retval = NULL; +extern __typeof (wcsrchr) __wcsrchr_ppc32; - do - if (*wcs == wc) - retval = wcs; - while (*wcs++ != L'\0'); - - return (wchar_t *) retval; -} +#include <wcsmbs/wcsrchr.c> diff --git a/wcsmbs/wcsrchr.c b/sysdeps/powerpc/powerpc32/multiarch/wcsrchr.c similarity index 55% copy from wcsmbs/wcsrchr.c copy to sysdeps/powerpc/powerpc32/multiarch/wcsrchr.c index 7c3bc96..dff3a5d 100644 --- a/wcsmbs/wcsrchr.c +++ b/sysdeps/powerpc/powerpc32/multiarch/wcsrchr.c @@ -1,6 +1,6 @@ -/* Copyright (C) 1995-2013 Free Software Foundation, Inc. +/* Multiple versions of wcsrchr + Copyright (C) 2013 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu> The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -16,21 +16,21 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <wchar.h> - - -/* Find the last occurrence of WC in WCS. */ -wchar_t * -wcsrchr (wcs, wc) - register const wchar_t *wcs; - register const wchar_t wc; -{ - const wchar_t *retval = NULL; - - do - if (*wcs == wc) - retval = wcs; - while (*wcs++ != L'\0'); - - return (wchar_t *) retval; -} +#ifndef NOT_IN_libc +# include <wchar.h> +# include <shlib-compat.h> +# include "init-arch.h" + +extern __typeof (wcsrchr) __wcsrchr_ppc32 attribute_hidden; +extern __typeof (wcsrchr) __wcsrchr_power6 attribute_hidden; +extern __typeof (wcsrchr) __wcsrchr_power7 attribute_hidden; + +libc_ifunc (wcsrchr, + (hwcap & PPC_FEATURE_HAS_VSX) + ? __wcsrchr_power7 : + (hwcap & PPC_FEATURE_ARCH_2_05) + ? __wcsrchr_power6 + : __wcsrchr_ppc32); +#else +#include <wcsmbs/wcsrchr.c> +#endif diff --git a/sysdeps/powerpc/powerpc64/power6/wcsrchr.c b/sysdeps/powerpc/powerpc64/power6/wcsrchr.c index 2327c05..b86472d 100644 --- a/sysdeps/powerpc/powerpc64/power6/wcsrchr.c +++ b/sysdeps/powerpc/powerpc64/power6/wcsrchr.c @@ -1 +1 @@ -#include "../../powerpc32/power6/wcsrchr.c" +#include <sysdeps/powerpc/power6/wcsrchr.c> diff --git a/wcsmbs/wcsrchr.c b/wcsmbs/wcsrchr.c index 7c3bc96..1481dc9 100644 --- a/wcsmbs/wcsrchr.c +++ b/wcsmbs/wcsrchr.c @@ -20,8 +20,12 @@ /* Find the last occurrence of WC in WCS. */ +#ifndef WCSRCHR +# define WCSRCHR wcsrchr +#endif + wchar_t * -wcsrchr (wcs, wc) +WCSRCHR (wcs, wc) register const wchar_t *wcs; register const wchar_t wc; { http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=e3a57a01490557fc8951cd3845931e232bb8da0e commit e3a57a01490557fc8951cd3845931e232bb8da0e Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 08:43:28 2013 -0500 PowerPC: wcschr multilib for PowerPC32 diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c index cef1f74..5ce8bb0 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c +++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c @@ -124,6 +124,16 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, __strchr_power7) IFUNC_IMPL_ADD (array, i, strchr, 1, __strchr_ppc32)) + /* Support sysdeps/powerpc/powerpc32/multiarch/wcschr.c. */ + IFUNC_IMPL (i, name, wcschr, + IFUNC_IMPL_ADD (array, i, wcschr, + hwcap & PPC_FEATURE_HAS_VSX, + __wcschr_power7) + IFUNC_IMPL_ADD (array, i, wcschr, + hwcap & PPC_FEATURE_ARCH_2_05, + __wcschr_power6) + IFUNC_IMPL_ADD (array, i, wcschr, 1, + __wcschr_ppc32)) #ifdef SHARED /* Support sysdeps/powerpc/powerpc32/multiarch/memset.c. */ diff --git a/sysdeps/powerpc/powerpc32/multiarch/wcschr-power6.c b/sysdeps/powerpc/powerpc32/multiarch/wcschr-power6.c new file mode 100644 index 0000000..54d9972 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/wcschr-power6.c @@ -0,0 +1,26 @@ +/* wcschr.c - Wide Character Search for powerpc32/power6. + 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; see the file COPYING.LIB. If + not, see <http://www.gnu.org/licenses/>. */ + +#include <wchar.h> + +#define WCSCHR __wcschr_power6 + +#undef libc_hidden_def +#define libc_hidden_def(name) + +#include <sysdeps/powerpc/power6/wcschr.c> diff --git a/sysdeps/powerpc/powerpc32/multiarch/wcschr-power7.c b/sysdeps/powerpc/powerpc32/multiarch/wcschr-power7.c new file mode 100644 index 0000000..d7d8469 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/wcschr-power7.c @@ -0,0 +1,26 @@ +/* wcschr.c - Wide Character Search for powerpc32/power7. + 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; see the file COPYING.LIB. If + not, see <http://www.gnu.org/licenses/>. */ + +#include <wchar.h> + +#define WCSCHR __wcschr_power7 + +#undef libc_hidden_def +#define libc_hidden_def(name) + +#include <sysdeps/powerpc/power6/wcschr.c> diff --git a/sysdeps/powerpc/powerpc32/multiarch/wcschr-ppc32.c b/sysdeps/powerpc/powerpc32/multiarch/wcschr-ppc32.c new file mode 100644 index 0000000..80f49ab --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/wcschr-ppc32.c @@ -0,0 +1,31 @@ +/* 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 <wchar.h> + +#ifndef NOT_IN_libc +# ifdef SHARED +# undef libc_hidden_def +# define libc_hidden_def(name) \ + __hidden_ver1 (__wcschr_ppc32, __GI_wcschr, __wcschr_ppc32); +# endif +# define WCSCHR __wcschr_ppc32 +#endif + +extern __typeof (wcschr) __wcschr_ppc32; + +#include "wcsmbs/wcschr.c" diff --git a/sysdeps/powerpc/powerpc32/multiarch/wcschr.c b/sysdeps/powerpc/powerpc32/multiarch/wcschr.c new file mode 100644 index 0000000..a4718a5 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/wcschr.c @@ -0,0 +1,38 @@ +/* Multiple versions of wcschr + 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/>. */ + +#ifndef NOT_IN_libc +# include <wchar.h> +# include <shlib-compat.h> +# include "init-arch.h" + +extern __typeof (wcschr) __wcschr_ppc32 attribute_hidden; +extern __typeof (wcschr) __wcschr_power6 attribute_hidden; +extern __typeof (wcschr) __wcschr_power7 attribute_hidden; + +libc_ifunc (wcschr, + (hwcap & PPC_FEATURE_HAS_VSX) + ? __wcschr_power7 : + (hwcap & PPC_FEATURE_ARCH_2_05) + ? __wcschr_power6 + : __wcschr_ppc32); +#else +#undef libc_hidden_def +#define libc_hidden_def(a) +#include <wcsmbs/wcschr.c> +#endif diff --git a/sysdeps/powerpc/powerpc32/power6/wcschr.c b/sysdeps/powerpc/powerpc32/power6/wcschr.c deleted file mode 100644 index a989877..0000000 --- a/sysdeps/powerpc/powerpc32/power6/wcschr.c +++ /dev/null @@ -1,88 +0,0 @@ -/* wcschr.c - Wide Character Search for powerpc32/power6. - Copyright (C) 2012-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; see the file COPYING.LIB. If - not, see <http://www.gnu.org/licenses/>. */ - -#include <wchar.h> - - -/* Find the first occurrence of WC in WCS. */ -wchar_t * -wcschr (wcs, wc) - register const wchar_t *wcs; - register const wchar_t wc; -{ - register const wchar_t *wcs2 = wcs + 1; - - if (*wcs == wc) - return (wchar_t *) wcs; - if (*wcs == L'\0') - return NULL; - - do - { - wcs += 2; - - if (*wcs2 == wc) - return (wchar_t *) wcs2; - if (*wcs2 == L'\0') - return NULL; - wcs2 += 2; - - if (*wcs == wc) - return (wchar_t *) wcs; - if (*wcs == L'\0') - return NULL; - wcs += 2; - - if (*wcs2 == wc) - return (wchar_t *) wcs2; - if (*wcs2 == L'\0') - return NULL; - wcs2 += 2; - - if (*wcs == wc) - return (wchar_t *) wcs; - if (*wcs == L'\0') - return NULL; - wcs += 2; - - if (*wcs2 == wc) - return (wchar_t *) wcs2; - if (*wcs2 == L'\0') - return NULL; - wcs2 += 2; - - if (*wcs == wc) - return (wchar_t *) wcs; - if (*wcs == L'\0') - return NULL; - wcs += 2; - - if (*wcs2 == wc) - return (wchar_t *) wcs2; - if (*wcs2 == L'\0') - return NULL; - wcs2 += 2; - - if (*wcs == wc) - return (wchar_t *) wcs; - } - while (*wcs != L'\0'); - - return NULL; -} -libc_hidden_def (wcschr) diff --git a/sysdeps/powerpc/powerpc64/power6/wcschr.c b/sysdeps/powerpc/powerpc64/power6/wcschr.c index 9136c02..ae04a13 100644 --- a/sysdeps/powerpc/powerpc64/power6/wcschr.c +++ b/sysdeps/powerpc/powerpc64/power6/wcschr.c @@ -1 +1 @@ -#include "../../powerpc32/power6/wcschr.c" +#include <sysdeps/powerpc/power6/wcschr.c> http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=a1aebc06b1427f0754358a09d0b5d362f036c28c commit a1aebc06b1427f0754358a09d0b5d362f036c28c Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 08:36:26 2013 -0500 PowerPC: strchr multilib for PowerPC32 diff --git a/sysdeps/powerpc/powerpc32/multiarch/Makefile b/sysdeps/powerpc/powerpc32/multiarch/Makefile index d469746..83b26a5 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/multiarch/Makefile @@ -8,7 +8,7 @@ sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \ strnlen-power7 strnlen-ppc32 strncmp-power7 strncmp-power4 \ strncmp-ppc32 strcasecmp-power7 strcasecmp_l-power7 \ strncase-power7 strncase_l-power7 strchrnul-power7 \ - strchrnul-ppc32 + strchrnul-ppc32 strchr-power7 strchr-ppc32 CFLAGS-strncase-power7.c += -mcpu=power7 -funroll-loops CFLAGS-strncase_l-power7.c += -mcpu=power7 -funroll-loops diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c index b0a5101..cef1f74 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c +++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c @@ -117,6 +117,14 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, IFUNC_IMPL_ADD (array, i, strchrnul, 1, __strchrnul_ppc32)) + /* Support sysdeps/powerpc/powerpc32/multiarch/strchr.c. */ + IFUNC_IMPL (i, name, strchr, + IFUNC_IMPL_ADD (array, i, strchr, + hwcap & PPC_FEATURE_HAS_VSX, + __strchr_power7) + IFUNC_IMPL_ADD (array, i, strchr, 1, + __strchr_ppc32)) + #ifdef SHARED /* Support sysdeps/powerpc/powerpc32/multiarch/memset.c. */ IFUNC_IMPL (i, name, memset, diff --git a/sysdeps/powerpc/powerpc32/multiarch/rtld-strchr.S b/sysdeps/powerpc/powerpc32/multiarch/rtld-strchr.S new file mode 100644 index 0000000..d75786c --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/rtld-strchr.S @@ -0,0 +1,18 @@ +/* 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 <sysdeps/powerpc/powerpc32/strchr.S> diff --git a/sysdeps/powerpc/powerpc32/power7/strchr.S b/sysdeps/powerpc/powerpc32/multiarch/strchr-power7.S similarity index 98% rename from sysdeps/powerpc/powerpc32/power7/strchr.S rename to sysdeps/powerpc/powerpc32/multiarch/strchr-power7.S index 0ecadb2..32bc5bb 100644 --- a/sysdeps/powerpc/powerpc32/power7/strchr.S +++ b/sysdeps/powerpc/powerpc32/multiarch/strchr-power7.S @@ -21,7 +21,7 @@ /* int [r3] strchr (char *s [r3], int c [r4]) */ .machine power7 -ENTRY (strchr) +ENTRY (__strchr_power7) CALL_MCOUNT dcbt 0,r3 clrrwi r8,r3,2 /* Align the address to word boundary. */ @@ -195,6 +195,4 @@ L(done_null): srwi r0,r0,3 /* Convert leading zeros to bytes. */ add r3,r8,r0 /* Return address of the matching null byte. */ blr -END (strchr) -weak_alias (strchr, index) -libc_hidden_builtin_def (strchr) +END (__strchr_power7) diff --git a/sysdeps/powerpc/powerpc32/multiarch/strchr-ppc32.S b/sysdeps/powerpc/powerpc32/multiarch/strchr-ppc32.S new file mode 100644 index 0000000..7f49ae0 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/strchr-ppc32.S @@ -0,0 +1,41 @@ +/* PowerPC32 default implementation of strchr. + 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 <sysdep.h> + +#ifdef SHARED +# undef ENTRY +# define ENTRY(name) \ + .globl C_SYMBOL_NAME(__strchr_ppc32); \ + .type C_SYMBOL_NAME(__strchr_ppc32),@function; \ + .align ALIGNARG(2); \ + C_LABEL(__strchr_ppc32) \ + cfi_startproc; \ + CALL_MCOUNT + +# undef END +# define END(name) \ + cfi_endproc; \ + ASM_SIZE_DIRECTIVE(__strchr_ppc32) \ + +# undef libc_hidden_builtin_def +# define libc_hidden_builtin_def(name) \ + .globl __GI_strchr; __GI_strchr = __strchr_ppc32 +#endif + +#include <sysdeps/powerpc/powerpc32/strchr.S> diff --git a/sysdeps/powerpc/powerpc32/multiarch/strchr.c b/sysdeps/powerpc/powerpc32/multiarch/strchr.c new file mode 100644 index 0000000..b22a686 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/strchr.c @@ -0,0 +1,35 @@ +/* Multiple versions of strchr. + 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/>. */ + +/* Define multiple versions only for definition in libc. */ +#if defined SHARED && !defined NOT_IN_libc +# include <string.h> +# include <shlib-compat.h> +# include "init-arch.h" + +extern __typeof (strchr) __strchr_ppc32 attribute_hidden; +extern __typeof (strchr) __strchr_power7 attribute_hidden; + +/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle + ifunc symbol properly. */ +libc_ifunc (strchr, + (hwcap & PPC_FEATURE_HAS_VSX) + ? __strchr_power7 + : __strchr_ppc32); +weak_alias (strchr, index) +#endif http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=4b9a9ea5b85b93d02f57bb68e2c474525364da39 commit 4b9a9ea5b85b93d02f57bb68e2c474525364da39 Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 08:34:20 2013 -0500 PowerPC: strchrnul multilib for PowerPC32 diff --git a/string/strchrnul.c b/string/strchrnul.c index 1f63572..6ca0e63 100644 --- a/string/strchrnul.c +++ b/string/strchrnul.c @@ -26,10 +26,13 @@ #undef __strchrnul #undef strchrnul +#ifndef STRCHRNUL +# define STRCHRNUL __strchrnul +#endif /* Find the first occurrence of C in S or the final NUL byte. */ char * -__strchrnul (s, c_in) +STRCHRNUL (s, c_in) const char *s; int c_in; { diff --git a/sysdeps/powerpc/powerpc32/multiarch/Makefile b/sysdeps/powerpc/powerpc32/multiarch/Makefile index 9051c62..d469746 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/multiarch/Makefile @@ -7,7 +7,8 @@ sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \ rawmemchr-ppc32 strnlen-power7 strlen-power7 strlen-ppc32 \ strnlen-power7 strnlen-ppc32 strncmp-power7 strncmp-power4 \ strncmp-ppc32 strcasecmp-power7 strcasecmp_l-power7 \ - strncase-power7 strncase_l-power7 + strncase-power7 strncase_l-power7 strchrnul-power7 \ + strchrnul-ppc32 CFLAGS-strncase-power7.c += -mcpu=power7 -funroll-loops CFLAGS-strncase_l-power7.c += -mcpu=power7 -funroll-loops diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c index 4bda54b..b0a5101 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c +++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c @@ -109,6 +109,14 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, IFUNC_IMPL_ADD (array, i, strncasecmp_l, 1, __strncasecmp_l_ppc32)) + /* Support sysdeps/powerpc/powerpc32/multiarch/strchrnul.c. */ + IFUNC_IMPL (i, name, strchrnul, + IFUNC_IMPL_ADD (array, i, strchrnul, + hwcap & PPC_FEATURE_HAS_VSX, + __strchrnul_power7) + IFUNC_IMPL_ADD (array, i, strchrnul, 1, + __strchrnul_ppc32)) + #ifdef SHARED /* Support sysdeps/powerpc/powerpc32/multiarch/memset.c. */ IFUNC_IMPL (i, name, memset, diff --git a/sysdeps/powerpc/powerpc32/power7/strchrnul.S b/sysdeps/powerpc/powerpc32/multiarch/strchrnul-power7.S similarity index 96% rename from sysdeps/powerpc/powerpc32/power7/strchrnul.S rename to sysdeps/powerpc/powerpc32/multiarch/strchrnul-power7.S index d4cacab..fff6be7 100644 --- a/sysdeps/powerpc/powerpc32/power7/strchrnul.S +++ b/sysdeps/powerpc/powerpc32/multiarch/strchrnul-power7.S @@ -21,7 +21,7 @@ /* int [r3] strchrnul (char *s [r3], int c [r4]) */ .machine power7 -ENTRY (__strchrnul) +ENTRY (__strchrnul_power7) CALL_MCOUNT dcbt 0,r3 clrrwi r8,r3,2 /* Align the address to word boundary. */ @@ -109,6 +109,4 @@ L(done): srwi r0,r0,3 /* Convert leading zeros to bytes. */ add r3,r8,r0 /* Return address of matching c/null byte. */ blr -END (__strchrnul) -weak_alias (__strchrnul,strchrnul) -libc_hidden_builtin_def (__strchrnul) +END (__strchrnul_power7) diff --git a/sysdeps/powerpc/powerpc32/multiarch/strchrnul-ppc32.c b/sysdeps/powerpc/powerpc32/multiarch/strchrnul-ppc32.c new file mode 100644 index 0000000..0581ba1 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/strchrnul-ppc32.c @@ -0,0 +1,26 @@ +/* PowerPC32 default implementation of strchrnul. + 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 <string.h> + +#define STRCHRNUL __strchrnul_ppc32 + +#undef weak_alias +#define weak_alias(a,b ) + +#include <string/strchrnul.c> diff --git a/sysdeps/powerpc/powerpc32/multiarch/strchrnul.c b/sysdeps/powerpc/powerpc32/multiarch/strchrnul.c new file mode 100644 index 0000000..b7f97fa --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/strchrnul.c @@ -0,0 +1,37 @@ +/* Multiple versions of strchrnul. + 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/>. */ + +#ifndef NOT_IN_libc +# include <string.h> +# include <shlib-compat.h> +# include "init-arch.h" + +extern __typeof (__strchrnul) __strchrnul_ppc32 attribute_hidden; +extern __typeof (__strchrnul) __strchrnul_power7 attribute_hidden; + +/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle + ifunc symbol properly. */ +libc_ifunc (__strchrnul, + (hwcap & PPC_FEATURE_HAS_VSX) + ? __strchrnul_power7 + : __strchrnul_ppc32); + +weak_alias (__strchrnul, strchrnul) +#else +#include <string/strchrnul.c> +#endif http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=67e29b8bb284460bb3349c38d11e6af89c3cb385 commit 67e29b8bb284460bb3349c38d11e6af89c3cb385 Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 08:31:31 2013 -0500 PowerPC: strncasecmp multilib for PowerPC32 diff --git a/sysdeps/powerpc/powerpc32/multiarch/Makefile b/sysdeps/powerpc/powerpc32/multiarch/Makefile index a520f08..9051c62 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/multiarch/Makefile @@ -6,5 +6,9 @@ sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \ memchr-ppc32 memrchr-power7 memrchr-ppc32 rawmemchr-power7 \ rawmemchr-ppc32 strnlen-power7 strlen-power7 strlen-ppc32 \ strnlen-power7 strnlen-ppc32 strncmp-power7 strncmp-power4 \ - strncmp-ppc32 strcasecmp-power7 strcasecmp_l-power7 + strncmp-ppc32 strcasecmp-power7 strcasecmp_l-power7 \ + strncase-power7 strncase_l-power7 + +CFLAGS-strncase-power7.c += -mcpu=power7 -funroll-loops +CFLAGS-strncase_l-power7.c += -mcpu=power7 -funroll-loops endif diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c index 186986f..4bda54b 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c +++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c @@ -94,6 +94,21 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, IFUNC_IMPL_ADD (array, i, strcasecmp_l, 1, __strcasecmp_l_ppc32)) + /* Support sysdeps/powerpc/powerpc32/multiarch/strncase.c. */ + IFUNC_IMPL (i, name, strncasecmp, + IFUNC_IMPL_ADD (array, i, strncasecmp, + hwcap & PPC_FEATURE_HAS_VSX, + __strncasecmp_power7) + IFUNC_IMPL_ADD (array, i, strncasecmp, 1, __strncasecmp_ppc32)) + + /* Support sysdeps/powerpc/powerpc32/multiarch/strncase_l.c. */ + IFUNC_IMPL (i, name, strncasecmp_l, + IFUNC_IMPL_ADD (array, i, strncasecmp_l, + hwcap & PPC_FEATURE_HAS_VSX, + __strncasecmp_l_power7) + IFUNC_IMPL_ADD (array, i, strncasecmp_l, 1, + __strncasecmp_l_ppc32)) + #ifdef SHARED /* Support sysdeps/powerpc/powerpc32/multiarch/memset.c. */ IFUNC_IMPL (i, name, memset, diff --git a/sysdeps/powerpc/powerpc32/multiarch/strncase-power7.c b/sysdeps/powerpc/powerpc32/multiarch/strncase-power7.c new file mode 100644 index 0000000..22719e1 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/strncase-power7.c @@ -0,0 +1,23 @@ +/* Optimized strcasecmp_l implememtation for POWER7. + 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 <string.h> + +#define __strncasecmp __strncasecmp_power7 +#include <string/strncase.c> diff --git a/sysdeps/powerpc/powerpc32/multiarch/strncase.c b/sysdeps/powerpc/powerpc32/multiarch/strncase.c new file mode 100644 index 0000000..cb9259d --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/strncase.c @@ -0,0 +1,41 @@ +/* Multiple versions of strncasecmp. + 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/>. */ + +#ifndef NOT_IN_libc +# include <string.h> +# define strncasecmp __strncasecmp_ppc32 +extern __typeof (__strncasecmp) __strncasecmp_ppc32 attribute_hidden; +extern __typeof (__strncasecmp) __strncasecmp_power7 attribute_hidden; +#endif + +#include <string/strncase.c> +#undef strncasecmp + +#ifndef NOT_IN_libc +# include <shlib-compat.h> +# include "init-arch.h" + +/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle + ifunc symbol properly. */ +extern __typeof (__strncasecmp) __libc_strncasecmp; +libc_ifunc (__libc_strncasecmp, + (hwcap & PPC_FEATURE_HAS_VSX) + ? __strncasecmp_power7 + : __strncasecmp_ppc32); +weak_alias (__libc_strncasecmp, strncasecmp) +#endif diff --git a/sysdeps/powerpc/powerpc32/multiarch/strncase_l-power7.c b/sysdeps/powerpc/powerpc32/multiarch/strncase_l-power7.c new file mode 100644 index 0000000..813d882 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/strncase_l-power7.c @@ -0,0 +1,23 @@ +/* Optimized strcasecmp_l implememtation for POWER7. + 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 <string.h> + +#define __strncasecmp_l __strncasecmp_l_power7 +#define USE_IN_EXTENDED_LOCALE_MODEL 1 +#include <string/strncase.c> diff --git a/sysdeps/powerpc/powerpc32/multiarch/strncase_l.c b/sysdeps/powerpc/powerpc32/multiarch/strncase_l.c new file mode 100644 index 0000000..97a31a1 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/strncase_l.c @@ -0,0 +1,42 @@ +/* Multiple versions of strncasecmp_l. + 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/>. */ + +#ifndef NOT_IN_libc +# include <string.h> +# define strncasecmp_l __strncasecmp_l_ppc32 +extern __typeof (__strncasecmp_l) __strncasecmp_l_ppc32 attribute_hidden; +extern __typeof (__strncasecmp_l) __strncasecmp_l_power7 attribute_hidden; +#endif + +#include <string/strncase_l.c> +#undef strncasecmp_l + +#ifndef NOT_IN_libc +# include <shlib-compat.h> +# include "init-arch.h" + +/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle + ifunc symbol properly. */ +extern __typeof (__strncasecmp_l) __libc_strncasecmp_l; +libc_ifunc (__libc_strncasecmp_l, + (hwcap & PPC_FEATURE_HAS_VSX) + ? __strncasecmp_l_power7 + : __strncasecmp_l_ppc32); + +weak_alias (__libc_strncasecmp_l, strncasecmp_l) +#endif http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=07ea0ab846b739c21efedd8e57ddb83304199832 commit 07ea0ab846b739c21efedd8e57ddb83304199832 Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 08:30:34 2013 -0500 PowerPC: strcasecmp multilib for PowerPC32 diff --git a/sysdeps/powerpc/powerpc32/multiarch/Makefile b/sysdeps/powerpc/powerpc32/multiarch/Makefile index 1c2add3..a520f08 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/multiarch/Makefile @@ -6,5 +6,5 @@ sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \ memchr-ppc32 memrchr-power7 memrchr-ppc32 rawmemchr-power7 \ rawmemchr-ppc32 strnlen-power7 strlen-power7 strlen-ppc32 \ strnlen-power7 strnlen-ppc32 strncmp-power7 strncmp-power4 \ - strncmp-ppc32 + strncmp-ppc32 strcasecmp-power7 strcasecmp_l-power7 endif diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c index 7bde0d6..186986f 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c +++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c @@ -79,6 +79,21 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, IFUNC_IMPL_ADD (array, i, rawmemchr, 1, __rawmemchr_ppc32)) + /* Support sysdeps/powerpc/powerpc32/multiarch/strcasecmp.c. */ + IFUNC_IMPL (i, name, strcasecmp, + IFUNC_IMPL_ADD (array, i, strcasecmp, + hwcap & PPC_FEATURE_HAS_VSX, + __strcasecmp_power7) + IFUNC_IMPL_ADD (array, i, strcasecmp, 1, __strcasecmp_ppc32)) + + /* Support sysdeps/powerpc/powerpc32/multiarch/strcasecmp_l.c. */ + IFUNC_IMPL (i, name, strcasecmp_l, + IFUNC_IMPL_ADD (array, i, strcasecmp_l, + hwcap & PPC_FEATURE_HAS_VSX, + __strcasecmp_l_power7) + IFUNC_IMPL_ADD (array, i, strcasecmp_l, 1, + __strcasecmp_l_ppc32)) + #ifdef SHARED /* Support sysdeps/powerpc/powerpc32/multiarch/memset.c. */ IFUNC_IMPL (i, name, memset, diff --git a/sysdeps/powerpc/powerpc32/power7/strcasecmp.S b/sysdeps/powerpc/powerpc32/multiarch/strcasecmp-power7.S similarity index 98% rename from sysdeps/powerpc/powerpc32/power7/strcasecmp.S rename to sysdeps/powerpc/powerpc32/multiarch/strcasecmp-power7.S index 7f0046c..5f48271 100644 --- a/sysdeps/powerpc/powerpc32/power7/strcasecmp.S +++ b/sysdeps/powerpc/powerpc32/multiarch/strcasecmp-power7.S @@ -27,8 +27,8 @@ __locale_t loc [r5]) */ #ifndef STRCMP -# define __STRCMP __strcasecmp -# define STRCMP strcasecmp +# define __STRCMP __strcasecmp_power7 +# define STRCMP strcasecmp_power7 #endif ENTRY (__STRCMP) diff --git a/sysdeps/powerpc/powerpc32/multiarch/strcasecmp.c b/sysdeps/powerpc/powerpc32/multiarch/strcasecmp.c new file mode 100644 index 0000000..b1380c3 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/strcasecmp.c @@ -0,0 +1,41 @@ +/* Multiple versions of strcasecmp. + 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/>. */ + +#ifndef NOT_IN_libc +# include <string.h> +# define strcasecmp __strcasecmp_ppc32 + +extern __typeof (__strcasecmp) __strcasecmp_ppc32 attribute_hidden; +extern __typeof (__strcasecmp) __strcasecmp_power7 attribute_hidden; +#endif + +#include <string/strcasecmp.c> +#undef strcasecmp + +#ifndef NOT_IN_libc +# include <shlib-compat.h> +# include "init-arch.h" + +extern __typeof (__strcasecmp) __libc_strcasecmp; +libc_ifunc (__libc_strcasecmp, + (hwcap & PPC_FEATURE_HAS_VSX) + ? __strcasecmp_power7 + : __strcasecmp_ppc32); + +weak_alias (__libc_strcasecmp, strcasecmp) +#endif diff --git a/sysdeps/powerpc/powerpc32/multiarch/strcasecmp_l-power7.S b/sysdeps/powerpc/powerpc32/multiarch/strcasecmp_l-power7.S new file mode 100644 index 0000000..09792cb --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/strcasecmp_l-power7.S @@ -0,0 +1,23 @@ +/* Default strcasecmp implementation for PowerPC32. + Copyright (C) 2011-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/>. */ + +#define USE_IN_EXTENDED_LOCALE_MODEL +#define STRCMP strcasecmp_l_power7 +#define __STRCMP __strcasecmp_l_power7 + +#include "strcasecmp-power7.S" diff --git a/sysdeps/powerpc/powerpc32/multiarch/strcasecmp_l.c b/sysdeps/powerpc/powerpc32/multiarch/strcasecmp_l.c new file mode 100644 index 0000000..ba2f0ee --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/strcasecmp_l.c @@ -0,0 +1,41 @@ +/* Multiple versions of strcasecmp. + 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/>. */ + +#ifndef NOT_IN_libc +# include <string.h> +# define strcasecmp_l __strcasecmp_l_ppc32 + +extern __typeof (__strcasecmp_l) __strcasecmp_l_ppc32 attribute_hidden; +extern __typeof (__strcasecmp_l) __strcasecmp_l_power7 attribute_hidden; +#endif + +#include <string/strcasecmp_l.c> +#undef strcasecmp_l + +#ifndef NOT_IN_libc +# include <shlib-compat.h> +# include "init-arch.h" + +extern __typeof (__strcasecmp_l) __libc_strcasecmp_l; +libc_ifunc (__libc_strcasecmp_l, + (hwcap & PPC_FEATURE_HAS_VSX) + ? __strcasecmp_l_power7 + : __strcasecmp_l_ppc32); + +weak_alias (__libc_strcasecmp_l, strcasecmp_l) +#endif diff --git a/sysdeps/powerpc/powerpc32/power7/Makefile b/sysdeps/powerpc/powerpc32/power7/Makefile deleted file mode 100644 index 5e8f4a2..0000000 --- a/sysdeps/powerpc/powerpc32/power7/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -ifeq ($(subdir),string) -CFLAGS-strncase.c += -funroll-loops -CFLAGS-strncase_l.c += -funroll-loops -endif diff --git a/sysdeps/powerpc/powerpc32/power7/strcasecmp_l.S b/sysdeps/powerpc/powerpc32/power7/strcasecmp_l.S deleted file mode 100644 index c13c4eb..0000000 --- a/sysdeps/powerpc/powerpc32/power7/strcasecmp_l.S +++ /dev/null @@ -1,5 +0,0 @@ -#define USE_IN_EXTENDED_LOCALE_MODEL -#define STRCMP strcasecmp_l -#define __STRCMP __strcasecmp_l - -#include "strcasecmp.S" http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=4373cff0e8cc080d393d66f35c5f095577bf2a57 commit 4373cff0e8cc080d393d66f35c5f095577bf2a57 Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 08:24:15 2013 -0500 PowerPC: strncmp multilib for PowerPC32 diff --git a/sysdeps/powerpc/powerpc32/multiarch/Makefile b/sysdeps/powerpc/powerpc32/multiarch/Makefile index 5ccd8ff..1c2add3 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/multiarch/Makefile @@ -5,5 +5,6 @@ sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \ memset-ppc32 mempcpy-power7 mempcpy-ppc32 memchr-power7 \ memchr-ppc32 memrchr-power7 memrchr-ppc32 rawmemchr-power7 \ rawmemchr-ppc32 strnlen-power7 strlen-power7 strlen-ppc32 \ - strnlen-power7 strnlen-ppc32 + strnlen-power7 strnlen-ppc32 strncmp-power7 strncmp-power4 \ + strncmp-ppc32 endif diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c index 5d0080e..7bde0d6 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c +++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c @@ -132,6 +132,12 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, __strnlen_power7) IFUNC_IMPL_ADD (array, i, strnlen, 1, __strnlen_ppc32)) + /* Support sysdeps/powerpc/powerpc64/multiarch/strncmp.c. */ + IFUNC_IMPL (i, name, strncmp, + IFUNC_IMPL_ADD (array, i, strncmp, hwcap & PPC_FEATURE_HAS_VSX, + __strncmp_power7) + IFUNC_IMPL_ADD (array, i, strncmp, 1, + __strncmp_ppc32)) #endif return i; diff --git a/sysdeps/powerpc/powerpc32/power4/strncmp.S b/sysdeps/powerpc/powerpc32/multiarch/strncmp-power4.S similarity index 98% rename from sysdeps/powerpc/powerpc32/power4/strncmp.S rename to sysdeps/powerpc/powerpc32/multiarch/strncmp-power4.S index 724d908..ffbd11e 100644 --- a/sysdeps/powerpc/powerpc32/power4/strncmp.S +++ b/sysdeps/powerpc/powerpc32/multiarch/strncmp-power4.S @@ -22,7 +22,8 @@ /* int [r3] strncmp (const char *s1 [r3], const char *s2 [r4], size_t size [r5]) */ -EALIGN (strncmp, 4, 0) + .machine power4 +EALIGN (__strncmp_power4, 4, 0) #define rTMP r0 #define rRTN r3 @@ -166,5 +167,4 @@ L(u4): sub rRTN, rWORD1, rWORD2 L(ux): li rRTN, 0 blr -END (strncmp) -libc_hidden_builtin_def (strncmp) +END (__strncmp_power4) diff --git a/sysdeps/powerpc/powerpc32/power7/strncmp.S b/sysdeps/powerpc/powerpc32/multiarch/strncmp-power7.S similarity index 98% rename from sysdeps/powerpc/powerpc32/power7/strncmp.S rename to sysdeps/powerpc/powerpc32/multiarch/strncmp-power7.S index fdae44d..c2cb8cd 100644 --- a/sysdeps/powerpc/powerpc32/power7/strncmp.S +++ b/sysdeps/powerpc/powerpc32/multiarch/strncmp-power7.S @@ -24,7 +24,8 @@ const char *s2 [r4], size_t size [r5]) */ -EALIGN (strncmp,5,0) + .machine power7 +EALIGN (__strncmp_power7,5,0) #define rTMP r0 #define rRTN r3 @@ -170,5 +171,4 @@ L(u4): sub rRTN,rWORD1,rWORD2 L(ux): li rRTN,0 blr -END (strncmp) -libc_hidden_builtin_def (strncmp) +END (__strncmp_power7) diff --git a/sysdeps/powerpc/powerpc32/multiarch/strncmp-ppc32.S b/sysdeps/powerpc/powerpc32/multiarch/strncmp-ppc32.S new file mode 100644 index 0000000..0fc6df6 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/strncmp-ppc32.S @@ -0,0 +1,40 @@ +/* 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 <sysdep.h> + +#if defined SHARED && !defined NOT_IN_libc +# undef EALIGN +# define EALIGN(name, alignt, words) \ + .globl C_SYMBOL_NAME(__strncmp_ppc32); \ + .type C_SYMBOL_NAME(__strncmp_ppc32),@function; \ + .align ALIGNARG(alignt); \ + EALIGN_W_##words; \ + C_LABEL(__strncmp_ppc32) \ + cfi_startproc; + +# undef END +# define END(name) \ + cfi_endproc; \ + ASM_SIZE_DIRECTIVE(__strncmp_ppc32) + +# undef libc_hidden_builtin_def +# define libc_hidden_builtin_def(name) \ + .globl __GI_strncmp; __GI_strncmp = __strncmp_ppc32 +#endif + +#include <sysdeps/powerpc/powerpc32/strncmp.S> diff --git a/sysdeps/powerpc/powerpc32/multiarch/strncmp.c b/sysdeps/powerpc/powerpc32/multiarch/strncmp.c new file mode 100644 index 0000000..32b96dc --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/strncmp.c @@ -0,0 +1,37 @@ +/* Multiple versions of strncmp. + 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/>. */ + +/* Define multiple versions only for definition in libc. */ +#if defined SHARED && !defined NOT_IN_libc +# include <string.h> +# include <shlib-compat.h> +# include "init-arch.h" + +extern __typeof (strncmp) __strncmp_ppc32 attribute_hidden; +extern __typeof (strncmp) __strncmp_power4 attribute_hidden; +extern __typeof (strncmp) __strncmp_power7 attribute_hidden; + +/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle + ifunc symbol properly. */ +libc_ifunc (strncmp, + (hwcap & PPC_FEATURE_HAS_VSX) + ? __strncmp_power7 : + (hwcap & PPC_FEATURE_POWER4) + ? __strncmp_power4 + : __strncmp_ppc32); +#endif http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=63fc54aecfdf79ef0850e40ad2e481ae639c7c1e commit 63fc54aecfdf79ef0850e40ad2e481ae639c7c1e Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 08:11:02 2013 -0500 PowerPC: strnlen multilib for PowerPC32 diff --git a/sysdeps/powerpc/powerpc32/multiarch/Makefile b/sysdeps/powerpc/powerpc32/multiarch/Makefile index 0c0eb5d..5ccd8ff 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/multiarch/Makefile @@ -4,5 +4,6 @@ sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \ memcmp-ppc32 memset-power7 memset-power6 memset-power4 \ memset-ppc32 mempcpy-power7 mempcpy-ppc32 memchr-power7 \ memchr-ppc32 memrchr-power7 memrchr-ppc32 rawmemchr-power7 \ - rawmemchr-ppc32 strnlen-power7 strlen-power7 strlen-ppc32 + rawmemchr-ppc32 strnlen-power7 strlen-power7 strlen-ppc32 \ + strnlen-power7 strnlen-ppc32 endif diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c index 33a023d..5d0080e 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c +++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c @@ -126,6 +126,12 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, __strlen_power7) IFUNC_IMPL_ADD (array, i, strlen, 1, __strlen_ppc32)) + /* Support sysdeps/powerpc/powerpc32/multiarch/strnlen.c. */ + IFUNC_IMPL (i, name, strnlen, + IFUNC_IMPL_ADD (array, i, strnlen, hwcap & PPC_FEATURE_HAS_VSX, + __strnlen_power7) + IFUNC_IMPL_ADD (array, i, strnlen, 1, + __strnlen_ppc32)) #endif return i; diff --git a/sysdeps/powerpc/powerpc32/multiarch/rtld-strnlen.c b/sysdeps/powerpc/powerpc32/multiarch/rtld-strnlen.c new file mode 100644 index 0000000..11a7203 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/rtld-strnlen.c @@ -0,0 +1,18 @@ +/* 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 <string/strnlen.c> diff --git a/sysdeps/powerpc/powerpc32/power7/strnlen.S b/sysdeps/powerpc/powerpc32/multiarch/strnlen-power7.S similarity index 97% rename from sysdeps/powerpc/powerpc32/power7/strnlen.S rename to sysdeps/powerpc/powerpc32/multiarch/strnlen-power7.S index ed08836..63ac821 100644 --- a/sysdeps/powerpc/powerpc32/power7/strnlen.S +++ b/sysdeps/powerpc/powerpc32/multiarch/strnlen-power7.S @@ -21,7 +21,7 @@ /* int [r3] strnlen (char *s [r3], int size [r4]) */ .machine power7 -ENTRY (__strnlen) +ENTRY (__strnlen_power7) CALL_MCOUNT dcbt 0,r3 clrrwi r8,r3,2 /* Align the address to word boundary. */ @@ -164,6 +164,4 @@ L(loop_small): cmplw r9,r7 bge L(end_max) b L(loop_small) -END (__strnlen) -weak_alias (__strnlen, strnlen) -libc_hidden_builtin_def (strnlen) +END (__strnlen_power7) diff --git a/sysdeps/powerpc/powerpc32/multiarch/strnlen-ppc32.c b/sysdeps/powerpc/powerpc32/multiarch/strnlen-ppc32.c new file mode 100644 index 0000000..660c973 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/strnlen-ppc32.c @@ -0,0 +1,26 @@ +/* Default strnlen implementation for PowerPC32. + 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/>. */ + +#define STRNLEN __strnlen_ppc32 +#ifdef SHARED +# undef libc_hidden_def +# define libc_hidden_def(name) \ + __hidden_ver1 (__strnlen_ppc32, __GI_strnlen, __strnlen_ppc32); +#endif + +#include <string/strnlen.c> diff --git a/sysdeps/powerpc/powerpc32/multiarch/strnlen.c b/sysdeps/powerpc/powerpc32/multiarch/strnlen.c new file mode 100644 index 0000000..5816a04 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/strnlen.c @@ -0,0 +1,33 @@ +/* Multiple versions of strnlen. + 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/>. */ + +#ifndef NOT_IN_libc +# include <string.h> +# include <shlib-compat.h> +# include "init-arch.h" + +extern __typeof (__strnlen) __strnlen_ppc32 attribute_hidden; +extern __typeof (__strnlen) __strnlen_power7 attribute_hidden; + +libc_ifunc (__strnlen, + (hwcap & PPC_FEATURE_HAS_VSX) + ? __strnlen_power7 + : __strnlen_ppc32); +weak_alias (__strnlen, strnlen) +libc_hidden_def (strnlen) +#endif http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=6d0fba5d25bbfdeb551c47d40cd1fdaf004fce06 commit 6d0fba5d25bbfdeb551c47d40cd1fdaf004fce06 Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 08:07:17 2013 -0500 PowerPC: strlen multilib for PowerPC32 diff --git a/sysdeps/powerpc/powerpc32/multiarch/Makefile b/sysdeps/powerpc/powerpc32/multiarch/Makefile index ab482ba..0c0eb5d 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/multiarch/Makefile @@ -4,5 +4,5 @@ sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \ memcmp-ppc32 memset-power7 memset-power6 memset-power4 \ memset-ppc32 mempcpy-power7 mempcpy-ppc32 memchr-power7 \ memchr-ppc32 memrchr-power7 memrchr-ppc32 rawmemchr-power7 \ - rawmemchr-ppc32 + rawmemchr-ppc32 strnlen-power7 strlen-power7 strlen-ppc32 endif diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c index 7d65f52..33a023d 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c +++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c @@ -120,6 +120,12 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, IFUNC_IMPL_ADD (array, i, mempcpy, 1, __mempcpy_ppc32)) + /* Support sysdeps/powerpc/powerpc32/multiarch/strlen.c. */ + IFUNC_IMPL (i, name, strlen, + IFUNC_IMPL_ADD (array, i, strlen, hwcap & PPC_FEATURE_HAS_VSX, + __strlen_power7) + IFUNC_IMPL_ADD (array, i, strlen, 1, + __strlen_ppc32)) #endif return i; diff --git a/sysdeps/powerpc/powerpc32/power7/strlen.S b/sysdeps/powerpc/powerpc32/multiarch/strlen-power7.S similarity index 98% rename from sysdeps/powerpc/powerpc32/power7/strlen.S rename to sysdeps/powerpc/powerpc32/multiarch/strlen-power7.S index b71a10f..858a0c9 100644 --- a/sysdeps/powerpc/powerpc32/power7/strlen.S +++ b/sysdeps/powerpc/powerpc32/multiarch/strlen-power7.S @@ -21,7 +21,7 @@ /* int [r3] strlen (char *s [r3]) */ .machine power7 -ENTRY (strlen) +ENTRY (__strlen_power7) CALL_MCOUNT dcbt 0,r3 clrrwi r4,r3,2 /* Align the address to word boundary. */ @@ -91,5 +91,4 @@ L(done): srwi r0,r0,3 /* Convert leading zeroes to bytes. */ add r3,r5,r0 /* Compute final length. */ blr -END (strlen) -libc_hidden_builtin_def (strlen) +END (__strlen_power7) diff --git a/sysdeps/powerpc/powerpc32/multiarch/strlen-ppc32.S b/sysdeps/powerpc/powerpc32/multiarch/strlen-ppc32.S new file mode 100644 index 0000000..7b5c76f --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/strlen-ppc32.S @@ -0,0 +1,41 @@ +/* Default strlen implementation for PowerPC32. + 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/>. */ + +#if defined SHARED && !defined NOT_IN_libc + +#include <sysdep.h> + +# undef ENTRY +# define ENTRY(name) \ + .globl C_SYMBOL_NAME(__strlen_ppc32); \ + .type C_SYMBOL_NAME(__strlen_ppc32),@function; \ + C_LABEL(__strlen_ppc32) \ + cfi_startproc; + +# undef END +# define END(name) \ + cfi_endproc; \ + ASM_SIZE_DIRECTIVE(__strlen_ppc32) + +# undef libc_hidden_builtin_def +# define libc_hidden_builtin_def(name) \ + .globl __GI_strlen; __GI_strlen = __strlen_ppc32 + +#endif + +#include <sysdeps/powerpc/powerpc32/strlen.S> diff --git a/sysdeps/powerpc/powerpc32/multiarch/strlen.c b/sysdeps/powerpc/powerpc32/multiarch/strlen.c new file mode 100644 index 0000000..8fce99b --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/strlen.c @@ -0,0 +1,31 @@ +/* Multiple versions of strlen. + 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/>. */ + +#if defined SHARED && !defined NOT_IN_libc +# include <string.h> +# include <shlib-compat.h> +# include "init-arch.h" + +extern __typeof (strlen) __strlen_ppc32 attribute_hidden; +extern __typeof (strlen) __strlen_power7 attribute_hidden; + +libc_ifunc (strlen, + (hwcap & PPC_FEATURE_HAS_VSX) + ? __strlen_power7 + : __strlen_ppc32); +#endif http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=087680a80f390a18ef6503963060cbe3f192099a commit 087680a80f390a18ef6503963060cbe3f192099a Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 07:59:09 2013 -0500 PowerPC: rawmemchr multilib for PowerPC32 diff --git a/string/rawmemchr.c b/string/rawmemchr.c index 30fbe87..3b6e19b 100644 --- a/string/rawmemchr.c +++ b/string/rawmemchr.c @@ -46,11 +46,13 @@ #include <sys/types.h> #undef memchr - +#ifndef RAWMEMCHR +# define RAWMEMCHR __rawmemchr +#endif /* Find the first occurrence of C in S. */ __ptr_t -__rawmemchr (s, c_in) +RAWMEMCHR (s, c_in) const __ptr_t s; int c_in; { diff --git a/sysdeps/powerpc/powerpc32/multiarch/Makefile b/sysdeps/powerpc/powerpc32/multiarch/Makefile index fde4fbf..ab482ba 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/multiarch/Makefile @@ -3,5 +3,6 @@ sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \ memcpy-power4 memcpy-ppc32 memcmp-power7 memcmp-power4 \ memcmp-ppc32 memset-power7 memset-power6 memset-power4 \ memset-ppc32 mempcpy-power7 mempcpy-ppc32 memchr-power7 \ - memchr-ppc32 memrchr-power7 memrchr-ppc32 + memchr-ppc32 memrchr-power7 memrchr-ppc32 rawmemchr-power7 \ + rawmemchr-ppc32 endif diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c index 4b3dd75..7d65f52 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c +++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c @@ -71,6 +71,14 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, IFUNC_IMPL_ADD (array, i, memrchr, 1, __memrchr_ppc32)) + /* Support sysdeps/powerpc/powerpc32/multiarch/rawmemchr.c. */ + IFUNC_IMPL (i, name, rawmemchr, + IFUNC_IMPL_ADD (array, i, rawmemchr, + hwcap & PPC_FEATURE_HAS_VSX, + __rawmemchr_power7) + IFUNC_IMPL_ADD (array, i, rawmemchr, 1, + __rawmemchr_ppc32)) + #ifdef SHARED /* Support sysdeps/powerpc/powerpc32/multiarch/memset.c. */ IFUNC_IMPL (i, name, memset, diff --git a/sysdeps/powerpc/powerpc32/power7/rawmemchr.S b/sysdeps/powerpc/powerpc32/multiarch/rawmemchr-power7.S similarity index 96% rename from sysdeps/powerpc/powerpc32/power7/rawmemchr.S rename to sysdeps/powerpc/powerpc32/multiarch/rawmemchr-power7.S index a80c74a..b495393 100644 --- a/sysdeps/powerpc/powerpc32/power7/rawmemchr.S +++ b/sysdeps/powerpc/powerpc32/multiarch/rawmemchr-power7.S @@ -21,7 +21,7 @@ /* int [r3] rawmemchr (void *s [r3], int c [r4]) */ .machine power7 -ENTRY (__rawmemchr) +ENTRY (__rawmemchr_power7) CALL_MCOUNT dcbt 0,r3 clrrwi r8,r3,2 /* Align the address to word boundary. */ @@ -94,6 +94,4 @@ L(done): srwi r0,r0,3 /* Convert leading zeroes to bytes. */ add r3,r8,r0 /* Return address of the matching char. */ blr -END (__rawmemchr) -weak_alias (__rawmemchr,rawmemchr) -libc_hidden_builtin_def (__rawmemchr) +END (__rawmemchr_power7) diff --git a/sysdeps/powerpc/powerpc32/multiarch/rawmemchr-ppc32.c b/sysdeps/powerpc/powerpc32/multiarch/rawmemchr-ppc32.c new file mode 100644 index 0000000..cc292d4 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/rawmemchr-ppc32.c @@ -0,0 +1,28 @@ +/* PowerPC32 default implementation of rawmemchr. + 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/>. */ + +#define RAWMEMCHR __rawmemchr_ppc32 +#undef weak_alias +#define weak_alias(a, b) +#ifdef SHARED +# undef libc_hidden_def +# define libc_hidden_def(name) \ + __hidden_ver1 (__rawmemchr_ppc32, __GI___rawmemchr, __rawmemchr_ppc32); +#endif + +#include <string/rawmemchr.c> diff --git a/sysdeps/powerpc/powerpc32/multiarch/rawmemchr.c b/sysdeps/powerpc/powerpc32/multiarch/rawmemchr.c new file mode 100644 index 0000000..b033f47 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/rawmemchr.c @@ -0,0 +1,37 @@ +/* Multiple versions of rawmemchr. + 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/>. */ + +#ifndef NOT_IN_libc +# include <string.h> +# include <shlib-compat.h> +# include "init-arch.h" + +extern __typeof (__rawmemchr) __rawmemchr_ppc32 attribute_hidden; +extern __typeof (__rawmemchr) __rawmemchr_power7 attribute_hidden; + +/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle + ifunc symbol properly. */ +libc_ifunc (__rawmemchr, + (hwcap & PPC_FEATURE_HAS_VSX) + ? __rawmemchr_power7 + : __rawmemchr_ppc32); + +weak_alias (__rawmemchr, rawmemchr) +#else +#include <string/rawmemchr.c> +#endif http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=c0ada62727044b346160da6a918d6e161820305a commit c0ada62727044b346160da6a918d6e161820305a Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 07:56:43 2013 -0500 PowerPC: memrchr multilib for PowerPC32 diff --git a/sysdeps/powerpc/powerpc32/multiarch/Makefile b/sysdeps/powerpc/powerpc32/multiarch/Makefile index 9feb3c6..fde4fbf 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/multiarch/Makefile @@ -3,5 +3,5 @@ sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \ memcpy-power4 memcpy-ppc32 memcmp-power7 memcmp-power4 \ memcmp-ppc32 memset-power7 memset-power6 memset-power4 \ memset-ppc32 mempcpy-power7 mempcpy-ppc32 memchr-power7 \ - memchr-ppc32 + memchr-ppc32 memrchr-power7 memrchr-ppc32 endif diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c index 279cc0b..4b3dd75 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c +++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c @@ -63,6 +63,13 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, __memchr_power7) IFUNC_IMPL_ADD (array, i, memchr, 1, __memchr_ppc32)) + /* Support sysdeps/powerpc/powerpc32/multiarch/memrchr.c. */ + IFUNC_IMPL (i, name, memrchr, + IFUNC_IMPL_ADD (array, i, memrchr, + hwcap & PPC_FEATURE_HAS_VSX, + __memrchr_power7) + IFUNC_IMPL_ADD (array, i, memrchr, 1, + __memrchr_ppc32)) #ifdef SHARED /* Support sysdeps/powerpc/powerpc32/multiarch/memset.c. */ diff --git a/sysdeps/powerpc/powerpc32/power7/memrchr.S b/sysdeps/powerpc/powerpc32/multiarch/memrchr-power7.S similarity index 97% rename from sysdeps/powerpc/powerpc32/power7/memrchr.S rename to sysdeps/powerpc/powerpc32/multiarch/memrchr-power7.S index d1e3fda..0aaf017 100644 --- a/sysdeps/powerpc/powerpc32/power7/memrchr.S +++ b/sysdeps/powerpc/powerpc32/multiarch/memrchr-power7.S @@ -21,7 +21,7 @@ /* int [r3] memrchr (char *s [r3], int byte [r4], int size [r5]) */ .machine power7 -ENTRY (__memrchr) +ENTRY (__memrchr_power7) CALL_MCOUNT dcbt 0,r3 mr r7,r3 @@ -170,6 +170,4 @@ L(loop_small): ble L(null) b L(loop_small) -END (__memrchr) -weak_alias (__memrchr, memrchr) -libc_hidden_builtin_def (memrchr) +END (__memrchr_power7) diff --git a/sysdeps/powerpc/powerpc32/multiarch/memrchr-ppc32.c b/sysdeps/powerpc/powerpc32/multiarch/memrchr-ppc32.c new file mode 100644 index 0000000..19ae015 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/memrchr-ppc32.c @@ -0,0 +1,25 @@ +/* PowerPC32 default implementation of memrchr. + 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/>. */ + +#ifndef NOT_IN_libc +# define MEMRCHR __memrchr_ppc32 +# include <string.h> +extern void *__memrchr_ppc32 (const void *, int, size_t); +#endif + +#include <string/memrchr.c> diff --git a/sysdeps/powerpc/powerpc32/multiarch/memrchr.c b/sysdeps/powerpc/powerpc32/multiarch/memrchr.c new file mode 100644 index 0000000..c3dde9c --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/memrchr.c @@ -0,0 +1,37 @@ +/* Multiple versions of memrchr. + 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/>. */ + +#ifndef NOT_IN_libc +# include <string.h> +# include <shlib-compat.h> +# include "init-arch.h" + +extern __typeof (__memrchr) __memrchr_ppc32 attribute_hidden; +extern __typeof (__memrchr) __memrchr_power7 attribute_hidden; + +/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle + ifunc symbol properly. */ +libc_ifunc (__memrchr, + (hwcap & PPC_FEATURE_HAS_VSX) + ? __memrchr_power7 + : __memrchr_ppc32); + +weak_alias (__memrchr, memrchr) +#else +#include <string/memrchr.c> +#endif http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=bb0364532c72f1a5e26132f0e5dce008a30a5719 commit bb0364532c72f1a5e26132f0e5dce008a30a5719 Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 07:54:37 2013 -0500 PowerPC: memchr multilib for PowerPC32 diff --git a/string/memchr.c b/string/memchr.c index 2427c4b..a4a65c7 100644 --- a/string/memchr.c +++ b/string/memchr.c @@ -50,10 +50,13 @@ #undef memchr #undef __memchr +#ifndef MEMCHR +# define MEMCHR __memchr +#endif /* Search no more than N bytes of S for C. */ __ptr_t -__memchr (s, c_in, n) +MEMCHR (s, c_in, n) const __ptr_t s; int c_in; size_t n; diff --git a/sysdeps/powerpc/powerpc32/multiarch/Makefile b/sysdeps/powerpc/powerpc32/multiarch/Makefile index 34a0cdc..9feb3c6 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/multiarch/Makefile @@ -2,5 +2,6 @@ ifeq ($(subdir),string) sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \ memcpy-power4 memcpy-ppc32 memcmp-power7 memcmp-power4 \ memcmp-ppc32 memset-power7 memset-power6 memset-power4 \ - memset-ppc32 mempcpy-power7 mempcpy-ppc32 + memset-ppc32 mempcpy-power7 mempcpy-ppc32 memchr-power7 \ + memchr-ppc32 endif diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c index e50e144..279cc0b 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c +++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c @@ -56,6 +56,14 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, __bzero_power4) IFUNC_IMPL_ADD (array, i, bzero, 1, __bzero_ppc32)) + /* Support sysdeps/powerpc/powerpc32/multiarch/memchr.c. */ + IFUNC_IMPL (i, name, memchr, + IFUNC_IMPL_ADD (array, i, memchr, + hwcap & PPC_FEATURE_HAS_VSX, + __memchr_power7) + IFUNC_IMPL_ADD (array, i, memchr, 1, + __memchr_ppc32)) + #ifdef SHARED /* Support sysdeps/powerpc/powerpc32/multiarch/memset.c. */ IFUNC_IMPL (i, name, memset, diff --git a/sysdeps/powerpc/powerpc32/power7/memchr.S b/sysdeps/powerpc/powerpc32/multiarch/memchr-power7.S similarity index 98% rename from sysdeps/powerpc/powerpc32/power7/memchr.S rename to sysdeps/powerpc/powerpc32/multiarch/memchr-power7.S index 369e5e0..b7aa903 100644 --- a/sysdeps/powerpc/powerpc32/power7/memchr.S +++ b/sysdeps/powerpc/powerpc32/multiarch/memchr-power7.S @@ -21,7 +21,7 @@ /* int [r3] memchr (char *s [r3], int byte [r4], int size [r5]) */ .machine power7 -ENTRY (__memchr) +ENTRY (__memchr_power7) CALL_MCOUNT dcbt 0,r3 clrrwi r8,r3,2 @@ -200,6 +200,4 @@ L(loop_small): /* loop_small has been unrolled. */ li r3,0 blr -END (__memchr) -weak_alias (__memchr, memchr) -libc_hidden_builtin_def (memchr) +END (__memchr_power7) diff --git a/sysdeps/powerpc/powerpc32/multiarch/memchr-ppc32.c b/sysdeps/powerpc/powerpc32/multiarch/memchr-ppc32.c new file mode 100644 index 0000000..5673ca3 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/memchr-ppc32.c @@ -0,0 +1,30 @@ +/* PowerPC32 default implementation of memchr. + 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/>. */ + +#define MEMCHR __memchr_ppc32 + +#undef weak_alias +#define weak_alias(a, b) + +#ifdef SHARED +# undef libc_hidden_builtin_def +# define libc_hidden_builtin_def(name) \ + __hidden_ver1 (__memchr_ppc32, __GI_memchr, __memchr_ppc32); +#endif + +#include <string/memchr.c> diff --git a/sysdeps/powerpc/powerpc32/multiarch/memchr.c b/sysdeps/powerpc/powerpc32/multiarch/memchr.c new file mode 100644 index 0000000..0e619d4 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/memchr.c @@ -0,0 +1,38 @@ +/* Multiple versions of memchr. + 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/>. */ + +#ifndef NOT_IN_libc +# include <string.h> +# include <shlib-compat.h> +# include "init-arch.h" + +extern __typeof (__memchr) __memchr_ppc32 attribute_hidden; +extern __typeof (__memchr) __memchr_power7 attribute_hidden; + +/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle + ifunc symbol properly. */ +libc_ifunc (__memchr, + (hwcap & PPC_FEATURE_HAS_VSX) + ? __memchr_power7 + : __memchr_ppc32); + +weak_alias (__memchr, memchr) +libc_hidden_builtin_def (memchr) +#else +#include <string/memchr.c> +#endif http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=0dae514f40103ed58185741d57ebed197bf7baa4 commit 0dae514f40103ed58185741d57ebed197bf7baa4 Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 07:51:58 2013 -0500 PowerPC: mempcpy multilib for PowerPC32 diff --git a/string/mempcpy.c b/string/mempcpy.c index c0d2448..a626c9c 100644 --- a/string/mempcpy.c +++ b/string/mempcpy.c @@ -24,8 +24,12 @@ #undef mempcpy #undef __mempcpy +#ifndef MEMPCPY +# define MEMPCPY __mempcpy +#endif + void * -__mempcpy (void *dest, const void *src, size_t len) +MEMPCPY (void *dest, const void *src, size_t len) { return memcpy (dest, src, len) + len; } diff --git a/sysdeps/powerpc/powerpc32/multiarch/Makefile b/sysdeps/powerpc/powerpc32/multiarch/Makefile index f3778a7..34a0cdc 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/multiarch/Makefile @@ -2,5 +2,5 @@ ifeq ($(subdir),string) sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \ memcpy-power4 memcpy-ppc32 memcmp-power7 memcmp-power4 \ memcmp-ppc32 memset-power7 memset-power6 memset-power4 \ - memset-ppc32 + memset-ppc32 mempcpy-power7 mempcpy-ppc32 endif diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c index 45943cf..e50e144 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c +++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c @@ -88,6 +88,15 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, IFUNC_IMPL_ADD (array, i, memcmp, hwcap & PPC_FEATURE_POWER4, __memcmp_power4) IFUNC_IMPL_ADD (array, i, memcmp, 1, __memcmp_ppc32)) + + /* Support sysdeps/powerpc/powerpc32/multiarch/mempcpy.c. */ + IFUNC_IMPL (i, name, mempcpy, + IFUNC_IMPL_ADD (array, i, mempcpy, + hwcap & PPC_FEATURE_HAS_VSX, + __mempcpy_power7) + IFUNC_IMPL_ADD (array, i, mempcpy, 1, + __mempcpy_ppc32)) + #endif return i; diff --git a/sysdeps/powerpc/powerpc32/power7/mempcpy.S b/sysdeps/powerpc/powerpc32/multiarch/mempcpy-power7.S similarity index 98% rename from sysdeps/powerpc/powerpc32/power7/mempcpy.S rename to sysdeps/powerpc/powerpc32/multiarch/mempcpy-power7.S index 5ad4edb..0cc37ae 100644 --- a/sysdeps/powerpc/powerpc32/power7/mempcpy.S +++ b/sysdeps/powerpc/powerpc32/multiarch/mempcpy-power7.S @@ -23,7 +23,7 @@ Returns 'dst' + 'len'. */ .machine power7 -EALIGN (__mempcpy, 5, 0) +EALIGN (__mempcpy_power7, 5, 0) CALL_MCOUNT stwu 1,-32(1) @@ -462,7 +462,4 @@ L(end_unaligned_loop): addi 1,1,32 blr -END (__mempcpy) -libc_hidden_def (__mempcpy) -weak_alias (__mempcpy, mempcpy) -libc_hidden_builtin_def (mempcpy) +END (__mempcpy_power7) diff --git a/string/mempcpy.c b/sysdeps/powerpc/powerpc32/multiarch/mempcpy-ppc32.c similarity index 58% copy from string/mempcpy.c copy to sysdeps/powerpc/powerpc32/multiarch/mempcpy-ppc32.c index c0d2448..0e9a129 100644 --- a/string/mempcpy.c +++ b/sysdeps/powerpc/powerpc32/multiarch/mempcpy-ppc32.c @@ -1,9 +1,6 @@ -/* Copy memory to memory until the specified number of bytes - has been copied, return pointer to following byte. - Overlap is NOT handled correctly. - Copyright (C) 1991-2013 Free Software Foundation, Inc. +/* PowerPC32 default implementation of mempcpy. + Copyright (C) 2013 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Torbjorn Granlund (tege@sics.se). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -19,16 +16,17 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <string.h> +#define MEMPCPY __mempcpy_ppc32 -#undef mempcpy -#undef __mempcpy +#undef libc_hidden_def +#define libc_hidden_def(name) +#undef weak_alias +#define weak_alias(a, b) -void * -__mempcpy (void *dest, const void *src, size_t len) -{ - return memcpy (dest, src, len) + len; -} -libc_hidden_def (__mempcpy) -weak_alias (__mempcpy, mempcpy) -libc_hidden_builtin_def (mempcpy) +#if defined SHARED +# undef libc_hidden_builtin_def +# define libc_hidden_builtin_def(name) \ + __hidden_ver1 (__mempcpy_ppc32, __GI_mempcpy, __mempcpy_ppc32); +#endif + +#include <string/mempcpy.c> diff --git a/string/mempcpy.c b/sysdeps/powerpc/powerpc32/multiarch/mempcpy.c similarity index 56% copy from string/mempcpy.c copy to sysdeps/powerpc/powerpc32/multiarch/mempcpy.c index c0d2448..0696e6c 100644 --- a/string/mempcpy.c +++ b/sysdeps/powerpc/powerpc32/multiarch/mempcpy.c @@ -1,9 +1,6 @@ -/* Copy memory to memory until the specified number of bytes - has been copied, return pointer to following byte. - Overlap is NOT handled correctly. - Copyright (C) 1991-2013 Free Software Foundation, Inc. +/* Multiple versions of mempcpy. + Copyright (C) 2013 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Torbjorn Granlund (tege@sics.se). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -19,16 +16,23 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <string.h> +#ifndef NOT_IN_libc +# include <string.h> +# include <shlib-compat.h> +# include "init-arch.h" -#undef mempcpy -#undef __mempcpy +extern __typeof (__mempcpy) __mempcpy_ppc32 attribute_hidden; +extern __typeof (__mempcpy) __mempcpy_power7 attribute_hidden; + +/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle + ifunc symbol properly. */ +libc_ifunc (__mempcpy, + (hwcap & PPC_FEATURE_HAS_VSX) + ? __mempcpy_power7 + : __mempcpy_ppc32); -void * -__mempcpy (void *dest, const void *src, size_t len) -{ - return memcpy (dest, src, len) + len; -} -libc_hidden_def (__mempcpy) weak_alias (__mempcpy, mempcpy) -libc_hidden_builtin_def (mempcpy) +libc_hidden_def (mempcpy) +#else +# include <string/mempcpy.c> +#endif http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=79a9be5becfada9a8c78cee344f6e019a1293d72 commit 79a9be5becfada9a8c78cee344f6e019a1293d72 Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 07:48:57 2013 -0500 PowerPC: memset/bzero multilib for PowerPC32 diff --git a/sysdeps/powerpc/powerpc32/multiarch/Makefile b/sysdeps/powerpc/powerpc32/multiarch/Makefile index c74e600..f3778a7 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/multiarch/Makefile @@ -1,5 +1,6 @@ ifeq ($(subdir),string) sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \ memcpy-power4 memcpy-ppc32 memcmp-power7 memcmp-power4 \ - memcmp-ppc32 + memcmp-ppc32 memset-power7 memset-power6 memset-power4 \ + memset-ppc32 endif diff --git a/sysdeps/powerpc/powerpc32/multiarch/bzero.c b/sysdeps/powerpc/powerpc32/multiarch/bzero.c new file mode 100644 index 0000000..4a14a18 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/bzero.c @@ -0,0 +1,68 @@ +/* Multiple versions of bzero. + 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/>. */ + +/* Define multiple versions only for definition in libc. */ +#ifndef NOT_IN_libc +# include <string.h> +# include <strings.h> +# include "init-arch.h" + +extern __typeof (memset) __memset_ppc32 attribute_hidden; +extern __typeof (memset) __memset_power4 attribute_hidden; +extern __typeof (memset) __memset_power6 attribute_hidden; +extern __typeof (memset) __memset_power7 attribute_hidden; + +__typeof(bzero) __bzero_ppc32 attribute_hidden; +void +__bzero_ppc32 (void *s, size_t n) +{ + __memset_ppc32 (s, 0, n); +} + +__typeof(bzero) __bzero_power4 attribute_hidden; +void +__bzero_power4 (void *s, size_t n) +{ + __memset_power4 (s, 0, n); +} + +__typeof(bzero) __bzero_power6 attribute_hidden; +void +__bzero_power6 (void *s, size_t n) +{ + __memset_power6 (s, 0, n); +} + +__typeof(bzero) __bzero_power7 attribute_hidden; +void +__bzero_power7 (void *s, size_t n) +{ + __memset_power7 (s, 0, n); +} + +libc_ifunc (__bzero, + (hwcap & PPC_FEATURE_HAS_VSX) + ? __bzero_power7 : + (hwcap & PPC_FEATURE_ARCH_2_05) + ? __bzero_power6 : + (hwcap & PPC_FEATURE_POWER4) + ? __bzero_power4 + : __bzero_ppc32); + +weak_alias (__bzero, bzero) +#endif diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c index 800aff7..45943cf 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c +++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c @@ -46,7 +46,27 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, else if (hwcap & PPC_FEATURE_POWER5) hwcap |= PPC_FEATURE_POWER4; + /* Support sysdeps/powerpc/powerpc32/multiarch/bzero.c. */ + IFUNC_IMPL (i, name, bzero, + IFUNC_IMPL_ADD (array, i, bzero, hwcap & PPC_FEATURE_HAS_VSX, + __bzero_power7) + IFUNC_IMPL_ADD (array, i, bzero, hwcap & PPC_FEATURE_ARCH_2_05, + __bzero_power6) + IFUNC_IMPL_ADD (array, i, bzero, hwcap & PPC_FEATURE_POWER4, + __bzero_power4) + IFUNC_IMPL_ADD (array, i, bzero, 1, __bzero_ppc32)) + #ifdef SHARED + /* Support sysdeps/powerpc/powerpc32/multiarch/memset.c. */ + IFUNC_IMPL (i, name, memset, + IFUNC_IMPL_ADD (array, i, memset, hwcap & PPC_FEATURE_HAS_VSX, + __memset_power7) + IFUNC_IMPL_ADD (array, i, memset, hwcap & PPC_FEATURE_ARCH_2_05, + __memset_power6) + IFUNC_IMPL_ADD (array, i, memset, hwcap & PPC_FEATURE_POWER4, + __memset_power4) + IFUNC_IMPL_ADD (array, i, memset, 1, __memset_ppc32)) + /* Support sysdeps/powerpc/powerpc32/multiarch/memcpy.c. */ IFUNC_IMPL (i, name, memcpy, IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_HAS_VSX, diff --git a/sysdeps/powerpc/powerpc32/power4/memset.S b/sysdeps/powerpc/powerpc32/multiarch/memset-power4.S similarity index 97% rename from sysdeps/powerpc/powerpc32/power4/memset.S rename to sysdeps/powerpc/powerpc32/multiarch/memset-power4.S index 1e8785c..ceb5888 100644 --- a/sysdeps/powerpc/powerpc32/power4/memset.S +++ b/sysdeps/powerpc/powerpc32/multiarch/memset-power4.S @@ -1,4 +1,4 @@ -/* Optimized memset implementation for PowerPC64. +/* Optimized memset implementation for PowerPC32. Copyright (C) 1997-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -26,7 +26,7 @@ to 0, to take advantage of the dcbz instruction. */ .machine power4 -EALIGN (memset, 5, 0) +EALIGN (__memset_power4, 5, 0) CALL_MCOUNT #define rTMP r0 @@ -162,7 +162,7 @@ L(cacheAligned): add rMEMP,rMEMP,rCLS b L(cacheAligned) -/* We are here because the cache line size was set and the remainder +/* We are here because the cache line size was set and the remainder (rLEN) is less than the actual cache line size. So set up the preconditions for L(nondcbz) and go there. */ L(handletail32): @@ -222,5 +222,4 @@ L(medium_28t): stw rCHR, -4(rMEMP) stw rCHR, -8(rMEMP) blr -END (memset) -libc_hidden_builtin_def (memset) +END (__memset_power4) diff --git a/sysdeps/powerpc/powerpc32/power6/memset.S b/sysdeps/powerpc/powerpc32/multiarch/memset-power6.S similarity index 99% rename from sysdeps/powerpc/powerpc32/power6/memset.S rename to sysdeps/powerpc/powerpc32/multiarch/memset-power6.S index ce06630..493c1ef 100644 --- a/sysdeps/powerpc/powerpc32/power6/memset.S +++ b/sysdeps/powerpc/powerpc32/multiarch/memset-power6.S @@ -26,7 +26,7 @@ to 0, to take advantage of the dcbz instruction. */ .machine power6 -EALIGN (memset, 7, 0) +EALIGN (__memset_power6, 7, 0) CALL_MCOUNT #define rTMP r0 @@ -535,5 +535,4 @@ L(medium_28t): stw rCHR, -4(rMEMP) stw rCHR, -8(rMEMP) blr -END (memset) -libc_hidden_builtin_def (memset) +END (__memset_power6) diff --git a/sysdeps/powerpc/powerpc32/power7/memset.S b/sysdeps/powerpc/powerpc32/multiarch/memset-power7.S similarity index 99% rename from sysdeps/powerpc/powerpc32/power7/memset.S rename to sysdeps/powerpc/powerpc32/multiarch/memset-power7.S index 360ea71..f8adb0b 100644 --- a/sysdeps/powerpc/powerpc32/power7/memset.S +++ b/sysdeps/powerpc/powerpc32/multiarch/memset-power7.S @@ -23,7 +23,7 @@ Returns 's'. */ .machine power7 -EALIGN (memset, 5, 0) +EALIGN (__memset_power7, 5, 0) CALL_MCOUNT .align 4 @@ -426,6 +426,4 @@ L(small): stw 4,0(10) stw 4,4(10) blr - -END (memset) -libc_hidden_builtin_def (memset) +END (__memset_power7) diff --git a/sysdeps/powerpc/powerpc32/multiarch/memset-ppc32.S b/sysdeps/powerpc/powerpc32/multiarch/memset-ppc32.S new file mode 100644 index 0000000..775a85a --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/memset-ppc32.S @@ -0,0 +1,41 @@ +/* Default memset implementation for PowerPC32. + Copyright (C) 1997-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 <sysdep.h> + +#if defined SHARED && !defined NOT_IN_libc +# undef EALIGN +# define EALIGN(name, alignt, words) \ + .globl C_SYMBOL_NAME(__memset_ppc32); \ + .type C_SYMBOL_NAME(__memset_ppc32),@function; \ + .align ALIGNARG(alignt); \ + EALIGN_W_##words; \ + C_LABEL(__memset_ppc32) \ + cfi_startproc; + +# undef END +# define END(name) \ + cfi_endproc; \ + ASM_SIZE_DIRECTIVE(__memset_ppc32) + +# undef libc_hidden_builtin_def +# define libc_hidden_builtin_def(name) \ + .globl __GI_memset; __GI_memset = __memset_ppc32 +#endif + +#include <sysdeps/powerpc/powerpc32/memset.S> diff --git a/sysdeps/powerpc/powerpc32/multiarch/memset.c b/sysdeps/powerpc/powerpc32/multiarch/memset.c new file mode 100644 index 0000000..b4c63d5 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/memset.c @@ -0,0 +1,40 @@ +/* Multiple versions of memset. + 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/>. */ + +/* Define multiple versions only for definition in libc. */ +#if defined SHARED && !defined NOT_IN_libc +# include <string.h> +# include <shlib-compat.h> +# include "init-arch.h" + +extern __typeof (memset) __memset_ppc32 attribute_hidden; +extern __typeof (memset) __memset_power4 attribute_hidden; +extern __typeof (memset) __memset_power6 attribute_hidden; +extern __typeof (memset) __memset_power7 attribute_hidden; + +/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle + ifunc symbol properly. */ +libc_ifunc (memset, + (hwcap & PPC_FEATURE_HAS_VSX) + ? __memset_power7 : + (hwcap & PPC_FEATURE_ARCH_2_05) + ? __memset_power6 : + (hwcap & PPC_FEATURE_POWER4) + ? __memset_power4 + : __memset_ppc32); +#endif diff --git a/sysdeps/powerpc/powerpc32/multiarch/rtld-memset.S b/sysdeps/powerpc/powerpc32/multiarch/rtld-memset.S new file mode 100644 index 0000000..efd2780 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/rtld-memset.S @@ -0,0 +1,18 @@ +/* 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 <sysdeps/powerpc/powerpc32/memset.S> http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=e5c4a488791f4ba627d5362f1f6397f079d833bb commit e5c4a488791f4ba627d5362f1f6397f079d833bb Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 07:46:29 2013 -0500 PowerPC: memcmp multilib for PowerPC32 diff --git a/string/memcmp.c b/string/memcmp.c index dd76145..d7c57db 100644 --- a/string/memcmp.c +++ b/string/memcmp.c @@ -29,6 +29,10 @@ #undef memcmp +#ifndef MEMCMP +# define MEMCMP memcmp +#endif + #ifdef _LIBC # include <memcopy.h> @@ -304,7 +308,7 @@ memcmp_not_common_alignment (srcp1, srcp2, len) } int -memcmp (s1, s2, len) +MEMCMP (s1, s2, len) const __ptr_t s1; const __ptr_t s2; size_t len; diff --git a/sysdeps/powerpc/powerpc32/multiarch/Makefile b/sysdeps/powerpc/powerpc32/multiarch/Makefile index d8d84f5..c74e600 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/multiarch/Makefile @@ -1,4 +1,5 @@ ifeq ($(subdir),string) sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \ - memcpy-power4 memcpy-ppc32 + memcpy-power4 memcpy-ppc32 memcmp-power7 memcmp-power4 \ + memcmp-ppc32 endif diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c index 3bf0447..800aff7 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c +++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c @@ -60,6 +60,14 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_POWER4, __memcpy_power4) IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_ppc32)) + + /* Support sysdeps/powerpc/powerpc32/multiarch/memcmp.c. */ + IFUNC_IMPL (i, name, memcmp, + IFUNC_IMPL_ADD (array, i, memcmp, hwcap & PPC_FEATURE_HAS_VSX, + __memcmp_power7) + IFUNC_IMPL_ADD (array, i, memcmp, hwcap & PPC_FEATURE_POWER4, + __memcmp_power4) + IFUNC_IMPL_ADD (array, i, memcmp, 1, __memcmp_ppc32)) #endif return i; diff --git a/sysdeps/powerpc/powerpc32/power4/memcmp.S b/sysdeps/powerpc/powerpc32/multiarch/memcmp-power4.S similarity index 94% rename from sysdeps/powerpc/powerpc32/power4/memcmp.S rename to sysdeps/powerpc/powerpc32/multiarch/memcmp-power4.S index edec7ab..5cff2ae 100644 --- a/sysdeps/powerpc/powerpc32/power4/memcmp.S +++ b/sysdeps/powerpc/powerpc32/multiarch/memcmp-power4.S @@ -1,4 +1,4 @@ -/* Optimized strcmp implementation for PowerPC64. +/* Optimized strcmp implementation for PowerPC32/POWER4. Copyright (C) 2003-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -21,7 +21,7 @@ /* int [r3] memcmp (const char *s1 [r3], const char *s2 [r4], size_t size [r5]) */ .machine power4 -EALIGN (memcmp, 4, 0) +EALIGN (__memcmp_power4, 4, 0) CALL_MCOUNT #define rTMP r0 @@ -53,17 +53,17 @@ EALIGN (memcmp, 4, 0) blt cr1, L(bytealigned) stwu 1,-64(1) cfi_adjust_cfa_offset(64) - stw r31,48(1) + stw r31,48(1) cfi_offset(31,(48-64)) - stw r30,44(1) + stw r30,44(1) cfi_offset(30,(44-64)) bne L(unaligned) /* At this point we know both strings have the same alignment and the compare length is at least 8 bytes. rBITDIF contains the low order 2 bits of rSTR1 and cr5 contains the result of the logical compare - of rBITDIF to 0. If rBITDIF == 0 then we are already word + of rBITDIF to 0. If rBITDIF == 0 then we are already word aligned and can perform the word aligned loop. - + Otherwise we know the two strings have the same alignment (but not yet word aligned). So we force the string addresses to the next lower word boundary and special case this first word using shift left to @@ -143,7 +143,7 @@ L(Waligned): beq L(dP4) bgt cr1, L(dP3) beq cr1, L(dP2) - + /* Remainder is 4 */ .align 4 L(dP1): @@ -152,7 +152,7 @@ L(dP1): (8-15 byte compare), we want to use only volatile registers. This means we can avoid restoring non-volatile registers since we did not change any on the early exit path. The key here is the non-early - exit path only cares about the condition code (cr5), not about which + exit path only cares about the condition code (cr5), not about which register pair was used. */ lwz rWORD5, 0(rSTR1) lwz rWORD6, 0(rSTR2) @@ -170,7 +170,7 @@ L(dP1e): cmplw cr6, rWORD5, rWORD6 bne cr5, L(dLcr5) bne cr0, L(dLcr0) - + lwzu rWORD7, 16(rSTR1) lwzu rWORD8, 16(rSTR2) bne cr1, L(dLcr1) @@ -188,7 +188,7 @@ L(dP1x): bne L(d00) li rRTN, 0 blr - + /* Remainder is 8 */ .align 4 L(dP2): @@ -230,7 +230,7 @@ L(dP2x): bne L(d00) li rRTN, 0 blr - + /* Remainder is 12 */ .align 4 L(dP3): @@ -273,7 +273,7 @@ L(dP3x): bne L(d00) li rRTN, 0 blr - + /* Count is a multiple of 16, remainder is 0 */ .align 4 L(dP4): @@ -316,8 +316,8 @@ L(dLoop3): lwzu rWORD8, 16(rSTR2) bne- cr1, L(dLcr1) cmplw cr0, rWORD1, rWORD2 - bdnz+ L(dLoop) - + bdnz+ L(dLoop) + L(dL4): cmplw cr1, rWORD3, rWORD4 bne cr6, L(dLcr6) @@ -332,7 +332,7 @@ L(d24): bne cr6, L(dLcr6) L(d14): slwi. r12, rN, 3 - bne cr5, L(dLcr5) + bne cr5, L(dLcr5) L(d04): lwz r30,44(1) lwz r31,48(1) @@ -341,10 +341,10 @@ L(d04): beq L(zeroLength) /* At this point we have a remainder of 1 to 3 bytes to compare. Since we are aligned it is safe to load the whole word, and use - shift right to eliminate bits beyond the compare length. */ + shift right to eliminate bits beyond the compare length. */ L(d00): lwz rWORD1, 4(rSTR1) - lwz rWORD2, 4(rSTR2) + lwz rWORD2, 4(rSTR2) srw rWORD1, rWORD1, rN srw rWORD2, rWORD2, rN cmplw rWORD1,rWORD2 @@ -392,22 +392,22 @@ L(dLcr5x): bgtlr cr5 li rRTN, -1 blr - + .align 4 L(bytealigned): cfi_adjust_cfa_offset(-64) mtctr rN /* Power4 wants mtctr 1st in dispatch group */ /* We need to prime this loop. This loop is swing modulo scheduled - to avoid pipe delays. The dependent instruction latencies (load to + to avoid pipe delays. The dependent instruction latencies (load to compare to conditional branch) is 2 to 3 cycles. In this loop each dispatch group ends in a branch and takes 1 cycle. Effectively - the first iteration of the loop only serves to load operands and - branches based on compares are delayed until the next loop. + the first iteration of the loop only serves to load operands and + branches based on compares are delayed until the next loop. So we must precondition some registers and condition codes so that we don't exit the loop early on the first iteration. */ - + lbz rWORD1, 0(rSTR1) lbz rWORD2, 0(rSTR2) bdz- L(b11) @@ -427,7 +427,7 @@ L(bLoop): cmplw cr6, rWORD5, rWORD6 bdz- L(b3i) - + lbzu rWORD3, 1(rSTR1) lbzu rWORD4, 1(rSTR2) bne- cr1, L(bLcr1) @@ -441,10 +441,10 @@ L(bLoop): cmplw cr1, rWORD3, rWORD4 bdnz+ L(bLoop) - + /* We speculatively loading bytes before we have tested the previous bytes. But we must avoid overrunning the length (in the ctr) to - prevent these speculative loads from causing a segfault. In this + prevent these speculative loads from causing a segfault. In this case the loop will exit early (before the all pending bytes are tested. In this case we must complete the pending operations before returning. */ @@ -488,7 +488,7 @@ L(bx56): nop L(b12): bne- cr0, L(bx12) -L(bx34): +L(bx34): sub rRTN, rWORD3, rWORD4 blr @@ -497,7 +497,7 @@ L(bx12): sub rRTN, rWORD1, rWORD2 blr - .align 4 + .align 4 L(zeroLengthReturn): L(zeroLength): @@ -509,9 +509,9 @@ L(zeroLength): /* At this point we know the strings have different alignment and the compare length is at least 8 bytes. rBITDIF contains the low order 2 bits of rSTR1 and cr5 contains the result of the logical compare - of rBITDIF to 0. If rBITDIF == 0 then rStr1 is word aligned and can + of rBITDIF to 0. If rBITDIF == 0 then rStr1 is word aligned and can perform the Wunaligned loop. - + Otherwise we know that rSTR1 is not aready word aligned yet. So we can force the string addresses to the next lower word boundary and special case this first word using shift left to @@ -531,13 +531,13 @@ L(zeroLength): #define rE r0 /* Right rotation temp for rWORD6. */ #define rG r12 /* Right rotation temp for rWORD8. */ L(unaligned): - stw r29,40(r1) - cfi_offset(r29,(40-64)) + stw r29,40(r1) + cfi_offset(r29,(40-64)) clrlwi rSHL, rSTR2, 30 - stw r28,36(r1) + stw r28,36(r1) cfi_offset(r28,(36-64)) beq cr5, L(Wunaligned) - stw r27,32(r1) + stw r27,32(r1) cfi_offset(r27,(32-64)) /* Adjust the logical start of rSTR2 to compensate for the extra bits in the 1st rSTR1 W. */ @@ -545,19 +545,19 @@ L(unaligned): /* But do not attempt to address the W before that W that contains the actual start of rSTR2. */ clrrwi rSTR2, rSTR2, 2 - stw r26,28(r1) + stw r26,28(r1) cfi_offset(r26,(28-64)) /* Compute the left/right shift counts for the unalign rSTR2, - compensating for the logical (W aligned) start of rSTR1. */ + compensating for the logical (W aligned) start of rSTR1. */ clrlwi rSHL, r27, 30 - clrrwi rSTR1, rSTR1, 2 - stw r25,24(r1) + clrrwi rSTR1, rSTR1, 2 + stw r25,24(r1) cfi_offset(r25,(24-64)) slwi rSHL, rSHL, 3 cmplw cr5, r27, rSTR2 add rN, rN, rBITDIF slwi r11, rBITDIF, 3 - stw r24,20(r1) + stw r24,20(r1) cfi_offset(r24,(20-64)) subfic rSHR, rSHL, 32 srwi rTMP, rN, 4 /* Divide by 16 */ @@ -633,16 +633,16 @@ L(duPs4): compare length is at least 8 bytes. */ .align 4 L(Wunaligned): - stw r27,32(r1) + stw r27,32(r1) cfi_offset(r27,(32-64)) clrrwi rSTR2, rSTR2, 2 - stw r26,28(r1) + stw r26,28(r1) cfi_offset(r26,(28-64)) srwi rTMP, rN, 4 /* Divide by 16 */ - stw r25,24(r1) + stw r25,24(r1) cfi_offset(r25,(24-64)) andi. rBITDIF, rN, 12 /* Get the W remainder */ - stw r24,20(r1) + stw r24,20(r1) cfi_offset(r24,(20-64)) slwi rSHL, rSHL, 3 lwz rWORD6, 0(rSTR2) @@ -656,7 +656,7 @@ L(Wunaligned): mtctr rTMP /* Power4 wants mtctr 1st in dispatch group */ bgt cr1, L(duP3) beq cr1, L(duP2) - + /* Remainder is 4 */ .align 4 L(duP1): @@ -687,7 +687,7 @@ L(duP1e): bne cr0, L(duLcr0) or rWORD6, rE, rF cmplw cr6, rWORD5, rWORD6 - b L(duLoop3) + b L(duLoop3) .align 4 /* At this point we exit early with the first word compare complete and remainder of 0 to 3 bytes. See L(du14) for details on @@ -751,7 +751,7 @@ L(duP2x): lwz rWORD2, 4(rSTR2) srw rA, rWORD2, rSHR b L(dutrim) - + /* Remainder is 12 */ .align 4 L(duP3): @@ -801,7 +801,7 @@ L(duP3x): lwz rWORD2, 4(rSTR2) srw rA, rWORD2, rSHR b L(dutrim) - + /* Count is a multiple of 16, remainder is 0 */ .align 4 L(duP4): @@ -867,8 +867,8 @@ L(duLoop3): srw rG, rWORD8, rSHR slw rB, rWORD8, rSHL or rWORD8, rG, rH - bdnz+ L(duLoop) - + bdnz+ L(duLoop) + L(duL4): bne cr1, L(duLcr1) cmplw cr1, rWORD3, rWORD4 @@ -886,9 +886,9 @@ L(du14): slwi. rN, rN, 3 bne cr5, L(duLcr5) /* At this point we have a remainder of 1 to 3 bytes to compare. We use - shift right to eliminate bits beyond the compare length. + shift right to eliminate bits beyond the compare length. - However it may not be safe to load rWORD2 which may be beyond the + However it may not be safe to load rWORD2 which may be beyond the string length. So we compare the bit length of the remainder to the right shift count (rSHR). If the bit count is less than or equal we do not need to load rWORD2 (all significant bits are already in @@ -903,13 +903,13 @@ L(du14): L(dutrim): lwz rWORD1, 4(rSTR1) lwz r31,48(1) - subfic rN, rN, 32 /* Shift count is 32 - (rN * 8). */ + subfic rN, rN, 32 /* Shift count is 32 - (rN * 8). */ or rWORD2, rA, rB lwz r30,44(1) lwz r29,40(r1) srw rWORD1, rWORD1, rN srw rWORD2, rWORD2, rN - lwz r28,36(r1) + lwz r28,36(r1) lwz r27,32(r1) cmplw rWORD1,rWORD2 li rRTN,0 @@ -923,9 +923,9 @@ L(duLcr0): lwz r31,48(1) lwz r30,44(1) li rRTN, 1 - bgt cr0, L(dureturn29) + bgt cr0, L(dureturn29) lwz r29,40(r1) - lwz r28,36(r1) + lwz r28,36(r1) li rRTN, -1 b L(dureturn27) .align 4 @@ -933,9 +933,9 @@ L(duLcr1): lwz r31,48(1) lwz r30,44(1) li rRTN, 1 - bgt cr1, L(dureturn29) + bgt cr1, L(dureturn29) lwz r29,40(r1) - lwz r28,36(r1) + lwz r28,36(r1) li rRTN, -1 b L(dureturn27) .align 4 @@ -943,9 +943,9 @@ L(duLcr6): lwz r31,48(1) lwz r30,44(1) li rRTN, 1 - bgt cr6, L(dureturn29) + bgt cr6, L(dureturn29) lwz r29,40(r1) - lwz r28,36(r1) + lwz r28,36(r1) li rRTN, -1 b L(dureturn27) .align 4 @@ -953,9 +953,9 @@ L(duLcr5): lwz r31,48(1) lwz r30,44(1) li rRTN, 1 - bgt cr5, L(dureturn29) + bgt cr5, L(dureturn29) lwz r29,40(r1) - lwz r28,36(r1) + lwz r28,36(r1) li rRTN, -1 b L(dureturn27) .align 3 @@ -965,19 +965,16 @@ L(duZeroReturn): L(dureturn): lwz r31,48(1) lwz r30,44(1) -L(dureturn29): +L(dureturn29): lwz r29,40(r1) - lwz r28,36(r1) -L(dureturn27): + lwz r28,36(r1) +L(dureturn27): lwz r27,32(r1) -L(dureturn26): +L(dureturn26): lwz r26,28(r1) -L(dureturn25): +L(dureturn25): lwz r25,24(r1) lwz r24,20(r1) lwz 1,0(1) blr -END (memcmp) - -libc_hidden_builtin_def (memcmp) -weak_alias (memcmp, bcmp) +END (__memcmp_power4) diff --git a/sysdeps/powerpc/powerpc32/power7/memcmp.S b/sysdeps/powerpc/powerpc32/multiarch/memcmp-power7.S similarity index 99% rename from sysdeps/powerpc/powerpc32/power7/memcmp.S rename to sysdeps/powerpc/powerpc32/multiarch/memcmp-power7.S index f764b7c..5d63634 100644 --- a/sysdeps/powerpc/powerpc32/power7/memcmp.S +++ b/sysdeps/powerpc/powerpc32/multiarch/memcmp-power7.S @@ -23,7 +23,7 @@ size_t size [r5]) */ .machine power7 -EALIGN (memcmp,4,0) +EALIGN (__memcmp_power7,4,0) CALL_MCOUNT #define rTMP r0 @@ -980,6 +980,4 @@ L(dureturn25): lwz r24,20(r1) lwz 1,0(1) blr -END (memcmp) -libc_hidden_builtin_def (memcmp) -weak_alias (memcmp,bcmp) +END (__memcmp_power7) diff --git a/sysdeps/powerpc/powerpc32/multiarch/memcmp-ppc32.c b/sysdeps/powerpc/powerpc32/multiarch/memcmp-ppc32.c new file mode 100644 index 0000000..b8933d6 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/memcmp-ppc32.c @@ -0,0 +1,34 @@ +/* Default memcmp implementation for PowerPC32. + 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 <string.h> + +#define MEMCMP __memcmp_ppc32 +#undef weak_alias +#define weak_alias(name, aliasname) \ + extern __typeof (__memcmp_ppc32) aliasname \ + __attribute__ ((weak, alias ("__memcmp_ppc32"))); +#ifndef NOT_IN_libc +# undef libc_hidden_builtin_def +# define libc_hidden_builtin_def(name) \ + __hidden_ver1(__memcmp_ppc32, __GI_memcmp, __memcmp_ppc32); +#endif + +extern __typeof (memcmp) __memcmp_ppc32 attribute_hidden; + +#include <string/memcmp.c> diff --git a/sysdeps/powerpc/powerpc32/multiarch/memcmp.c b/sysdeps/powerpc/powerpc32/multiarch/memcmp.c new file mode 100644 index 0000000..36fd32d --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/memcmp.c @@ -0,0 +1,39 @@ +/* Multiple versions of memcmp. + 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/>. */ + +/* Define multiple versions only for definition in libc. */ +#ifndef NOT_IN_libc +# include <string.h> +# include <shlib-compat.h> +# include "init-arch.h" + +extern __typeof (memcmp) __memcmp_ppc32 attribute_hidden; +extern __typeof (memcmp) __memcmp_power4 attribute_hidden; +extern __typeof (memcmp) __memcmp_power7 attribute_hidden; + +/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle + ifunc symbol properly. */ +libc_ifunc (memcmp, + (hwcap & PPC_FEATURE_HAS_VSX) + ? __memcmp_power7 : + (hwcap & PPC_FEATURE_POWER4) + ? __memcmp_power4 + : __memcmp_ppc32); +#else +#include <string/memcmp.c> +#endif http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=37b134fe8cf0425c67b9e8ea238f22c86c228b4f commit 37b134fe8cf0425c67b9e8ea238f22c86c228b4f Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 07:15:23 2013 -0500 PowerPC: memcpy multilib for PowerPC32 diff --git a/string/memcpy.c b/string/memcpy.c index 3be8e35..a5b97ef 100644 --- a/string/memcpy.c +++ b/string/memcpy.c @@ -24,8 +24,12 @@ #undef memcpy +#ifndef MEMCPY +# define MEMCPY memcpy +#endif + void * -memcpy (dstpp, srcpp, len) +MEMCPY (dstpp, srcpp, len) void *dstpp; const void *srcpp; size_t len; diff --git a/sysdeps/powerpc/powerpc32/multiarch/Makefile b/sysdeps/powerpc/powerpc32/multiarch/Makefile index af8d496..d8d84f5 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/multiarch/Makefile @@ -1,3 +1,4 @@ ifeq ($(subdir),string) -sysdep_routines += +sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \ + memcpy-power4 memcpy-ppc32 endif diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c index f4e55ae..3bf0447 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c +++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c @@ -46,5 +46,21 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, else if (hwcap & PPC_FEATURE_POWER5) hwcap |= PPC_FEATURE_POWER4; +#ifdef SHARED + /* Support sysdeps/powerpc/powerpc32/multiarch/memcpy.c. */ + IFUNC_IMPL (i, name, memcpy, + IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_HAS_VSX, + __memcpy_power7) + IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_ARCH_2_06, + __memcpy_a2) + IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_ARCH_2_05, + __memcpy_power6) + IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_CELL_BE, + __memcpy_cell) + IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_POWER4, + __memcpy_power4) + IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_ppc32)) +#endif + return i; } diff --git a/sysdeps/powerpc/powerpc32/a2/memcpy.S b/sysdeps/powerpc/powerpc32/multiarch/memcpy-a2.S similarity index 99% rename from sysdeps/powerpc/powerpc32/a2/memcpy.S rename to sysdeps/powerpc/powerpc32/multiarch/memcpy-a2.S index f2f63b1..67e0f1b 100644 --- a/sysdeps/powerpc/powerpc32/a2/memcpy.S +++ b/sysdeps/powerpc/powerpc32/multiarch/memcpy-a2.S @@ -23,7 +23,7 @@ #define ZERO_AHEAD 2 /* no cache lines DST zeroing ahead */ .machine a2 -EALIGN (memcpy, 5, 0) +EALIGN (__memcpy_a2, 5, 0) CALL_MCOUNT dcbt 0,r4 /* Prefetch ONE SRC cacheline */ @@ -523,5 +523,4 @@ L(endloop2_128): b L(lessthancacheline) -END (memcpy) -libc_hidden_builtin_def (memcpy) +END (__memcpy_a2) diff --git a/sysdeps/powerpc/powerpc32/cell/memcpy.S b/sysdeps/powerpc/powerpc32/multiarch/memcpy-cell.S similarity index 98% rename from sysdeps/powerpc/powerpc32/cell/memcpy.S rename to sysdeps/powerpc/powerpc32/multiarch/memcpy-cell.S index f3605d7..8b0bf40 100644 --- a/sysdeps/powerpc/powerpc32/cell/memcpy.S +++ b/sysdeps/powerpc/powerpc32/multiarch/memcpy-cell.S @@ -39,7 +39,7 @@ .align 7 -EALIGN (memcpy, 5, 0) +EALIGN (__memcpy_cell, 5, 0) CALL_MCOUNT dcbt 0,r4 /* Prefetch ONE SRC cacheline */ @@ -238,5 +238,4 @@ EALIGN (memcpy, 5, 0) stb r0,0(r6) 1: blr -END (memcpy) -libc_hidden_builtin_def (memcpy) +END (__memcpy_cell) diff --git a/sysdeps/powerpc/powerpc32/power4/memcpy.S b/sysdeps/powerpc/powerpc32/multiarch/memcpy-power4.S similarity index 98% rename from sysdeps/powerpc/powerpc32/power4/memcpy.S rename to sysdeps/powerpc/powerpc32/multiarch/memcpy-power4.S index d914663..a9b4e6c 100644 --- a/sysdeps/powerpc/powerpc32/power4/memcpy.S +++ b/sysdeps/powerpc/powerpc32/multiarch/memcpy-power4.S @@ -1,4 +1,4 @@ -/* Optimized memcpy implementation for PowerPC32 on PowerPC64. +/* Optimized memcpy implementation for PowerPC32. Copyright (C) 2003-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -32,7 +32,7 @@ Each case has an optimized unrolled loop. */ .machine power4 -EALIGN (memcpy, 5, 0) +EALIGN (__memcpy_power4, 5, 0) CALL_MCOUNT stwu 1,-32(1) @@ -418,6 +418,4 @@ EALIGN (memcpy, 5, 0) lwz 31,24(1) addi 1,1,32 blr -END (memcpy) - -libc_hidden_builtin_def (memcpy) +END (__memcpy_power4) diff --git a/sysdeps/powerpc/powerpc32/power6/memcpy.S b/sysdeps/powerpc/powerpc32/multiarch/memcpy-power6.S similarity index 99% rename from sysdeps/powerpc/powerpc32/power6/memcpy.S rename to sysdeps/powerpc/powerpc32/multiarch/memcpy-power6.S index d900028..4e39046 100644 --- a/sysdeps/powerpc/powerpc32/power6/memcpy.S +++ b/sysdeps/powerpc/powerpc32/multiarch/memcpy-power6.S @@ -21,7 +21,7 @@ /* __ptr_t [r3] memcpy (__ptr_t dst [r3], __ptr_t src [r4], size_t len [r5]); Returns 'dst'. - Memcpy handles short copies (< 32-bytes) using a binary move blocks + Memcpy handles short copies (< 32-bytes) using a binary move blocks (no loops) of lwz/stw. The tail (remaining 1-3) bytes is handled with the appropriate combination of byte and halfword load/stores. There is minimal effort to optimize the alignment of short moves. @@ -32,7 +32,7 @@ Each case has an optimized unrolled loop. */ .machine power6 -EALIGN (memcpy, 5, 0) +EALIGN (__memcpy_power6, 5, 0) CALL_MCOUNT stwu 1,-32(1) @@ -835,6 +835,4 @@ L(wdus_0): lwz 31,24(1) addi 1,1,32 blr -END (memcpy) - -libc_hidden_builtin_def (memcpy) +END (__memcpy_power6) diff --git a/sysdeps/powerpc/powerpc32/power7/memcpy.S b/sysdeps/powerpc/powerpc32/multiarch/memcpy-power7.S similarity index 99% rename from sysdeps/powerpc/powerpc32/power7/memcpy.S rename to sysdeps/powerpc/powerpc32/multiarch/memcpy-power7.S index 7f00778..00e9fd7 100644 --- a/sysdeps/powerpc/powerpc32/power7/memcpy.S +++ b/sysdeps/powerpc/powerpc32/multiarch/memcpy-power7.S @@ -23,7 +23,7 @@ Returns 'dst'. */ .machine power7 -EALIGN (memcpy, 5, 0) +EALIGN (__memcpy_power7, 5, 0) CALL_MCOUNT stwu 1,-32(1) @@ -520,5 +520,4 @@ L(end_unaligned_loop): addi 1,1,32 blr -END (memcpy) -libc_hidden_builtin_def (memcpy) +END (__memcpy_power7) diff --git a/sysdeps/powerpc/powerpc32/multiarch/memcpy-ppc32.c b/sysdeps/powerpc/powerpc32/multiarch/memcpy-ppc32.c new file mode 100644 index 0000000..8157bed --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/memcpy-ppc32.c @@ -0,0 +1,30 @@ +/* Default memcpy for PowerPC32. + 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 <string.h> + +#define MEMCPY __memcpy_ppc32 +#if defined SHARED && !defined NOT_IN_libc +# undef libc_hidden_builtin_def +# define libc_hidden_builtin_def(name) \ + __hidden_ver1(__memcpy_ppc32, __GI_memcpy, __memcpy_ppc32); +#endif + +extern __typeof (memcpy) __memcpy_ppc32 attribute_hidden; + +#include <string/memcpy.c> diff --git a/sysdeps/powerpc/powerpc32/multiarch/memcpy.c b/sysdeps/powerpc/powerpc32/multiarch/memcpy.c new file mode 100644 index 0000000..572cc69 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/memcpy.c @@ -0,0 +1,50 @@ +/* Multiple versions of memcpy. + 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/>. */ + +/* Define multiple versions only for the definition in lib and for + DSO. In static binaries we need memcpy before the initialization + happened. */ +#if defined SHARED && !defined NOT_IN_libc +# include <string.h> +# include <shlib-compat.h> +# include "init-arch.h" + +extern __typeof (memcpy) __memcpy_ppc32 attribute_hidden; +extern __typeof (memcpy) __memcpy_power4 attribute_hidden; +extern __typeof (memcpy) __memcpy_cell attribute_hidden; +extern __typeof (memcpy) __memcpy_power6 attribute_hidden; +extern __typeof (memcpy) __memcpy_a2 attribute_hidden; +extern __typeof (memcpy) __memcpy_power7 attribute_hidden; + +/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle + ifunc symbol properly. */ +libc_ifunc (memcpy, + (hwcap & PPC_FEATURE_HAS_VSX) + ? __memcpy_power7 : + (hwcap & PPC_FEATURE_ARCH_2_06) + ? __memcpy_a2 : + (hwcap & PPC_FEATURE_ARCH_2_05) + ? __memcpy_power6 : + (hwcap & PPC_FEATURE_CELL_BE) + ? __memcpy_cell : + (hwcap & PPC_FEATURE_POWER4) + ? __memcpy_power4 + : __memcpy_ppc32); +#else +#include <string/memcpy.c> +#endif http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ca41aaab121b29e7292faf7af1720b8350624a86 commit ca41aaab121b29e7292faf7af1720b8350624a86 Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date: Wed Jun 5 07:13:56 2013 -0500 PowerPC: initial support for multilib for PowerPC32 This patch add a empty Makefile, the C IFUNC helper macros, and a empty available IFUNC implementation enumeration. diff --git a/sysdeps/powerpc/powerpc32/multiarch/Makefile b/sysdeps/powerpc/powerpc32/multiarch/Makefile new file mode 100644 index 0000000..af8d496 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/Makefile @@ -0,0 +1,3 @@ +ifeq ($(subdir),string) +sysdep_routines += +endif diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c new file mode 100644 index 0000000..f4e55ae --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c @@ -0,0 +1,50 @@ +/* Enumerate available IFUNC implementations of a function. PowerPC32 version. + 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 <assert.h> +#include <string.h> +#include <wchar.h> +#include <ldsodefs.h> +#include <ifunc-impl-list.h> + +/* Maximum number of IFUNC implementations. */ +#define MAX_IFUNC 6 + +size_t +__libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, + size_t max) +{ + assert (max >= MAX_IFUNC); + + size_t i = 0; + + unsigned long int hwcap = GLRO(dl_hwcap); + /* hwcap contains only the latest supported ISA, the code checks which is + and fills the previous supported ones. */ + if (hwcap & PPC_FEATURE_ARCH_2_06) + hwcap |= PPC_FEATURE_ARCH_2_05 | PPC_FEATURE_POWER5_PLUS | + PPC_FEATURE_POWER5 | PPC_FEATURE_POWER4; + else if (hwcap & PPC_FEATURE_ARCH_2_05) + hwcap |= PPC_FEATURE_POWER5_PLUS | PPC_FEATURE_POWER5 | PPC_FEATURE_POWER4; + else if (hwcap & PPC_FEATURE_POWER5_PLUS) + hwcap |= PPC_FEATURE_POWER5 | PPC_FEATURE_POWER4; + else if (hwcap & PPC_FEATURE_POWER5) + hwcap |= PPC_FEATURE_POWER4; + + return i; +} diff --git a/sysdeps/powerpc/powerpc32/multiarch/init-arch.h b/sysdeps/powerpc/powerpc32/multiarch/init-arch.h new file mode 100644 index 0000000..490c0b4 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/init-arch.h @@ -0,0 +1,52 @@ +/* This file is part of the GNU C Library. + Copyright (C) 2013 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 + <http://www.gnu.org/licenses/>. */ + +#include <ldsodefs.h> + +/* The code checks if _rtld_global_ro was realocated before trying to access + the dl_hwcap field. The assembly is to make the compiler not optimize the + test (&_rtld_global_ro != NULL), which is always true in ISO C (but not + in that case since _rtld_global_ro might not been realocated yet). */ +#if defined(SHARED) && !defined(IS_IN_rtld) +# define __GLRO(value) \ + ({ volatile void **__p = (volatile void**)(&_rtld_global_ro); \ + unsigned long int __ret; \ + asm ("# x in %0" : "+r" (__p)); \ + __ret = (__p) ? GLRO(value) : 0; \ + __ret; }) +#else +# define __GLRO(value) GLRO(value) +#endif + +/* dl_hwcap contains only the latest supported ISA, the macro checks which is + and fills the previous ones. */ +#define INIT_ARCH() \ + unsigned long int hwcap = __GLRO(dl_hwcap); \ + if (hwcap & PPC_FEATURE_ARCH_2_06) \ + hwcap |= PPC_FEATURE_ARCH_2_05 | \ + PPC_FEATURE_POWER5_PLUS | \ + PPC_FEATURE_POWER5 | \ + PPC_FEATURE_POWER4; \ + else if (hwcap & PPC_FEATURE_ARCH_2_05) \ + hwcap |= PPC_FEATURE_POWER5_PLUS | \ + PPC_FEATURE_POWER5 | \ + PPC_FEATURE_POWER4; \ + else if (hwcap & PPC_FEATURE_POWER5_PLUS) \ + hwcap |= PPC_FEATURE_POWER5 | \ + PPC_FEATURE_POWER4; \ + else if (hwcap & PPC_FEATURE_POWER5) \ + hwcap |= PPC_FEATURE_POWER4; ----------------------------------------------------------------------- hooks/post-receive -- GNU C Library master sources
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |