From 119269606996258ee0a53ff9e5828d474ee0f698 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Mon, 11 Mar 2019 03:29:37 +0000 Subject: powerpc: Remove optimized finite The powerpc finite optimization do not show much gain: - GCC will call libm iff -fsignaling-nans is used. This usage pattern is usually not performance oriented and for such calls PLT overhead should dominate execution time. - The power7 uses ftdiv to optimize for some input patterns, but at cost of others. Comparing against generic C implementation built for powerpc64-linux-gnu-power7 (--with-cpu=power7): - Generic sysdeps/ieee754 implementation: "isfinite": { "": { "duration": 5.0082e+09, "iterations": 2.45299e+09, "max": 43.824, "min": 2.008, "mean": 2.04167 }, "INF": { "duration": 4.66554e+09, "iterations": 2.28288e+09, "max": 35.73, "min": 2.008, "mean": 2.04371 }, "NAN": { "duration": 4.66274e+09, "iterations": 2.28716e+09, "max": 34.161, "min": 2.009, "mean": 2.03866 } } - power7 optimized one: "isfinite": { "": { "duration": 4.99111e+09, "iterations": 2.65566e+09, "max": 25.015, "min": 1.716, "mean": 1.87942 }, "INF": { "duration": 4.6783e+09, "iterations": 2.0999e+09, "max": 35.264, "min": 1.868, "mean": 2.22787 }, "NAN": { "duration": 4.67915e+09, "iterations": 2.08678e+09, "max": 38.099, "min": 1.869, "mean": 2.24228 } } So it basically optimizes marginally for normal numbers while increasing the latency for other kind of FP. - The power8 implementation is just the generic implementation using ISA 2.07 mfvsrd instruction (which GCC uses for generic implementation). So generic implementation is the best option for powerpc64le. 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/powerpc32/power4/fpu/multiarch/Makefile (sysdeps_routines, libm-sysdep_routines): Remove s_finite* objects. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite-power7.S: Remove file. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite-ppc32.c: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite.c: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef-ppc32.c: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef.c: Likewise. * sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S: Likewise. * sysdeps/powerpc/powerpc32/power7/fpu/s_finitef.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile (sysdep_call): Remove s_finite* objects. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power7.S: Remove file. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power8.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef.c: Likewise. * sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S: Likewise. * sysdeps/powerpc/powerpc64/power7/fpu/s_finitef.S: Likewise. * sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S: Likewise. * sysdeps/powerpc/powerpc64/power8/fpu/s_finitef.S: Likewise. Reviewed-by: Gabriel F. T. Gomes --- sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile | 4 +- .../powerpc64/fpu/multiarch/s_finite-power7.S | 32 ---------- .../powerpc64/fpu/multiarch/s_finite-power8.S | 32 ---------- .../powerpc64/fpu/multiarch/s_finite-ppc64.c | 34 ----------- sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c | 69 ---------------------- .../powerpc64/fpu/multiarch/s_finitef-ppc64.c | 32 ---------- .../powerpc/powerpc64/fpu/multiarch/s_finitef.c | 37 ------------ 7 files changed, 1 insertion(+), 239 deletions(-) delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power7.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power8.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-ppc64.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef-ppc64.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef.c (limited to 'sysdeps/powerpc/powerpc64/fpu/multiarch') diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile index 3a2051d97b..4aa7fd6295 100644 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile @@ -2,9 +2,7 @@ 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_finite-power8 s_finite-power7 s_finite-ppc64 \ - s_finitef-ppc64 \ - s_modf-power5+ s_modf-ppc64 \ +sysdep_calls := s_modf-power5+ s_modf-ppc64 \ s_modff-power5+ s_modff-ppc64 sysdep_routines += $(sysdep_calls) diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power7.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power7.S deleted file mode 100644 index c360c3a8db..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power7.S +++ /dev/null @@ -1,32 +0,0 @@ -/* isnan(). PowerPC64/POWER7 version. - 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 hidden_def -#define hidden_def(name) -#undef weak_alias -#define weak_alias(name, alias) -#undef strong_alias -#define strong_alias(name, alias) -#undef compat_symbol -#define compat_symbol(lib, name, symbol, ver) - -#define __finite __finite_power7 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power8.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power8.S deleted file mode 100644 index 8fa57e222e..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power8.S +++ /dev/null @@ -1,32 +0,0 @@ -/* isnan(). PowerPC64/POWER7 version. - Copyright (C) 2014-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 hidden_def -#define hidden_def(name) -#undef weak_alias -#define weak_alias(name, alias) -#undef strong_alias -#define strong_alias(name, alias) -#undef compat_symbol -#define compat_symbol(lib, name, symbol, ver) - -#define __finite __finite_power8 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-ppc64.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-ppc64.c deleted file mode 100644 index 59cc8ba168..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-ppc64.c +++ /dev/null @@ -1,34 +0,0 @@ -/* finite(). PowerPC64 default version. - Copyright (C) 2013-2019 Free Software Foundation, Inc. - Contributed by Luis Machado . - 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) -#undef strong_alias -#define strong_alias(a, b) - -#define FINITE __finite_ppc64 -#ifdef SHARED -# undef hidden_def -# define hidden_def(a) \ - __hidden_ver1 (__finite_ppc64, __GI___finite, __finite_ppc64); -#endif - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c deleted file mode 100644 index 4f88a221cc..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c +++ /dev/null @@ -1,69 +0,0 @@ -/* Multiple versions of finite. - 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 __finite __redirect___finite - -/* The following definitions, although not related to the 'double' - version of 'finite', are required to guarantee macro expansions - (e.g.: from __finitef to __redirect_finitef) in include/math.h, thus - compensating for the unintended macro expansions in - math/bits/mathcalls-helper-functions.h. */ -#define __finitef __redirect___finitef -#define __finitel __redirect___finitel -#define __finitef128 __redirect___finitef128 - -#include -#include -#include -#include "init-arch.h" - -extern __typeof (__finite) __finite_ppc64 attribute_hidden; -extern __typeof (__finite) __finite_power7 attribute_hidden; -extern __typeof (__finite) __finite_power8 attribute_hidden; -#undef __finite -#undef __finitef -#undef __finitel -#undef __finitef128 - -libc_ifunc_redirected (__redirect___finite, __finite, - (hwcap2 & PPC_FEATURE2_ARCH_2_07) - ? __finite_power8 - : (hwcap & PPC_FEATURE_ARCH_2_06) - ? __finite_power7 - : __finite_ppc64); - -weak_alias (__finite, finite) - -#ifdef NO_LONG_DOUBLE -strong_alias (__finite, __finitel) -weak_alias (__finite, finitel) -#endif - -#if 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/powerpc64/fpu/multiarch/s_finitef-ppc64.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef-ppc64.c deleted file mode 100644 index 77af76d3ef..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef-ppc64.c +++ /dev/null @@ -1,32 +0,0 @@ -/* finitef(). PowerPC64 default version. - Copyright (C) 2013-2019 Free Software Foundation, Inc. - Contributed by Luis Machado . - 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 FINITEF __finitef_ppc64 -#ifdef SHARED -# undef hidden_def -# define hidden_def(a) \ - __hidden_ver1 (__finitef_ppc64, __GI___finitef, __finitef_ppc64); -#endif - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef.c deleted file mode 100644 index cde669e5e3..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Multiple versions of finitef. - 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 __finitef __redirect___finitef -#include -#include -#include "init-arch.h" - -extern __typeof (__finitef) __finitef_ppc64 attribute_hidden; -/* The double-precision version also works for single-precision. */ -extern __typeof (__finitef) __finite_power7 attribute_hidden; -extern __typeof (__finitef) __finite_power8 attribute_hidden; -#undef __finitef - -libc_ifunc_redirected (__redirect___finitef, __finitef, - (hwcap2 & PPC_FEATURE2_ARCH_2_07) - ? __finite_power8 - : (hwcap & PPC_FEATURE_ARCH_2_06) - ? __finite_power7 - : __finitef_ppc64); - -weak_alias (__finitef, finitef) -- cgit 1.4.1