From 931c616eedc303d48fdd3b05bc063b354a133c74 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Mon, 18 Mar 2019 20:18:49 +0000 Subject: powerpc: Refactor modf{f} The modf{f} optimization is not an optimization for ISA 2.07+. This patch move the IFUNC for powerpc64 only, move the power5+ to generic location, and include the generic implementation for ISA 2.07+. The performance changes are based on modf benchtests: * POWER9 - ppc64 "modf": { "": { "duration": 4.97057e+09, "iterations": 1.00688e+09, "max": 28.76, "min": 4.912, "mean": 4.9366 } } * POWER9 - power5+ "modf": { "": { "duration": 4.98291e+09, "iterations": 9.32818e+08, "max": 15.058, "min": 5.107, "mean": 5.34178 } } * POWER8 - ppc64 "modf": { "": { "duration": 5.05329e+09, "iterations": 8.38814e+08, "max": 518.051, "min": 5.79, "mean": 6.02433 } } * POWER8 - power5+ "modf": { "": { "duration": 5.05573e+09, "iterations": 8.35254e+08, "max": 63.141, "min": 5.873, "mean": 6.05293 } } * POWER7 - ppc64 "modf": { "": { "duration": 4.89818e+09, "iterations": 1.08408e+09, "max": 57.556, "min": 3.953, "mean": 4.51827 } } * POWER7 - power5+ "modf": { "": { "duration": 4.83789e+09, "iterations": 1.33409e+09, "max": 46.608, "min": 2.224, "mean": 3.62636 } } Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/power5+/fpu/s_modf.c: Move to ... * sysdeps/powerpc/fpu/s_modf.c: ... here. Add ISA 2.07 optimization. * sysdeps/powerpc/power5+/fpu/s_modff.c: Move to ... * sysdeps/powerpc/fpu/s_modff.c: ... here. Add ISA 2.07 optimization. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modf-power5+.c: Adjust include. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modff-power5+.c: Likewise. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile (sysdep_calls, sysdep_routines): Add s_modf* objects. (CFLAGS-s_modf-power5+.c, CFLAGS-s_modff-power5+.c, CFLAGS-s_modf-ppc64.c, CFLAGS-s_modff-ppc64.c): New rule. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf-power5+.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-power5+.c: ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf-power5+.c: Movo to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-power5+.c: Move ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf.c: ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff-power5+.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-power5+.c: ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff-ppc64.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-ppc64.c: ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff.c: ... here. Reviewed-by: Gabriel F. T. Gomes --- sysdeps/powerpc/fpu/s_modf.c | 59 ++++++++++++++++++++++ sysdeps/powerpc/fpu/s_modff.c | 55 ++++++++++++++++++++ sysdeps/powerpc/power5+/fpu/s_modf.c | 50 ------------------ sysdeps/powerpc/power5+/fpu/s_modff.c | 46 ----------------- .../power4/fpu/multiarch/s_modf-power5+.c | 13 +---- .../power4/fpu/multiarch/s_modff-power5+.c | 9 +--- .../powerpc/powerpc64/be/fpu/multiarch/Makefile | 19 ++++++- .../powerpc64/be/fpu/multiarch/s_modf-power5+.c | 20 ++++++++ .../powerpc64/be/fpu/multiarch/s_modf-ppc64.c | 24 +++++++++ .../powerpc/powerpc64/be/fpu/multiarch/s_modf.c | 37 ++++++++++++++ .../powerpc64/be/fpu/multiarch/s_modff-power5+.c | 20 ++++++++ .../powerpc64/be/fpu/multiarch/s_modff-ppc64.c | 26 ++++++++++ .../powerpc/powerpc64/be/fpu/multiarch/s_modff.c | 31 ++++++++++++ sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile | 13 ----- .../powerpc64/fpu/multiarch/s_modf-power5+.c | 19 ------- .../powerpc/powerpc64/fpu/multiarch/s_modf-ppc64.c | 24 --------- sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf.c | 37 -------------- .../powerpc64/fpu/multiarch/s_modff-power5+.c | 19 ------- .../powerpc64/fpu/multiarch/s_modff-ppc64.c | 26 ---------- sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff.c | 31 ------------ 20 files changed, 292 insertions(+), 286 deletions(-) create mode 100644 sysdeps/powerpc/fpu/s_modf.c create mode 100644 sysdeps/powerpc/fpu/s_modff.c delete mode 100644 sysdeps/powerpc/power5+/fpu/s_modf.c delete mode 100644 sysdeps/powerpc/power5+/fpu/s_modff.c create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-power5+.c create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-ppc64.c create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf.c create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-power5+.c create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-ppc64.c create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf-power5+.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf-ppc64.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff-power5+.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff-ppc64.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff.c (limited to 'sysdeps') diff --git a/sysdeps/powerpc/fpu/s_modf.c b/sysdeps/powerpc/fpu/s_modf.c new file mode 100644 index 0000000..2304fc4 --- /dev/null +++ b/sysdeps/powerpc/fpu/s_modf.c @@ -0,0 +1,59 @@ +/* Copyright (C) 2013-2019 Free Software Foundation, Inc. + This file is part of the GNU C Library + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see . */ + +/* ISA 2.07 provides fast GPR to FP instruction (mfvsr{d,wz}) which make + generic implementation faster. Also disables for old ISAs that do not + have ceil/floor instructions. */ +#if defined(_ARCH_PWR8) || !defined(_ARCH_PWR5X) +# include +#else +# include +# include +# include + +double +__modf (double x, double *iptr) +{ + if (__builtin_isinf (x)) + { + *iptr = x; + return copysign (0.0, x); + } + else if (__builtin_isnan (x)) + { + *iptr = NAN; + return NAN; + } + + if (x >= 0.0) + { + *iptr = floor (x); + return copysign (x - *iptr, x); + } + else + { + *iptr = ceil (x); + return copysign (x - *iptr, x); + } +} +# ifndef __modf +libm_alias_double (__modf, modf) +# if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) +compat_symbol (libc, __modf, modfl, GLIBC_2_0); +# endif +# endif +#endif diff --git a/sysdeps/powerpc/fpu/s_modff.c b/sysdeps/powerpc/fpu/s_modff.c new file mode 100644 index 0000000..2a0f114 --- /dev/null +++ b/sysdeps/powerpc/fpu/s_modff.c @@ -0,0 +1,55 @@ +/* Copyright (C) 2013-2019 Free Software Foundation, Inc. + This file is part of the GNU C Library + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see . */ + +/* ISA 2.07 provides fast GPR to FP instruction (mfvsr{d,wz}) which make + generic implementation faster. Also disables for old ISAs that do not + have ceil/floor instructions. */ +#if defined(_ARCH_PWR8) || !defined(_ARCH_PWR5X) +# include +#else +# include +# include + +float +__modff (float x, float *iptr) +{ + if (__builtin_isinff (x)) + { + *iptr = x; + return copysignf (0.0, x); + } + else if (__builtin_isnanf (x)) + { + *iptr = NAN; + return NAN; + } + + if (x >= 0.0) + { + *iptr = floorf (x); + return copysignf (x - *iptr, x); + } + else + { + *iptr = ceilf (x); + return copysignf (x - *iptr, x); + } +} +# ifndef __modff +libm_alias_float (__modf, modf) +# endif +#endif diff --git a/sysdeps/powerpc/power5+/fpu/s_modf.c b/sysdeps/powerpc/power5+/fpu/s_modf.c deleted file mode 100644 index dbb1165..0000000 --- a/sysdeps/powerpc/power5+/fpu/s_modf.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (C) 2013-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If - not, see . */ - -#include -#include -#include - -double -__modf (double x, double *iptr) -{ - if (__builtin_isinf (x)) - { - *iptr = x; - return copysign (0.0, x); - } - else if (__builtin_isnan (x)) - { - *iptr = NAN; - return NAN; - } - - if (x >= 0.0) - { - *iptr = floor (x); - return copysign (x - *iptr, x); - } - else - { - *iptr = ceil (x); - return copysign (x - *iptr, x); - } -} -libm_alias_double (__modf, modf) -#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) -compat_symbol (libc, __modf, modfl, GLIBC_2_0); -#endif diff --git a/sysdeps/powerpc/power5+/fpu/s_modff.c b/sysdeps/powerpc/power5+/fpu/s_modff.c deleted file mode 100644 index 87c9f02..0000000 --- a/sysdeps/powerpc/power5+/fpu/s_modff.c +++ /dev/null @@ -1,46 +0,0 @@ -/* Copyright (C) 2013-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If - not, see . */ - -#include -#include - -float -__modff (float x, float *iptr) -{ - if (__builtin_isinff (x)) - { - *iptr = x; - return copysignf (0.0, x); - } - else if (__builtin_isnanf (x)) - { - *iptr = NAN; - return NAN; - } - - if (x >= 0.0) - { - *iptr = floorf (x); - return copysignf (x - *iptr, x); - } - else - { - *iptr = ceilf (x); - return copysignf (x - *iptr, x); - } -} -libm_alias_float (__modf, modf) diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modf-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modf-power5+.c index b1d0540..6f93c2b 100644 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modf-power5+.c +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modf-power5+.c @@ -16,16 +16,5 @@ License along with the GNU C Library; if not, see . */ -#include -#include - -#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 +#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modff-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modff-power5+.c index 8b333ea..2e70188 100644 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modff-power5+.c +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modff-power5+.c @@ -16,12 +16,5 @@ License along with the GNU C Library; if not, see . */ -#include -#include - -#undef weak_alias -#define weak_alias(a,b) - #define __modff __modff_power5plus - -#include +#include diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile index f542e89..f5fa357 100644 --- a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile @@ -1,4 +1,13 @@ ifeq ($(subdir),math) +# These functions are built both for libc and libm because they're required +# by printf. While the libc objects have the prefix s_, the libm ones are +# prefixed with m_. +sysdep_calls := s_modf-power5+ \ + s_modf-ppc64 \ + s_modff-power5+ \ + s_modff-ppc64 + +sysdep_routines += $(sysdep_calls) libm-sysdep_routines += s_ceil-power5+ \ s_ceil-ppc64 \ s_ceilf-power5+ \ @@ -22,7 +31,8 @@ libm-sysdep_routines += s_ceil-power5+ \ s_llround-power6x \ s_llround-power5+ \ s_llround-ppc64 \ - s_llroundf-ppc64 + s_llroundf-ppc64 \ + $(sysdep_calls:s_%=m_%) CFLAGS-s_ceil-power5+.c = -mcpu=power5+ CFLAGS-s_ceilf-power5+.c = -mcpu=power5+ @@ -37,4 +47,11 @@ CFLAGS-s_llrint-power6x.c += -mcpu=power6x CFLAGS-s_llround-power8.c += -mcpu=power8 CFLAGS-s_llround-power6x.c += -mcpu=power6x CFLAGS-s_llround-power5+.c += -mcpu=power5+ + +CFLAGS-s_modf-power5+.c += -mcpu=power5+ +CFLAGS-s_modff-power5+.c += -mcpu=power5+ +# These files quiet sNaNs in a way that is optimized away without +# -fsignaling-nans. +CFLAGS-s_modf-ppc64.c += -fsignaling-nans +CFLAGS-s_modff-ppc64.c += -fsignaling-nans endif diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-power5+.c new file mode 100644 index 0000000..6f93c2b --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-power5+.c @@ -0,0 +1,20 @@ +/* PowerPC/POWER5+ implementation for modf. + Copyright (C) 2013-2019 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 + . */ + +#define __modf __modf_power5plus +#include diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-ppc64.c new file mode 100644 index 0000000..06f0e87 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-ppc64.c @@ -0,0 +1,24 @@ +/* PowerPC64 default implementation for modf. + Copyright (C) 2013-2019 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 + . */ + +#include +#include + +#define __modf __modf_ppc64 + +#include diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf.c new file mode 100644 index 0000000..af57aaa --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf.c @@ -0,0 +1,37 @@ +/* Multiple versions of modf. + Copyright (C) 2013-2019 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 + . */ + +#include +#include +#include +#include "init-arch.h" +#include + +extern __typeof (__modf) __modf_ppc64 attribute_hidden; +extern __typeof (__modf) __modf_power5plus attribute_hidden; + +libc_ifunc (__modf, + (hwcap & PPC_FEATURE_POWER5_PLUS) + ? __modf_power5plus + : __modf_ppc64); + +libm_alias_double (__modf, modf) + +#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) +compat_symbol (libc, __modf, modfl, GLIBC_2_0); +#endif diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-power5+.c new file mode 100644 index 0000000..2e70188 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-power5+.c @@ -0,0 +1,20 @@ +/* PowerPC/POWER5+ implementation for modff. + Copyright (C) 2013-2019 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 + . */ + +#define __modff __modff_power5plus +#include diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-ppc64.c new file mode 100644 index 0000000..5af1887 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-ppc64.c @@ -0,0 +1,26 @@ +/* PowerPC64 default implementation for modff. + Copyright (C) 2013-2019 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 + . */ + +#include + +#undef weak_alias +#define weak_alias(a,b) + +#define __modff __modff_ppc64 + +#include diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff.c new file mode 100644 index 0000000..f048f4a --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff.c @@ -0,0 +1,31 @@ +/* Multiple versions of modff. + Copyright (C) 2013-2019 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 + . */ + +#include +#include "init-arch.h" +#include + +extern __typeof (__modff) __modff_ppc64 attribute_hidden; +extern __typeof (__modff) __modff_power5plus attribute_hidden; + +libc_ifunc (__modff, + (hwcap & PPC_FEATURE_POWER5_PLUS) + ? __modff_power5plus + : __modff_ppc64); + +libm_alias_float (__modf, modf) diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile index 534d5a7..d7ad1e2 100644 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile @@ -1,10 +1,4 @@ ifeq ($(subdir),math) -# These functions are built both for libc and libm because they're required -# by printf. While the libc objects have the prefix s_, the libm ones are -# prefixed with m_. -sysdep_calls := s_modf-power5+ s_modf-ppc64 \ - s_modff-power5+ s_modff-ppc64 - sysdep_routines += $(sysdep_calls) libm-sysdep_routines += s_logb-power7 s_logbf-power7 \ s_logbl-power7 s_logb-ppc64 s_logbf-ppc64 \ @@ -14,11 +8,4 @@ libm-sysdep_routines += s_logb-power7 s_logbf-power7 \ CFLAGS-s_logbf-power7.c = -mcpu=power7 CFLAGS-s_logbl-power7.c = -mcpu=power7 CFLAGS-s_logb-power7.c = -mcpu=power7 -CFLAGS-s_modf-power5+.c = -mcpu=power5+ -CFLAGS-s_modff-power5+.c = -mcpu=power5+ - -# These files quiet sNaNs in a way that is optimized away without -# -fsignaling-nans. -CFLAGS-s_modf-ppc64.c += -fsignaling-nans -CFLAGS-s_modff-ppc64.c += -fsignaling-nans endif diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf-power5+.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf-power5+.c deleted file mode 100644 index 1a958de..0000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf-power5+.c +++ /dev/null @@ -1,19 +0,0 @@ -/* PowerPC/POWER5+ implementation for modf. - Copyright (C) 2013-2019 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 - . */ - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf-ppc64.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf-ppc64.c deleted file mode 100644 index 06f0e87..0000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf-ppc64.c +++ /dev/null @@ -1,24 +0,0 @@ -/* PowerPC64 default implementation for modf. - Copyright (C) 2013-2019 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 - . */ - -#include -#include - -#define __modf __modf_ppc64 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf.c deleted file mode 100644 index af57aaa..0000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Multiple versions of modf. - Copyright (C) 2013-2019 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 - . */ - -#include -#include -#include -#include "init-arch.h" -#include - -extern __typeof (__modf) __modf_ppc64 attribute_hidden; -extern __typeof (__modf) __modf_power5plus attribute_hidden; - -libc_ifunc (__modf, - (hwcap & PPC_FEATURE_POWER5_PLUS) - ? __modf_power5plus - : __modf_ppc64); - -libm_alias_double (__modf, modf) - -#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) -compat_symbol (libc, __modf, modfl, GLIBC_2_0); -#endif diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff-power5+.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff-power5+.c deleted file mode 100644 index 4939d4b..0000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff-power5+.c +++ /dev/null @@ -1,19 +0,0 @@ -/* PowerPC/POWER5+ implementation for modff. - Copyright (C) 2013-2019 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 - . */ - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff-ppc64.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff-ppc64.c deleted file mode 100644 index 5af1887..0000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff-ppc64.c +++ /dev/null @@ -1,26 +0,0 @@ -/* PowerPC64 default implementation for modff. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(a,b) - -#define __modff __modff_ppc64 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff.c deleted file mode 100644 index f048f4a..0000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Multiple versions of modff. - Copyright (C) 2013-2019 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 - . */ - -#include -#include "init-arch.h" -#include - -extern __typeof (__modff) __modff_ppc64 attribute_hidden; -extern __typeof (__modff) __modff_power5plus attribute_hidden; - -libc_ifunc (__modff, - (hwcap & PPC_FEATURE_POWER5_PLUS) - ? __modff_power5plus - : __modff_ppc64); - -libm_alias_float (__modf, modf) -- cgit v1.1