1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

Add SSE4.2 support for strcmp and strncmp on x86-64.

This commit is contained in:
H.J. Lu
2009-06-22 20:38:41 -07:00
committed by Ulrich Drepper
parent 9618c7c20e
commit 772f4e6a1b
7 changed files with 1714 additions and 5 deletions

View File

@ -1,3 +1,15 @@
2009-06-22 H.J. Lu <hongjiu.lu@intel.com>
* string/strncmp.c (STRNCMP): New. Defined to strncmp if not
defined.
(strncmp): Renamed to STRNCMP.
* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
strncmp-c for string.
* sysdeps/x86_64/multiarch/init-arch.h (HAS_SSE4_2): Define.
* sysdeps/x86_64/multiarch/strcmp.S: New file.
* sysdeps/x86_64/multiarch/strncmp.S: New file.
* sysdeps/x86_64/multiarch/strncmp-c.c: New file.
2009-06-19 H.J. Lu <hongjiu.lu@intel.com> 2009-06-19 H.J. Lu <hongjiu.lu@intel.com>
* elf/Makefile (distribute): Add ifuncmain1staticpie.c, * elf/Makefile (distribute): Add ifuncmain1staticpie.c,

View File

@ -21,15 +21,16 @@
#undef strncmp #undef strncmp
#ifndef STRNCMP
#define STRNCMP strncmp
#endif
/* Compare no more than N characters of S1 and S2, /* Compare no more than N characters of S1 and S2,
returning less than, equal to or greater than zero returning less than, equal to or greater than zero
if S1 is lexicographically less than, equal to or if S1 is lexicographically less than, equal to or
greater than S2. */ greater than S2. */
int int
strncmp (s1, s2, n) STRNCMP (const char *s1, const char *s2, size_t n)
const char *s1;
const char *s2;
size_t n;
{ {
unsigned reg_char c1 = '\0'; unsigned reg_char c1 = '\0';
unsigned reg_char c2 = '\0'; unsigned reg_char c2 = '\0';
@ -70,4 +71,5 @@ strncmp (s1, s2, n)
return c1 - c2; return c1 - c2;
} }
libc_hidden_builtin_def (strncmp)
libc_hidden_builtin_def (STRNCMP)

View File

@ -2,3 +2,7 @@ ifeq ($(subdir),csu)
aux += init-arch aux += init-arch
gen-as-const-headers += ifunc-defines.sym gen-as-const-headers += ifunc-defines.sym
endif endif
ifeq ($(subdir),string)
sysdep_routines += strncmp-c
endif

View File

@ -56,3 +56,6 @@ extern void __init_cpu_features (void) attribute_hidden;
#define HAS_POPCOUNT \ #define HAS_POPCOUNT \
((__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx & (1 << 23)) != 0) ((__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx & (1 << 23)) != 0)
#define HAS_SSE4_2 \
((__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx & (1 << 20)) != 0)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
#ifdef SHARED
#define STRNCMP __strncmp_sse2
#undef libc_hidden_builtin_def
#define libc_hidden_builtin_def(name) \
__hidden_ver1 (__strncmp_sse2, __GI_strncmp, __strncmp_sse2);
#endif
#include "strncmp.c"

View File

@ -0,0 +1,3 @@
#define STRCMP strncmp
#define USE_AS_STRNCMP
#include "strcmp.S"