Patchwork [11/20] libcpu-rt-c/x86-64: Add strchr

login
register
mail settings
Submitter H.J. Lu
Date June 12, 2018, 10:19 p.m.
Message ID <20180612221939.19545-12-hjl.tools@gmail.com>
Download mbox | patch
Permalink /patch/27768/
State New
Headers show

Comments

H.J. Lu - June 12, 2018, 10:19 p.m.
* sysdeps/x86_64/Makefile (cpu-rt-c-routines): Add strchr.
	* sysdeps/x86_64/multiarch/Makefile
	(libcpu-rt-c-sysdep_routines): Add strchr-sse2-no-bsf,
	strchr-sse2 and strchr-avx2.
	* sysdeps/x86_64/multiarch/strchr-avx2.S: Support libcpu-rt-c.
	* sysdeps/x86_64/multiarch/strchr-sse2-no-bsf.S: Likewise.
	* sysdeps/x86_64/multiarch/strchr-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/strchr.c: Likewise.
---
 sysdeps/x86_64/Makefile                       | 2 +-
 sysdeps/x86_64/multiarch/Makefile             | 4 +++-
 sysdeps/x86_64/multiarch/strchr-avx2.S        | 2 +-
 sysdeps/x86_64/multiarch/strchr-sse2-no-bsf.S | 2 +-
 sysdeps/x86_64/multiarch/strchr-sse2.S        | 2 +-
 sysdeps/x86_64/multiarch/strchr.c             | 4 ++--
 6 files changed, 9 insertions(+), 7 deletions(-)

Patch

diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile
index d5e4912074..6c8adb898a 100644
--- a/sysdeps/x86_64/Makefile
+++ b/sysdeps/x86_64/Makefile
@@ -148,7 +148,7 @@  endif
 
 ifeq ($(subdir),cpu-rt-c)
 cpu-rt-c-routines += memchr memcmp memcpy memmove mempcpy memrchr \
-		     memset \
+		     memset strchr \
 		     wmemset
 
 # For the CPU run-time tests.
diff --git a/sysdeps/x86_64/multiarch/Makefile b/sysdeps/x86_64/multiarch/Makefile
index 9262251b2c..b06c1555df 100644
--- a/sysdeps/x86_64/multiarch/Makefile
+++ b/sysdeps/x86_64/multiarch/Makefile
@@ -80,5 +80,7 @@  libcpu-rt-c-sysdep_routines += memchr-sse2 memchr-avx2 \
 			       memset-sse2-unaligned-erms \
 			       memset-avx2-unaligned-erms \
 			       memset-avx512-unaligned-erms \
-			       memset-avx512-no-vzeroupper
+			       memset-avx512-no-vzeroupper \
+			       strchr-sse2-no-bsf strchr-sse2 \
+			       strchr-avx2
 endif
diff --git a/sysdeps/x86_64/multiarch/strchr-avx2.S b/sysdeps/x86_64/multiarch/strchr-avx2.S
index 47bc3c9949..fd5bd1a64a 100644
--- a/sysdeps/x86_64/multiarch/strchr-avx2.S
+++ b/sysdeps/x86_64/multiarch/strchr-avx2.S
@@ -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>
 
diff --git a/sysdeps/x86_64/multiarch/strchr-sse2-no-bsf.S b/sysdeps/x86_64/multiarch/strchr-sse2-no-bsf.S
index 93fb661da2..42be1a6c79 100644
--- a/sysdeps/x86_64/multiarch/strchr-sse2-no-bsf.S
+++ b/sysdeps/x86_64/multiarch/strchr-sse2-no-bsf.S
@@ -17,7 +17,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>
 # include "asm-syntax.h"
diff --git a/sysdeps/x86_64/multiarch/strchr-sse2.S b/sysdeps/x86_64/multiarch/strchr-sse2.S
index 8a6e77195c..ac1f7fc494 100644
--- a/sysdeps/x86_64/multiarch/strchr-sse2.S
+++ b/sysdeps/x86_64/multiarch/strchr-sse2.S
@@ -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 strchr __strchr_sse2
 
 # undef weak_alias
diff --git a/sysdeps/x86_64/multiarch/strchr.c b/sysdeps/x86_64/multiarch/strchr.c
index 76d64fb378..ac748dc749 100644
--- a/sysdeps/x86_64/multiarch/strchr.c
+++ b/sysdeps/x86_64/multiarch/strchr.c
@@ -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 strchr __redirect_strchr
 # include <string.h>
 # undef strchr
@@ -48,7 +48,7 @@  IFUNC_SELECTOR (void)
 
 libc_ifunc_redirected (__redirect_strchr, strchr, IFUNC_SELECTOR ());
 weak_alias (strchr, index)
-# ifdef SHARED
+# if defined SHARED && !IS_IN (libcpu_rt_c)
 __hidden_ver1 (strchr, __GI_strchr, __redirect_strchr)
   __attribute__((visibility ("hidden")));
 # endif