about summary refs log tree commit diff
path: root/sysdeps/x86_64/multiarch/ifunc-sse4_1.h
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-06-06 05:31:48 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-06-06 05:31:48 -0700
commitb5b8fce19221891afba4907e9dd7e05b9e797f53 (patch)
treeda425b0c569152e9cfbfb6553e78e0c0b44cc2a2 /sysdeps/x86_64/multiarch/ifunc-sse4_1.h
parent4bf7abaeb3b50483aa91cc7ad2e16f979bfb6176 (diff)
downloadglibc-hjl/avx2/fix.tar.gz
glibc-hjl/avx2/fix.tar.xz
glibc-hjl/avx2/fix.zip
x86-64: Move wcsnlen.S to multiarch/wcsnlen-sse4_1.S hjl/avx2/fix
Since wcsnlen.S uses pminud which is the part of SSE4.1, move wcsnlen.S
to multiarch/wcsnlen-sse4_1.S.

	* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
	wcsnlen-sse4_1 and wcsnlen-c.
	* sysdeps/x86_64/multiarch/ifunc-impl-list.c
	(__libc_ifunc_impl_list): Test __wcsnlen_sse4_1 and
	__wcsnlen_sse2.
	* sysdeps/x86_64/multiarch/ifunc-sse4_1.h: New file.
	* sysdeps/x86_64/multiarch/wcsnlen-c.c: Likewise.
	* sysdeps/x86_64/multiarch/wcsnlen-sse4_1.S: Likewise.
	* sysdeps/x86_64/multiarch/wcsnlen.c: Likewise.
	* sysdeps/x86_64/wcsnlen.S: Removed.
Diffstat (limited to 'sysdeps/x86_64/multiarch/ifunc-sse4_1.h')
-rw-r--r--sysdeps/x86_64/multiarch/ifunc-sse4_1.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/sysdeps/x86_64/multiarch/ifunc-sse4_1.h b/sysdeps/x86_64/multiarch/ifunc-sse4_1.h
new file mode 100644
index 0000000000..2b89231d63
--- /dev/null
+++ b/sysdeps/x86_64/multiarch/ifunc-sse4_1.h
@@ -0,0 +1,34 @@
+/* Common definition for ifunc selections optimized with SSE2 and SSE4.1.
+   All versions must be listed in ifunc-impl-list.c.
+   Copyright (C) 2017 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 <init-arch.h>
+
+extern __typeof (REDIRECT_NAME) OPTIMIZE (sse2) attribute_hidden;
+extern __typeof (REDIRECT_NAME) OPTIMIZE (sse4_1) attribute_hidden;
+
+static inline void *
+IFUNC_SELECTOR (void)
+{
+  const struct cpu_features* cpu_features = __get_cpu_features ();
+
+  if (CPU_FEATURES_CPU_P (cpu_features, SSE4_1))
+    return OPTIMIZE (sse4_1);
+
+  return OPTIMIZE (sse2);
+}