Patchwork [12/20] libcpu-rt-c/x86-64: Add strcmp

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

Comments

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

Patch

diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile
index 6c8adb898a..dbd2d5e6df 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 strchr \
+		     memset strchr strcmp \
 		     wmemset
 
 # For the CPU run-time tests.
diff --git a/sysdeps/x86_64/multiarch/Makefile b/sysdeps/x86_64/multiarch/Makefile
index b06c1555df..c1cf7d89fa 100644
--- a/sysdeps/x86_64/multiarch/Makefile
+++ b/sysdeps/x86_64/multiarch/Makefile
@@ -82,5 +82,7 @@  libcpu-rt-c-sysdep_routines += memchr-sse2 memchr-avx2 \
 			       memset-avx512-unaligned-erms \
 			       memset-avx512-no-vzeroupper \
 			       strchr-sse2-no-bsf strchr-sse2 \
-			       strchr-avx2
+			       strchr-avx2 strcmp-sse2 \
+			       strcmp-sse2-unaligned strcmp-ssse3 \
+			       strcmp-sse4_2 strcmp-avx2
 endif
diff --git a/sysdeps/x86_64/multiarch/strcmp-avx2.S b/sysdeps/x86_64/multiarch/strcmp-avx2.S
index e8397f3b05..29ccda4502 100644
--- a/sysdeps/x86_64/multiarch/strcmp-avx2.S
+++ b/sysdeps/x86_64/multiarch/strcmp-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/strcmp-sse2-unaligned.S b/sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S
index a9b6267d15..acf8e0caf9 100644
--- a/sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S
+++ b/sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.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/strcmp-sse2.S b/sysdeps/x86_64/multiarch/strcmp-sse2.S
index d173ded8c0..f1a62b207f 100644
--- a/sysdeps/x86_64/multiarch/strcmp-sse2.S
+++ b/sysdeps/x86_64/multiarch/strcmp-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)
 # include <sysdep.h>
 
 # define STRCMP __strcmp_sse2
diff --git a/sysdeps/x86_64/multiarch/strcmp-ssse3.S b/sysdeps/x86_64/multiarch/strcmp-ssse3.S
index 1b7fa33c91..1d697a4bd4 100644
--- a/sysdeps/x86_64/multiarch/strcmp-ssse3.S
+++ b/sysdeps/x86_64/multiarch/strcmp-ssse3.S
@@ -1,4 +1,4 @@ 
-#if IS_IN (libc)
+#if IS_IN (libc) || IS_IN (libcpu_rt_c)
 # define USE_SSSE3 1
 # define STRCMP __strcmp_ssse3
 # include "../strcmp.S"
diff --git a/sysdeps/x86_64/multiarch/strcmp.c b/sysdeps/x86_64/multiarch/strcmp.c
index b903e418df..13370d2ca0 100644
--- a/sysdeps/x86_64/multiarch/strcmp.c
+++ b/sysdeps/x86_64/multiarch/strcmp.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 strcmp __redirect_strcmp
 # include <string.h>
 # undef strcmp
@@ -52,7 +52,7 @@  IFUNC_SELECTOR (void)
 
 libc_ifunc_redirected (__redirect_strcmp, strcmp, IFUNC_SELECTOR ());
 
-# ifdef SHARED
+# if defined SHARED && !IS_IN (libcpu_rt_c)
 __hidden_ver1 (strcmp, __GI_strcmp, __redirect_strcmp)
   __attribute__ ((visibility ("hidden")));
 # endif