about summary refs log tree commit diff
path: root/string
Commit message (Collapse)AuthorAgeFilesLines
* S390: Optimize wmemset.Stefan Liebler2015-08-261-32/+58
| | | | | | | | | | | | | | | | | | | | | | This patch provides optimized version of wmemset with the z13 vector instructions. ChangeLog: * sysdeps/s390/multiarch/wmemset-c.c: New File. * sysdeps/s390/multiarch/wmemset-vx.S: Likewise. * sysdeps/s390/multiarch/wmemset.c: Likewise. * sysdeps/s390/multiarch/Makefile (sysdep_routines): Add wmemset functions. * sysdeps/s390/multiarch/ifunc-impl-list-common.c (__libc_ifunc_impl_list_common): Add ifunc test for wmemset. * wcsmbs/wmemset.c: Use WMEMSET if defined. * string/test-memset.c: Add wmemset support. * wcsmbs/test-wmemset.c: New File. * wcsmbs/Makefile (strop-tests): Add wmemset. * benchtests/bench-memset.c: Add wmemset support. * benchtests/bench-wmemset.c: New File. * benchtests/Makefile (wcsmbs-bench): Add wmemset.
* S390: Optimize memccpy.Stefan Liebler2015-08-261-0/+4
| | | | | | | | | | | | | | | | This patch provides optimized versions of memccpy with the z13 vector instructions. ChangeLog: * sysdeps/s390/multiarch/memccpy-c.c: New File. * sysdeps/s390/multiarch/memccpy-vx.S: Likewise. * sysdeps/s390/multiarch/memccpy.c: Likewise. * sysdeps/s390/multiarch/Makefile (sysdep_routines): Add memccpy functions. * sysdeps/s390/multiarch/ifunc-impl-list-common.c (__libc_ifunc_impl_list_common): Add ifunc test for memccpy. * string/memccpy.c: Use MEMCCPY if defined.
* S390: Optimize memchr, rawmemchr and wmemchr.Stefan Liebler2015-08-261-34/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch provides optimized versions of memchr, rawmemchr and wmemchr with the z13 vector instructions. ChangeLog: * sysdeps/s390/multiarch/memchr-vx.S: New File. * sysdeps/s390/multiarch/memchr.c: Likewise. * sysdeps/s390/multiarch/rawmemchr-c.c: Likewise. * sysdeps/s390/multiarch/rawmemchr-vx.S: Likewise. * sysdeps/s390/multiarch/rawmemchr.c: Likewise. * sysdeps/s390/multiarch/wmemchr-c.c: Likewise. * sysdeps/s390/multiarch/wmemchr-vx.S: Likewise. * sysdeps/s390/multiarch/wmemchr.c: Likewise. * sysdeps/s390/s390-32/multiarch/memchr.c: Likewise. * sysdeps/s390/s390-64/multiarch/memchr.c: Likewise. * sysdeps/s390/multiarch/Makefile (sysdep_routines): Add memchr, wmemchr and rawmemchr functions. * sysdeps/s390/multiarch/ifunc-impl-list-common.c (__libc_ifunc_impl_list_common): Add ifunc test for memchr, rawmemchr and wmemchr. * wcsmbs/wmemchr.c: Use WMEMCHR if defined. * string/test-memchr.c: Add wmemchr support. * wcsmbs/test-wmemchr.c: New File. * wcsmbs/Makefile (strop-tests): Add wmemchr. * benchtests/bench-memchr.c: Add wmemchr support. * benchtests/bench-wmemchr.c: New File. * benchtests/Makefile (wcsmbs-bench): wmemchr.
* S390: Optimize strcspn and wcscspn.Stefan Liebler2015-08-261-13/+34
| | | | | | | | | | | | | | | | | | | | | | | | | This patch provides optimized versions of strcspn and wcscspn with the z13 vector instructions. ChangeLog: * sysdeps/s390/multiarch/strcspn-c.c: New File. * sysdeps/s390/multiarch/strcspn-vx.S: Likewise. * sysdeps/s390/multiarch/strcspn.c: Likewise. * sysdeps/s390/multiarch/wcscspn-c.c: Likewise. * sysdeps/s390/multiarch/wcscspn-vx.S: Likewise. * sysdeps/s390/multiarch/wcscspn.c: Likewise. * sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strcspn and wcscspn functions. * sysdeps/s390/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list): Add ifunc test for strcspn, wcscspn. * wcsmbs/wcscspn.c: Use WCSCSPN if defined. * string/test-strcspn.c: Add wcscspn support. * wcsmbs/test-wcscspn.c: New File. * wcsmbs/Makefile (strop-tests): Add wcscspn. * benchtests/bench-strcspn.c: Add wcscspn support. * benchtests/bench-wcscspn.c: New File. * benchtests/Makefile (wcsmbs-bench): Add wcscspn.
* S390: Optimize strpbrk and wcspbrk.Stefan Liebler2015-08-261-49/+81
| | | | | | | | | | | | | | | | | | | | | | | | | This patch provides optimized versions of strpbrk and wcspbrk with the z13 vector instructions. ChangeLog: * sysdeps/s390/multiarch/strpbrk-c.c: New File. * sysdeps/s390/multiarch/strpbrk-vx.S: Likewise. * sysdeps/s390/multiarch/strpbrk.c: Likewise. * sysdeps/s390/multiarch/wcspbrk-c.c: Likewise. * sysdeps/s390/multiarch/wcspbrk-vx.S: Likewise. * sysdeps/s390/multiarch/wcspbrk.c: Likewise. * sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strpbrk and wcspbrk functions. * sysdeps/s390/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list): Add ifunc test for strpbrk, wcspbrk. * wcsmbs/wcspbrk.c: Use WCSPBRK if defined. * string/test-strpbrk.c: Add wcspbrk support. * wcsmbs/test-wcspbrk.c: New File. * wcsmbs/Makefile (strop-tests): Add wcspbrk. * benchtests/bench-strpbrk.c: Add wcspbrk support. * benchtests/bench-wcspbrk.c: New File. * benchtests/Makefile (wcsmbs-bench): Add wcspbrk.
* S390: Optimize strspn and wcsspn.Stefan Liebler2015-08-261-36/+63
| | | | | | | | | | | | | | | | | | | | | | | | | This patch provides optimized versions of strspn and wcsspn with the z13 vector instructions. ChangeLog: * sysdeps/s390/multiarch/strspn-c.c: New File. * sysdeps/s390/multiarch/strspn-vx.S: Likewise. * sysdeps/s390/multiarch/strspn.c: Likewise. * sysdeps/s390/multiarch/wcsspn-c.c: Likewise. * sysdeps/s390/multiarch/wcsspn-vx.S: Likewise. * sysdeps/s390/multiarch/wcsspn.c: Likewise. * wcsmbs/wcsspn.c: Use WCSSPN if defined. * sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strspn and wcsspn functions. * sysdeps/s390/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list): Add ifunc test for strspn, wcsspn. * string/test-strspn.c: Add wcsspn support. * wcsmbs/test-wcsspn.c: New File. * wcsmbs/Makefile (strop-tests): Add wcsspn. * benchtests/bench-strspn.c: Add wcsspn support. * benchtests/bench-wcsspn.c: New File. * benchtests/Makefile (wcsmbs-bench): Add wcsspn.
* S390: Optimize strchrnul and wcschrnul.Stefan Liebler2015-08-261-8/+18
| | | | | | | | | | | | | | | | | | | | | | | | | This patch provides optimized versions of strchrnul and wcschrnul with the z13 vector instructions. ChangeLog: * sysdeps/s390/multiarch/strchrnul-c.c: New File. * sysdeps/s390/multiarch/strchrnul-vx.S: Likewise. * sysdeps/s390/multiarch/strchrnul.c: Likewise. * sysdeps/s390/multiarch/wcschrnul-c.c: Likewise. * sysdeps/s390/multiarch/wcschrnul-vx.S: Likewise. * sysdeps/s390/multiarch/wcschrnul.c: Likewise. * sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strchrnul and wcschrnul functions. * sysdeps/s390/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list): Add ifunc test for strchrnul, wcschrnul. * wcsmbs/wcschrnul.c: Use WCSCHRNUL if defined. * string/test-strchr.c: Add wcschrnul support. * wcsmbs/test-wcschrnul.c: New File. * wcsmbs/Makefile (strop-tests): Add wcschrnul. * benchtests/bench-strchr.c: Add wcschrnul support. * benchtests/bench-wcschrnul.c: New File. * benchtests/Makefile (wcsmbs-bench): Add wcschrnul.
* S390: Optimize strchr and wcschr.Stefan Liebler2015-08-261-2/+6
| | | | | | | | | | | | | | | | | | | | | This patch provides optimized versions of strchr and wcschr with the z13 vector instructions. ChangeLog: * sysdeps/s390/multiarch/strchr-c.c: New File. * sysdeps/s390/multiarch/strchr-vx.S: Likewise. * sysdeps/s390/multiarch/strchr.c: Likewise. * sysdeps/s390/multiarch/wcschr-c.c: Likewise. * sysdeps/s390/multiarch/wcschr-vx.S: Likewise. * sysdeps/s390/multiarch/wcschr.c: Likewise. * sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strchr and wcschr functions. * sysdeps/s390/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list): Add ifunc test for strchr, wcschr. * string/strchr.c (STRCHR): Define and use macro. * benchtests/bench-wcschr.c: New File. * benchtests/Makefile (wcsmbs-bench): Add wcschr.
* S390: Optimize strcmp and wcscmp.Stefan Liebler2015-08-261-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch provides optimized versions of strcmp and wcscmp with the z13 vector instructions. The architecture specific string.h had a typo, which leads to ommiting the inline version in this file if __USE_STRING_INLINES is defined. Tested this inline version by tweaking test-strcmp.c. ChangeLog: * sysdeps/s390/multiarch/strcmp-vx.S: New File. * sysdeps/s390/multiarch/strcmp.c: Likewise. * sysdeps/s390/multiarch/wcscmp-c.c: Likewise. * sysdeps/s390/multiarch/wcscmp-vx.S: Likewise. * sysdeps/s390/multiarch/wcscmp.c: Likewise. * sysdeps/s390/s390-32/multiarch/strcmp.c: Likewise. * sysdeps/s390/s390-64/multiarch/strcmp.c: Likewise. * sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strcmp and wcscmp functions. * sysdeps/s390/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list): Add ifunc test for strcmp, wcscmp. * string/strcmp.c (STRCMP): Define and use macro. * benchtests/bench-wcscmp.c: New File. * benchtests/Makefile (wcsmbs-bench): Add wcscmp. * sysdeps/s390/bits/string.h: Fix typo: _HAVE_STRING_ARCH_strcmp instead of _HAVE_STRING_ARCH_memchr.
* S390: Optimize strncat wcsncat.Stefan Liebler2015-08-261-52/+86
| | | | | | | | | | | | | | | | | | | | | | | | | This patch provides optimized versions of strncat and wcsncat with the z13 vector instructions. ChangeLog: * sysdeps/s390/multiarch/strncat-c.c: New File. * sysdeps/s390/multiarch/strncat-vx.S: Likewise. * sysdeps/s390/multiarch/strncat.c: Likewise. * sysdeps/s390/multiarch/wcsncat-c.c: Likewise. * sysdeps/s390/multiarch/wcsncat-vx.S: Likewise. * sysdeps/s390/multiarch/wcsncat.c: Likewise. * sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strncat and wcsncat functions. * sysdeps/s390/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list): Add ifunc test for strncat, wcsncat. * wcsmbs/wcsncat.c (WCSNCAT): Define and use macro. * string/test-strncat.c: Add wcsncat support. * wcsmbs/test-wcsncat.c: New File. * wcsmbs/Makefile (strop-tests): Add wcsncat. * benchtests/bench-strncat.c: Add wcsncat support. * benchtests/bench-wcsncat.c: New File. * benchtests/Makefile (wcsmbs-bench): Add wcsncat.
* S390: Optimize strcat and wcscat.Stefan Liebler2015-08-262-47/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch provides optimized versions of strcat and wcscat with the z13 vector instructions. ChangeLog: * sysdeps/s390/multiarch/strcat-c.c: New File. * sysdeps/s390/multiarch/strcat-vx.S: Likewise. * sysdeps/s390/multiarch/strcat.c: Likewise. * sysdeps/s390/multiarch/wcscat-c.c: Likewise. * sysdeps/s390/multiarch/wcscat-vx.S: Likewise. * sysdeps/s390/multiarch/wcscat.c: Likewise. * sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strcat and wcscat functions. * sysdeps/s390/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list): Add ifunc test for strcat, wcscat. * string/strcat.c (STRCAT): Define and use macro. * wcsmbs/wcscat.c: Use WCSCAT if defined. * string/test-strcat.c: Add wcscat support. * wcsmbs/test-wcscat.c: New File. * wcsmbs/Makefile (strop-tests): Add wcscat. * benchtests/bench-strcat.c: Add wcscat support. * benchtests/bench-wcscat.c: New File. * benchtests/Makefile (wcsmbs-bench): Add wcscat.
* S390: Optimize stpncpy and wcpncpy.Stefan Liebler2015-08-261-11/+30
| | | | | | | | | | | | | | | | | | | | | | | | | This patch provides optimized versions of stpncpy and wcpncpy with the z13 vector instructions. ChangeLog: * sysdeps/s390/multiarch/stpncpy-c.c: New File. * sysdeps/s390/multiarch/stpncpy-vx.S: Likewise. * sysdeps/s390/multiarch/stpncpy.c: Likewise. * sysdeps/s390/multiarch/wcpncpy-c.c: Likewise. * sysdeps/s390/multiarch/wcpncpy-vx.S: Likewise. * sysdeps/s390/multiarch/wcpncpy.c: Likewise. * sysdeps/s390/multiarch/Makefile (sysdep_routines): Add stpncpy and wcpncpy functions. * sysdeps/s390/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list): Add ifunc test for stpncpy, wcpncpy. * wcsmbs/wcpncpy.c: Use WCPNCPY if defined. * string/test-stpncpy.c: Add wcpncpy support. * wcsmbs/test-wcpncpy.c: New File. * wcsmbs/Makefile (strop-tests): Add wcpncpy. * benchtests/bench-stpncpy.c: Add wcpncpy support. * benchtests/bench-wcpncpy.c: New File. * benchtests/Makefile (wcsmbs-bench): Add wcpncpy.
* S390: Optimize strncpy and wcsncpy.Stefan Liebler2015-08-261-46/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch provides optimized versions of strncpy and wcsncpy with the z13 vector instructions. ChangeLog: * sysdeps/s390/multiarch/strncpy-vx.S: New File. * sysdeps/s390/multiarch/strncpy.c: Likewise. * sysdeps/s390/multiarch/wcsncpy-c.c: Likewise. * sysdeps/s390/multiarch/wcsncpy-vx.S: Likewise. * sysdeps/s390/multiarch/wcsncpy.c: Likewise. * sysdeps/s390/s390-32/multiarch/strncpy.c: Likewise. * sysdeps/s390/s390-64/multiarch/strncpy.c: Likewise. * sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strncpy and wcsncpy functions. * wcsmbs/wcsncpy.c: Use WCSNCPY if defined. * sysdeps/s390/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list): Add ifunc test for strncpy, wcsncpy. * string/test-strncpy.c: Add wcsncpy support. * wcsmbs/test-wcsncpy.c: New File. * wcsmbs/Makefile (strop-tests): Add wcsncpy. * benchtests/bench-strncpy.c: Add wcsncpy support. * benchtests/bench-wcsncpy.c: New File. * benchtests/Makefile (wcsmbs-bench): Add wcsncpy
* S390: Optimize stpcpy and wcpcpy.Stefan Liebler2015-08-261-10/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch provides optimized versions of stpcpy and wcpcpy with the z13 vector instructions. ChangeLog: * sysdeps/s390/multiarch/stpcpy-c.c: New File. * sysdeps/s390/multiarch/stpcpy-vx.S: Likewise. * sysdeps/s390/multiarch/stpcpy.c: Likewise. * sysdeps/s390/multiarch/wcpcpy-c.c: Likewise. * sysdeps/s390/multiarch/wcpcpy-vx.S: Likewise. * sysdeps/s390/multiarch/wcpcpy.c: Likewise. * sysdeps/s390/multiarch/Makefile (sysdep_routines): Add stpcpy and wcpcpy functions. * string/stpcpy.c: Use STPCPY if defined. * wcsmbs/wcpcpy.c: Use WCPCPY if defined. * sysdeps/s390/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list): Add ifunc test for stpcpy, wcpcpy. * string/test-stpcpy.c: Add wcpcpy support. * wcsmbs/test-wcpcpy.c: New File. * wcsmbs/Makefile (strop-tests): Add wcpcpy. * benchtests/bench-stpcpy.c: Add wcpcpy support. * benchtests/bench-wcpcpy.c: New File. * benchtests/Makefile (wcsmbs-bench): Add wcpcpy.
* S390: Optimize strnlen and wcsnlen.Stefan Liebler2015-08-261-33/+54
| | | | | | | | | | | | | | | | | | | | | | | | | This patch provides optimized versions of strnlen and wcsnlen with the z13 vector instructions. ChangeLog: * sysdeps/s390/multiarch/strnlen-c.c: New File. * sysdeps/s390/multiarch/strnlen-vx.S: Likewise. * sysdeps/s390/multiarch/strnlen.c: Likewise. * sysdeps/s390/multiarch/wcsnlen-c.c: Likewise. * sysdeps/s390/multiarch/wcsnlen-vx.S: Likewise. * sysdeps/s390/multiarch/wcsnlen.c: Likewise. * sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strnlen and wcsnlen functions. * sysdeps/s390/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list): Add ifunc test for strnlen, wcsnlen. * wcsmbs/wcsnlen.c: Use WCSNLEN if defined. * string/test-strnlen.c: Add wcsnlen support. * wcsmbs/test-wcsnlen.c: New File. * wcsmbs/Makefile (strop-tests): Add wcsnlen. * benchtests/bench-strnlen.c: Add wcsnlen support. * benchtests/bench-wcsnlen.c: New File. * benchtests/Makefile (wcsmbs-bench): Add wcsnlen.
* S390: Optimize strlen and wcslen.Stefan Liebler2015-08-261-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | This patch provides optimized versions of strlen and wcslen with the z13 vector instructions. The helper macro IFUNC_VX_IMPL is introduced and is used to register all __<func>_c() and __<func>_vx() functions within __libc_ifunc_impl_list() to the ifunc test framework. ChangeLog: * sysdeps/s390/multiarch/Makefile: New File. * sysdeps/s390/multiarch/strlen-c.c: Likewise. * sysdeps/s390/multiarch/strlen-vx.S: Likewise. * sysdeps/s390/multiarch/strlen.c: Likewise. * sysdeps/s390/multiarch/wcslen-c.c: Likewise. * sysdeps/s390/multiarch/wcslen-vx.S: Likewise. * sysdeps/s390/multiarch/wcslen.c: Likewise. * string/strlen.c (STRLEN): Define and use macro. * sysdeps/s390/multiarch/ifunc-impl-list.c (IFUNC_VX_IMPL): New macro function. (__libc_ifunc_impl_list): Add ifunc test for strlen, wcslen. * benchtests/Makefile (wcsmbs-bench): New variable. (string-bench-all): Added wcsmbs-bench. * benchtests/bench-wcslen.c: New File.
* Improve stpncpy performance by using __strnlen/memcpy/memset rather than aWilco Dijkstra2015-08-191-54/+5
| | | | byte loop. Performance on bench-stpncpy is ~2x faster on average.
* Port the 0x7efe...feff pattern to GCC 6.Paul Eggert2015-08-184-32/+8
| | | | | | | | | | See Steve Ellcey's bug report in: https://sourceware.org/ml/libc-alpha/2015-07/msg00673.html * string/memrchr.c (MEMRCHR): * string/rawmemchr.c (RAWMEMCHR): * string/strchr.c (strchr): * string/strchrnul.c (STRCHRNUL): Rewrite code to avoid issues with signed shift overflow.
* stpncpy: fix size checking [BZ #18975]Zack Weinberg2015-08-141-1/+1
| | | | | | | | | | I think the last clause of the conditional, || __n <= __bos (__dest) may be backward. The code should call the runtime-checking function if __n is not constant, or if __n is known to be LARGER than the size of the destination.
* powerpc: Use default strcpy optimization for POWER7Adhemerval Zanella2015-08-112-13/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patches uses the default strcpy/stpcpy implementation for POWER7/PPC64. This is faster in mostly inputs for benchtests and for multiarch the implementation uses the POWER7 strlen and memcpy. * string/stpcpy.c (__stpcpy): Use STPCPY to redefine symbol name and cleanup macro usage. * string/strcpy.c (strcpt): Use STRCPY to redefine symbol name. * sysdeps/powerpc/powerpc64/multiarch/stpcpy-power7.S: Remove file. * sysdeps/powerpc/powerpc64/multiarch/stpcpy-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strcpy-power7.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strcpy-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/power7/stpcpy.S: Likewise. * sysdeps/powerpc/powerpc64/power7/strcpy.S: Likewise. * sysdeps/powerpc/powerpc64/power7/strcpy.c: Likewise. * sysdeps/powerpc/powerpc64/stpcpy.S: Likewise. * sysdeps/powerpc/powerpc64/strcpy.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/stpcpy.c [SHARED && IS_IN (libc)]: Include <string/strcpy.c>. * sysdeps/powerpc/powerpc64/multiarch/stpcpy.c [SHARED && IS_IN (libc)]: Include <string/stpcpy.c>. * sysdeps/powerpc/powerpc64/multiarch/stpcpy-power7.c: New file. * sysdeps/powerpc/powerpc64/multiarch/stpcpy-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strcpy-power7.c: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strcpy-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/power7/strcpy.c: Likewise.
* Modify several tests to use test-skeleton.cArjun Shankar2015-08-062-4/+10
| | | | | | | | | These tests were skipped by the use-test-skeleton conversion done in commit 29955b5d because they did not have an `int main (void)' declaration. Instead their `main' functions were declared with arguments (i.e. argc, argv) even though they didn't use them. Remove these arguments and include the test skeleton in these tests.
* Improve performance of mempcpy by inlining and using memcpy. EnableWilco Dijkstra2015-08-051-0/+19
| | | | | this for all targets except sparc which has an optimized mempcpy implementation.
* Improve memccpy performance by using memchr/memcpy/mempcpy rather thanWilco Dijkstra2015-08-051-7/+4
| | | | | a byte loop. Overall performance on bench-memccpy is > 2x faster when using the C implementation of memchr and an optimized memcpy.
* This patch improves strncpy performance by using strnlen/memcpy rather than ↵Wilco Dijkstra2015-08-051-54/+5
| | | | | | | a byte loop. Performance on bench-strncpy is 1.9-2.1x faster on average. I tried several variations, and using a tailcall and calling memset conditionally gave the best overall results.
* remove unnecessary memset in strcollLeonhard Holz2015-06-221-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch avoids some initialization overhead in the hot path of strcoll by replacing a memset with zero assignments. It improves the file listing benchmark by 15% on x86. Tests are ok. filelist#C -1.30% filelist#en_US.UTF-8 -15.08% lorem_ipsum#vi_VN.UTF-8 -15.04% lorem_ipsum#ar_SA.UTF-8 -11.83% lorem_ipsum#en_US.UTF-8 -9.66% lorem_ipsum#zh_CN.UTF-8 -8.63% lorem_ipsum#cs_CZ.UTF-8 -8.28% lorem_ipsum#en_GB.UTF-8 -18.07% lorem_ipsum#da_DK.UTF-8 -11.13% lorem_ipsum#pl_PL.UTF-8 -15.31% lorem_ipsum#fr_FR.UTF-8 -12.26% lorem_ipsum#pt_PT.UTF-8 -10.64% lorem_ipsum#el_GR.UTF-8 -8.19% lorem_ipsum#ru_RU.UTF-8 -0.65% lorem_ipsum#iw_IL.UTF-8 -14.92% lorem_ipsum#es_ES.UTF-8 -11.47% lorem_ipsum#hi_IN.UTF-8 -1.05% lorem_ipsum#sv_SE.UTF-8 6.44% lorem_ipsum#hu_HU.UTF-8 -9.85% lorem_ipsum#tr_TR.UTF-8 -14.96% lorem_ipsum#is_IS.UTF-8 -10.35% lorem_ipsum#it_IT.UTF-8 -11.33% lorem_ipsum#sr_RS.UTF-8 -9.88% lorem_ipsum#ja_JP.UTF-8 -3.23% * string/strcoll_l.c (STRCOLL): Remove unnecessary memset.
* remove now unused idxnow in strcollLeonhard Holz2015-06-221-1/+0
| | | | | | | The struct element idxnow is not used and can be removed. Tests show no problems. * string/strcoll_l.c: Remove unused struct element idxnow.
* Use libc_hidden_proto / libc_hidden_def with __strnlen.Joseph Myers2015-06-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Various code in glibc uses __strnlen instead of strnlen for namespace reasons. However, __strnlen does not use libc_hidden_proto / libc_hidden_def (as is normally done for any function defined and called within the same library, whether or not exported from the library and whatever namespace it is in), so the compiler does not know that those calls are to a function within libc. This patch uses libc_hidden_proto / libc_hidden_def with __strnlen. On x86_64, it makes no difference to the installed stripped shared libraries. On 32-bit x86, it causes __strnlen calls to go to the same place as strnlen calls (the fallback strnlen implementation), rather than through a PLT entry for the strnlen IFUNC; I'm not sure of the logic behind when calls from within libc should use IFUNCs versus when they should go direct to a particular function implementation, but clearly it doesn't make sense for strnlen and __strnlen to be handled differently in this regard. Tested for x86_64 and x86 (testsuite, and comparison of installed shared libraries as described above). * string/strnlen.c [!STRNLEN] (__strnlen): Use libc_hidden_def. * include/string.h (__strnlen): Use libc_hidden_proto. * sysdeps/aarch64/strnlen.S (__strnlen): Use libc_hidden_def. * sysdeps/i386/i686/multiarch/strnlen-c.c [SHARED] (libc_hidden_def): Define __GI___strnlen as well as __GI_strnlen. * sysdeps/powerpc/powerpc32/power4/multiarch/strnlen-power7.S (libc_hidden_def): Undefine and redefine. * sysdeps/powerpc/powerpc32/power4/multiarch/strnlen-ppc32.c [SHARED] (libc_hidden_def): Define __GI___strnlen as well as __GI_strnlen. * sysdeps/powerpc/powerpc32/power7/strnlen.S (__strnlen): Use libc_hidden_def. * sysdeps/tile/tilegx/strnlen.c (__strnlen): Likewise.
* Fix pathconf basename namespace (bug 18444).Joseph Myers2015-05-221-2/+4
| | | | | | | | | | | | | | | | | | | | | pathconf (sysdeps/unix/sysv/linux/pathconf.c) uses basename. But pathconf is in POSIX back to 1990 while basename is only reserved with external linkage in those standards including XPG functions. This patch fixes this namespace issue in the usual way, renaming basename to __basename and making it into a weak alias. Tested for x86_64 and x86 (testsuite, and that disassembly of installed shared libraries is unchanged by the patch). [BZ #18444] * string/basename.c (basename): Rename to __basename and define as weak alias of __basename. Use libc_hidden_weak. * include/string.h (__basename): Declare. Use libc_hidden_proto. * sysdeps/unix/sysv/linux/pathconf.c (distinguish_extX): Call __basename instead of basename. * conform/Makefile (test-xfail-POSIX2008/unistd.h/linknamespace): Remove variable. (test-xfail-XOPEN2K8/unistd.h/linknamespace): Likewise.
* Improve strcoll with strdiff.Leonhard Holz2015-05-121-1/+37
| | | | | | This patch improves strcoll hot case by finding first byte that mismatches. That is in likely case enough to determine comparison result.
* Use correct signedness in wcsncmpStefan Liebler2015-04-131-49/+129
| | | | | | | | | | | | | | [BZ #18206] * wcsmbs/wcsncmp.c (wcsncmp): Compare as wchar_t, not wint_t. Use signed comparision instead of substraction to avoid overflow bug. * localedata/tests-mbwc/tst_wcsncmp.c (tst_wcsncmp): Take the sign of ret. * localedata/tests-mbwc/dat_wcsncmp.c (tst_wcsncmp_loc): Do not expect precise return values. Only the sign matters. * wcsmbs/Makefile (strop-tests): Add wcsncmp. * wcsmbs/test-wcsncmp.c: New File. * string/test-strncmp.c: Add wcsncmp support.
* Don't define __CORRECT_ISO_CPP_STRING_H_PROTO for non-GCC compilers (bug 17631)Andreas Schwab2015-03-042-12/+4
| | | | | The implementation of __CORRECT_ISO_CPP_STRING_H_PROTO requires support for asm aliases.
* Rather than using a C implementation of memmove, directly call memmove, whichWilco Dijkstra2015-02-271-9/+5
| | | | typically has a much faster optimized implementation.
* Rather than using a C implementation of memset, directly call memset, whichWilco Dijkstra2015-02-271-55/+2
| | | | typically has a much faster optimized implementation.
* Remove unused definitionsLeonhard Holz2015-02-112-2/+0
|
* Fix memory handling in strxfrm_l [BZ #16009]Leonhard Holz2015-01-131-94/+394
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [Modified from the original email by Siddhesh Poyarekar] This patch solves bug #16009 by implementing an additional path in strxfrm that does not depend on caching the weight and rule indices. In detail the following changed: * The old main loop was factored out of strxfrm_l into the function do_xfrm_cached to be able to alternativly use the non-caching version do_xfrm. * strxfrm_l allocates a a fixed size array on the stack. If this is not sufficiant to store the weight and rule indices, the non-caching path is taken. As the cache size is not dependent on the input there can be no problems with integer overflows or stack allocations greater than __MAX_ALLOCA_CUTOFF. Note that malloc-ing is not possible because the definition of strxfrm does not allow an oom errorhandling. * The uncached path determines the weight and rule index for every char and for every pass again. * Passing all the locale data array by array resulted in very long parameter lists, so I introduced a structure that holds them. * Checking for zero src string has been moved a bit upwards, it is before the locale data initialization now. * To verify that the non-caching path works correct I added a test run to localedata/sort-test.sh & localedata/xfrm-test.c where all strings are patched up with spaces so that they are too large for the caching path.
* Revert "Suppress warning in string/tester.c for gcc 4.9"Ondřej Bílka2015-01-061-3/+3
| | | | This reverts commit 9300797ee93422a87f443d5ba7e1411167e7a837.
* Suppress warning in string/tester.c for gcc 4.9Ondřej Bílka2015-01-061-3/+3
|
* Update copyright dates with scripts/update-copyrights.Joseph Myers2015-01-02121-121/+121
|
* * string/stpcpy.c (__stpcpy): Rewrite using strlen and memcpy.Richard Earnshaw2014-12-231-8/+2
|
* Simplify strncat.Ondřej Bílka2014-12-191-44/+3
| | | | | We rewrite strncat to use strnlen and malloc calls which simplifies code an is faster as these functions are better optimized than original code.
* Ignore warning in string/tester.c.Torvald Riegel2014-12-161-0/+8
|
* Don't use __warn_memset_zero_len for gcc-5.0 or newerSiddhesh Poyarekar2014-11-271-0/+6
| | | | | | | | | | | gcc now warns when the arguments to memset may have been accidentally transposed (i.e. length set to zero instead of the byte), so we don't need that bit of the code in glibc headers anymore. Tested on x86_64. Coe generated by gcc 4.8 is identical with or without the patch. I also tested gcc master, which does not result in any new failures. It does fail quite a few FORTIFY_SOURCE tests, but those failures are not due to this patch.
* Remove TEST_IFUNC, tests-ifunc and *-ifunc.c tests.Joseph Myers2014-11-261-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TEST_IFUNC is only tested in two headers, bench-string.h and test-string.h, after it gets defined by those headers, and it never gets undefined. Thus no defines of TEST_IFUNC are needed, and the *-ifunc.c tests that just define TEST_IFUNC and include other tests are also redundant, as is the code to remove $(tests-ifunc) and $(xtests-ifunc) conditionally from tests and xtests. This patch removes the useless defines and tests of TEST_IFUNC and the associated useless tests and makefile code. It thereby fixes a series of warnings "../string/test-string.h:21:0: warning: "TEST_IFUNC" redefined" where test-string.h defines TEST_IFUNC to empty, other files define it to 1 and this produces warnings. Tested for x86_64. * debug/test-stpcpy_chk-ifunc.c: Remove file. * debug/test-strcpy_chk-ifunc.c: Likewise. * wcsmbs/test-wcschr-ifunc.c: Likewise. * wcsmbs/test-wcscmp-ifunc.c: Likewise. * wcsmbs/test-wcscpy-ifunc.c: Likewise. * wcsmbs/test-wcslen-ifunc.c: Likewise. * wcsmbs/test-wcsrchr-ifunc.c: Likewise. * wcsmbs/test-wmemcmp-ifunc.c: Likewise. * Rules [$(multi-arch) = no] (tests): Do not filter out $(tests-ifunc). [$(multi-arch) = no] (xtests): Do not filter out $(xtests-ifunc). * debug/Makefile (tests-ifunc): Remove variable. (tests): Do not add $(tests-ifunc). * wcsmbs/Makefile (tests-ifunc): Remove variable. (tests): Do not add $(tests-ifunc). * benchtests/bench-string.h (TEST_IFUNC): Remove macro. [TEST_IFUNC]: Remove conditionals. * string/test-string.h (TEST_IFUNC): Remove macro. [TEST_IFUNC]: Remove conditionals.
* Fix test-strchr.c warnings for wide string testing.Joseph Myers2014-11-261-3/+5
| | | | | | | | | | | | | | | | string/test-strchr.c is used for both wide and narrow string testing, but produces a series of warnings for wide string testing because of hardcoded use of narrow characters in the function check1. This patch fixes that function to use macros abstracting away the wide / narrow string choice, adding a new such macro to handle the string and character constants. Tested for x86_64. * string/test-strchr.c [!WIDE] (L): New macro. [WIDE] (L): Likewise. (check1): Use CHAR instead of char. Use L on string and character constants.
* Fix typo.Wilco Dijkstra2014-11-241-1/+1
|
* Improve performance of strncpy.Wilco Dijkstra2014-11-241-9/+5
|
* Improve strcpy performance.Wilco Dijkstra2014-11-241-12/+1
|
* Speed up strcoll by inliningLeonhard Holz2014-11-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch improves the performance of strcoll_l by inlining the two helper functions get_next_seq and do_compare. measurement old new diff glibc files 202,393,000 138,597,000 -31.52% vi_VN.UTF-8 2,772,150 2,055,920 -25.84% en_US.UTF-8 2,741,380 1,952,770 -28.77% ar_SA.UTF-8 3,062,180 2,484,940 -18.85% zh_CN.UTF-8 917,198 875,756 -4.52% cs_CZ.UTF-8 3,455,670 2,465,530 -28.65% en_GB.UTF-8 3,334,790 2,420,540 -27.42% da_DK.UTF-8 2,805,660 2,023,430 -27.88% pl_PL.UTF-8 2,640,710 2,014,960 -23.70% fr_FR.UTF-8 3,504,700 2,642,280 -24.61% pt_PT.UTF-8 3,542,390 2,599,250 -26.62% el_GR.UTF-8 4,529,580 3,881,700 -14.30% ru_RU.UTF-8 3,527,070 2,806,480 -20.43% iw_IL.UTF-8 3,047,060 2,530,360 -16.96% es_ES.UTF-8 3,089,990 2,376,410 -23.09% hi_IN.UTF-8 222,487,000 223,397,000 0.41% sv_SE.UTF-8 2,724,630 2,019,420 -25.88% hu_HU.UTF-8 4,446,990 3,658,830 -17.72% tr_TR.UTF-8 2,966,180 2,200,790 -25.80% is_IS.UTF-8 2,559,480 2,012,190 -21.38% it_IT.UTF-8 3,301,190 2,527,230 -23.44% sr_RS.UTF-8 2,973,150 2,322,010 -21.90% ja_JP.UTF-8 985,042 1,044,980 6.08%
* Fix build of C mempcpy and stpcpy.Joseph Myers2014-11-142-0/+2
| | | | | | | | | | | | | | | | | | | | | | This patch fixes the build of C mempcpy and stpcpy by disabling the redirection to __mempcpy and __stpcpy asm names if NO_MEMPCPY_STPCPY_REDIRECT is defined, and defining that macro in the relevant source files. Tested for powerpc32 that the build is fixed. * include/string.h [NO_MEMPCPY_STPCPY_REDIRECT] (mempcpy): Do not redeclare with asm name. [NO_MEMPCPY_STPCPY_REDIRECT] (stpcpy): Likewise. * string/mempcpy.c (NO_MEMPCPY_STPCPY_REDIRECT): Define before including <string.h>. * string/stpcpy.c (NO_MEMPCPY_STPCPY_REDIRECT): Likewise. * sysdeps/powerpc/powerpc32/power4/multiarch/mempcpy.c [!NOT_IN_libc] (NO_MEMPCPY_STPCPY_REDIRECT): Likewise. * sysdeps/powerpc/powerpc64/multiarch/mempcpy.c [!NOT_IN_libc] (NO_MEMPCPY_STPCPY_REDIRECT): Likewise. * sysdeps/powerpc/powerpc64/multiarch/stpcpy.c [SHARED && !NOT_IN_libc] (NO_MEMPCPY_STPCPY_REDIRECT): Likewise.
* Fix locale memmem namespace (bug 17585).Joseph Myers2014-11-121-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | Locale code, brought in by ISO C functions, calls memmem, which is not an ISO C function. This isn't an ISO C conformance bug, because all mem* names are reserved, but glibc practice is not to rely on that reservation (thus, memmem is only declared in string.h if __USE_GNU even though ISO C would allow it to be declared unconditionally, for example). This patch changes that code to use __memmem. Note: there are uses of memmem elsewhere in glibc that I didn't change, although it may turn out some of those also need to use __memmem. Tested for x86_64 (testsuite, and that disassembly of installed shared libraries is unchanged by this patch). [BZ #17585] * string/memmem.c [!_LIBC] (__memmem): Define to memmem. (memmem): Rename to __memmem and define as weak alias of __memmem. Use libc_hidden_weak. (__memmem): Use libc_hidden_def. * include/string.h (__memmem): Declare. Use libc_hidden_proto. * locale/findlocale.c (valid_locale_name): Use __memmem instead of memmem.