Use SSE2 optimized strcmp in x86-64 ld.so

Since ld.so preserves vector registers now, we can use the same SSE2
optimized strcmp in x86-64 libc and ld.so.

	* sysdeps/x86_64/strcmp.S: Remove "#if !IS_IN (libc)".
This commit is contained in:
H.J. Lu 2015-08-25 12:37:45 -07:00
parent ffee504f79
commit d8725b1fba
2 changed files with 220 additions and 253 deletions

View File

@ -1,3 +1,7 @@
2015-08-25 H.J. Lu <hongjiu.lu@intel.com>
* sysdeps/x86_64/strcmp.S: Remove "#if !IS_IN (libc)".
2015-08-25 H.J. Lu <hongjiu.lu@intel.com> 2015-08-25 H.J. Lu <hongjiu.lu@intel.com>
[BZ #11214] [BZ #11214]

View File

@ -29,13 +29,6 @@
#endif #endif
#ifdef USE_AS_STRNCMP #ifdef USE_AS_STRNCMP
/* The simplified code below is not set up to handle strncmp() so far.
Should this become necessary it has to be implemented. For now
just report the problem. */
# if !IS_IN (libc)
# error "strncmp not implemented so far"
# endif
/* Since the counter, %r11, is unsigned, we branch to strcmp_exitz /* Since the counter, %r11, is unsigned, we branch to strcmp_exitz
if the new counter > the old one or is 0. */ if the new counter > the old one or is 0. */
# define UPDATE_STRNCMP_COUNTER \ # define UPDATE_STRNCMP_COUNTER \
@ -50,20 +43,10 @@
#elif defined USE_AS_STRCASECMP_L #elif defined USE_AS_STRCASECMP_L
# include "locale-defines.h" # include "locale-defines.h"
/* No support for strcasecmp outside libc so far since it is not needed. */
# if !IS_IN (libc)
# error "strcasecmp_l not implemented so far"
# endif
# define UPDATE_STRNCMP_COUNTER # define UPDATE_STRNCMP_COUNTER
#elif defined USE_AS_STRNCASECMP_L #elif defined USE_AS_STRNCASECMP_L
# include "locale-defines.h" # include "locale-defines.h"
/* No support for strncasecmp outside libc so far since it is not needed. */
# if !IS_IN (libc)
# error "strncasecmp_l not implemented so far"
# endif
# define UPDATE_STRNCMP_COUNTER \ # define UPDATE_STRNCMP_COUNTER \
/* calculate left number to compare */ \ /* calculate left number to compare */ \
lea -16(%rcx, %r11), %r9; \ lea -16(%rcx, %r11), %r9; \
@ -126,25 +109,6 @@ libc_hidden_def (__strncasecmp)
#endif #endif
ENTRY (STRCMP) ENTRY (STRCMP)
#if !IS_IN (libc)
/* Simple version since we can't use SSE registers in ld.so. */
L(oop): movb (%rdi), %al
cmpb (%rsi), %al
jne L(neq)
incq %rdi
incq %rsi
testb %al, %al
jnz L(oop)
xorl %eax, %eax
ret
L(neq): movl $1, %eax
movl $-1, %ecx
cmovbl %ecx, %eax
ret
END (STRCMP)
#else /* !IS_IN (libc) */
#ifdef USE_AS_STRCASECMP_L #ifdef USE_AS_STRCASECMP_L
/* We have to fall back on the C implementation for locales /* We have to fall back on the C implementation for locales
with encodings not matching ASCII for single bytes. */ with encodings not matching ASCII for single bytes. */
@ -2300,5 +2264,4 @@ LABEL(unaligned_table):
.int LABEL(ashr_14) - LABEL(unaligned_table) .int LABEL(ashr_14) - LABEL(unaligned_table)
.int LABEL(ashr_15) - LABEL(unaligned_table) .int LABEL(ashr_15) - LABEL(unaligned_table)
.int LABEL(ashr_0) - LABEL(unaligned_table) .int LABEL(ashr_0) - LABEL(unaligned_table)
#endif /* !IS_IN (libc) */
libc_hidden_builtin_def (STRCMP) libc_hidden_builtin_def (STRCMP)