Add x86-32 optimized wcscmp

This commit is contained in:
Ulrich Drepper 2011-09-05 13:53:27 -04:00
parent 109715ee22
commit 1b48c53782
7 changed files with 1090 additions and 4 deletions

View File

@ -1,3 +1,12 @@
2011-08-29 Liubov Dmitrieva <liubov.dmitrieva@gmail.com>
* sysdeps/i386/i686/multiarch/Makefile: (sysdep_routines): Add
wcscmp-c wcscmp-sse2
* sysdeps/i386/i686/multiarch/wcscmp-c.c: New file.
* sysdeps/i386/i686/multiarch/wcscmp.S: New file.
* sysdeps/i386/i686/multiarch/wcscmp-sse2.S: New file.
* wcsmbs/wcscmp.c: Allow renaming.
2011-09-05 David S. Miller <davem@davemloft.net>
* sysdeps/sparc/sparc32/fpu/s_fabsf.S: Use first argument

2
NEWS
View File

@ -25,7 +25,7 @@ Version 2.15
* Improved strcpy, strncpy, stpcpy, stpncpy for SSE2 and SSSE3 on x86-64.
Contributed by HJ Lu.
* Optimized strcat and strncat on x86-64.
* Optimized strcat and strncat on x86-64 and optimized wcscmp on x86-32.
Contributed by Liubov Dmitrieva.
* New interfaces: scandirat, scandirat64

View File

@ -13,7 +13,8 @@ sysdep_routines += bzero-sse2 memset-sse2 memcpy-ssse3 mempcpy-ssse3 \
strlen-sse2 strlen-sse2-bsf strncpy-c strcpy-ssse3 \
strncpy-ssse3 stpcpy-ssse3 stpncpy-ssse3 strcpy-sse2 \
strncpy-sse2 stpcpy-sse2 stpncpy-sse2 strcat-ssse3 \
strcat-sse2 strncat-ssse3 strncat-sse2 strncat-c
strcat-sse2 strncat-ssse3 strncat-sse2 strncat-c \
wcscmp-sse2 wcscmp-c
ifeq (yes,$(config-cflags-sse4))
sysdep_routines += strcspn-c strpbrk-c strspn-c strstr-c strcasestr-c
CFLAGS-varshift.c += -msse4

View File

@ -0,0 +1,11 @@
#ifndef NOT_IN_libc
# define WCSCMP __wcscmp_ia32
# undef libc_hidden_def
# define libc_hidden_def(name) \
__hidden_ver1 (__wcscmp_ia32, __GI_wcscmp, __wcscmp_ia32);
#endif
#include "wcsmbs/wcscmp.c"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,58 @@
/* Multiple versions of wcscmp
Copyright (C) 2011 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <sysdep.h>
#include <init-arch.h>
/* Define multiple versions only for the definition in libc and for the
DSO. In static binaries, we need wcscmp before the initialization
happened. */
#ifndef NOT_IN_libc
.section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits
.globl __i686.get_pc_thunk.bx
.hidden __i686.get_pc_thunk.bx
.p2align 4
.type __i686.get_pc_thunk.bx,@function
__i686.get_pc_thunk.bx:
movl (%esp), %ebx
ret
.text
ENTRY(wcscmp)
.type wcscmp, @gnu_indirect_function
pushl %ebx
cfi_adjust_cfa_offset (4)
cfi_rel_offset (ebx, 0)
call __i686.get_pc_thunk.bx
addl $_GLOBAL_OFFSET_TABLE_, %ebx
cmpl $0, KIND_OFFSET+__cpu_features@GOTOFF(%ebx)
jne 1f
call __init_cpu_features
1: leal __wcscmp_ia32@GOTOFF(%ebx), %eax
testl $bit_SSE2, CPUID_OFFSET+index_SSE2+__cpu_features@GOTOFF(%ebx)
jz 2f
leal __wcscmp_sse2@GOTOFF(%ebx), %eax
2: popl %ebx
cfi_adjust_cfa_offset (-4);
cfi_restore (ebx)
ret
END(wcscmp)
#endif

View File

@ -19,12 +19,15 @@
#include <wchar.h>
#ifndef WCSCMP
# define WCSCMP wcscmp
#endif
/* Compare 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
wcscmp (s1, s2)
WCSCMP (s1, s2)
const wchar_t *s1;
const wchar_t *s2;
{
@ -41,4 +44,4 @@ wcscmp (s1, s2)
return c1 - c2;
}
libc_hidden_def (wcscmp)
libc_hidden_def (WCSCMP)