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>
* elf/Makefile (distribute): Add ifuncmain1staticpie.c,

View file

@ -21,15 +21,16 @@
#undef strncmp
#ifndef STRNCMP
#define STRNCMP strncmp
#endif
/* Compare no more than N characters of S1 and S2,
returning less than, equal to or greater than zero
if S1 is lexicographically less than, equal to or
greater than S2. */
int
strncmp (s1, s2, n)
const char *s1;
const char *s2;
size_t n;
STRNCMP (const char *s1, const char *s2, size_t n)
{
unsigned reg_char c1 = '\0';
unsigned reg_char c2 = '\0';
@ -70,4 +71,5 @@ strncmp (s1, s2, n)
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
gen-as-const-headers += ifunc-defines.sym
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 \
((__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"