[07/20] libcpu-rt-c/x86-64: Add memrchr
Commit Message
* sysdeps/x86_64/Makefile (cpu-rt-c-routines): Add memrchr.
* sysdeps/x86_64/memrchr.S: Support libcpu-rt-c.
* sysdeps/x86_64/multiarch/memrchr-avx2.S: Likewise.
* sysdeps/x86_64/multiarch/memrchr-sse2.S: Likewise.
* sysdeps/x86_64/multiarch/memrchr.c: Likewise.
* sysdeps/x86_64/multiarch/Makefile
(libcpu-rt-c-sysdep_routines): Add memrchr-sse2 and
memrchr-avx2.
---
sysdeps/x86_64/Makefile | 2 +-
sysdeps/x86_64/memrchr.S | 6 ++++++
sysdeps/x86_64/multiarch/Makefile | 3 ++-
sysdeps/x86_64/multiarch/memrchr-avx2.S | 2 +-
sysdeps/x86_64/multiarch/memrchr-sse2.S | 2 +-
sysdeps/x86_64/multiarch/memrchr.c | 8 +++++++-
6 files changed, 18 insertions(+), 5 deletions(-)
@@ -147,7 +147,7 @@ endif
endif
ifeq ($(subdir),cpu-rt-c)
-cpu-rt-c-routines += memchr memcmp memcpy memmove mempcpy
+cpu-rt-c-routines += memchr memcmp memcpy memmove mempcpy memrchr
# For the CPU run-time tests.
vpath %.c $(..)string
@@ -20,6 +20,10 @@
#include <sysdep.h>
+#if !defined __memrchr && IS_IN (libcpu_rt_c)
+# define __memrchr memrchr
+#endif
+
.text
ENTRY (__memrchr)
movd %esi, %xmm1
@@ -377,4 +381,6 @@ L(length_less16_part2_return):
ret
END (__memrchr)
+#if !IS_IN (libcpu_rt_c)
weak_alias (__memrchr, memrchr)
+#endif
@@ -75,5 +75,6 @@ libcpu-rt-c-sysdep_routines += memchr-sse2 memchr-avx2 \
memmove-ssse3 memmove-ssse3-back \
memmove-avx-unaligned-erms \
memmove-avx512-unaligned-erms \
- memmove-avx512-no-vzeroupper
+ memmove-avx512-no-vzeroupper \
+ memrchr-sse2 memrchr-avx2
endif
@@ -16,7 +16,7 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#if IS_IN (libc)
+#if IS_IN (libc) || IS_IN (libcpu_rt_c)
# include <sysdep.h>
@@ -16,7 +16,7 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#if IS_IN (libc)
+#if IS_IN (libc) || IS_IN (libcpu_rt_c)
# define __memrchr __memrchr_sse2
# undef weak_alias
@@ -18,7 +18,7 @@
<http://www.gnu.org/licenses/>. */
/* Define multiple versions only for the definition in libc. */
-#if IS_IN (libc)
+#if IS_IN (libc) || IS_IN (libcpu_rt_c)
# define memrchr __redirect_memrchr
# include <string.h>
# undef memrchr
@@ -26,6 +26,12 @@
# define SYMBOL_NAME memrchr
# include "ifunc-avx2.h"
+# if IS_IN (libcpu_rt_c)
+# define __memrchr memrchr
+# endif
+
libc_ifunc_redirected (__redirect_memrchr, __memrchr, IFUNC_SELECTOR ());
+# if !IS_IN (libcpu_rt_c)
weak_alias (__memrchr, memrchr)
+# endif
#endif