aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/x86_64/multiarch
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-03-24 18:56:34 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-05-07 13:35:29 -0300
commitdb373e4c57159ac82df4b07b596dd29c4cfe9d86 (patch)
treeaf01c60f6c1bbb8e2881fb7fc43bca85330d853c /sysdeps/x86_64/multiarch
parent69e0a5eb0d5acb4b55dbef68b68fc4a10f2911af (diff)
downloadglibc-db373e4c57159ac82df4b07b596dd29c4cfe9d86.zip
glibc-db373e4c57159ac82df4b07b596dd29c4cfe9d86.tar.gz
glibc-db373e4c57159ac82df4b07b596dd29c4cfe9d86.tar.bz2
Remove architecture specific sched_cpucount optimizations
And replace the generic algorithm with the Brian Kernighan's one. GCC optimize it with popcnt if the architecture supports, so there is no need to add the extra POPCNT define to enable it. This is really a micro-optimization that only adds complexity: recent ABIs already support it (x86-64-v2 or power64le) and it simplifies the code for internal usage, since i686 does not allow an internal iFUNC call. Checked on x86_64-linux-gnu, aarch64-linux-gnu, and powerpc64le-linux-gnu.
Diffstat (limited to 'sysdeps/x86_64/multiarch')
-rw-r--r--sysdeps/x86_64/multiarch/sched_cpucount.c36
1 files changed, 0 insertions, 36 deletions
diff --git a/sysdeps/x86_64/multiarch/sched_cpucount.c b/sysdeps/x86_64/multiarch/sched_cpucount.c
deleted file mode 100644
index 5180a11..0000000
--- a/sysdeps/x86_64/multiarch/sched_cpucount.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Count bits in CPU set. x86-64 multi-arch version.
- This file is part of the GNU C Library.
- Copyright (C) 2008-2021 Free Software Foundation, Inc.
- Contributed by Ulrich Drepper <drepper@redhat.com>.
-
- 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
- <https://www.gnu.org/licenses/>. */
-
-#include <sched.h>
-#include "init-arch.h"
-
-#define __sched_cpucount static generic_cpucount
-#include <posix/sched_cpucount.c>
-#undef __sched_cpucount
-
-#define POPCNT(l) \
- ({ __cpu_mask r; \
- asm ("popcnt %1, %0" : "=r" (r) : "0" (l));\
- r; })
-#define __sched_cpucount static popcount_cpucount
-#include <posix/sched_cpucount.c>
-#undef __sched_cpucount
-
-libc_ifunc (__sched_cpucount,
- CPU_FEATURE_USABLE (POPCNT) ? popcount_cpucount : generic_cpucount);