aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-08-11 14:07:04 -0400
committerUlrich Drepper <drepper@gmail.com>2011-08-11 14:07:04 -0400
commit8e999d29628b0d1fec3046722554e792c351450b (patch)
tree79061a4d87ac4cc31aa005554c627dea15a0ec9e
parent89edf2e9119b57fc404891670d2bc47bdfdb61ef (diff)
downloadglibc-8e999d29628b0d1fec3046722554e792c351450b.tar
glibc-8e999d29628b0d1fec3046722554e792c351450b.tar.gz
glibc-8e999d29628b0d1fec3046722554e792c351450b.tar.bz2
glibc-8e999d29628b0d1fec3046722554e792c351450b.zip
Minor optimization of popcount in l10nflist
-rw-r--r--ChangeLog3
-rw-r--r--intl/l10nflist.c2
-rw-r--r--sysdeps/x86_64/l10nflist.c13
3 files changed, 18 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 88ed726e13..83bee3f6e3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2011-08-11 Ulrich Drepper <drepper@gmail.com>
+ * intl/l10nflist.c: Allow architecture-specific pop function.
+ * sysdeps/x86_64/l10nflist.c: New file.
+
* intl/l10nflist.c (_nl_make_l10nflist): Use locale-independent
classification.
diff --git a/intl/l10nflist.c b/intl/l10nflist.c
index a38e0efe90..82af2633b5 100644
--- a/intl/l10nflist.c
+++ b/intl/l10nflist.c
@@ -150,6 +150,7 @@ argz_next__ (argz, argz_len, entry)
/* Return number of bits set in X. */
+#ifndef ARCH_POP
static int pop PARAMS ((int x));
static inline int
@@ -164,6 +165,7 @@ pop (x)
return x;
}
+#endif
struct loaded_l10nfile *
diff --git a/sysdeps/x86_64/l10nflist.c b/sysdeps/x86_64/l10nflist.c
new file mode 100644
index 0000000000..2e08372338
--- /dev/null
+++ b/sysdeps/x86_64/l10nflist.c
@@ -0,0 +1,13 @@
+#ifdef __POPCNT__
+# include <popcntintrin.h>
+
+static inline unsigned int
+pop (unsigned int x)
+{
+ return _mm_popcnt_u32 (x);
+}
+# define ARCH_POP 1
+
+#endif
+
+#include <intl/l10nflist.c>