aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/tile/tilegx/strnlen.c
AgeCommit message (Collapse)Author
2017-12-20Simplify tilegx sysdeps folderAdhemerval Zanella
With tilepro support removal we can now simplify internal tile support by moving the directory structure to avoid the unnecessary directory levels in tile/tilegx both on generic and linux folders. Checked with a build for tilegx-linux-gnu and tilegx-linux-gnu-32 with and without the patch, there is no difference in generated binary with a dissassemble. * stdlib/bug-getcontext.c (do_test): Remove tilepro mention in comment. * sysdeps/tile/preconfigure: Remove tilegx folder. * sysdeps/tile/tilegx/Implies: Move definitions to ... * sysdeps/tile/Implies: ... here. * sysdeps/tile/tilegx/Makefile: Move rules to ... * sysdeps/tile/Makefile: ... here. * sysdeps/tile/tilegx/atomic-machine.h: Move definitions to ... * sysdeps/tile/atomic-machine.h: ... here. Add include guards. * sysdeps/tile/tilegx/bits/wordsize.h: Move to ... * sysdeps/tile/bits/wordsize.h: ... here. * sysdeps/tile/tilegx/*: Move to ... * sysdeps/tile/*: ... here. * sysdeps/tile/tilegx/tilegx32/Implies: Move to ... * sysdeps/tile/tilegx32/Implies: ... here. * sysdeps/tile/tilegx/tilegx64/Implies: Move to ... * sysdeps/tile/tilegx64/Implies: ... here. * sysdeps/unix/sysv/linux/tile/tilegx/Makefile: Move definitions to ... * sysdeps/unix/sysv/linux/tile/Makefile: ... here. * sysdeps/unix/sysv/linux/tile/tilegx/*: Move to ... * sysdeps/unix/sysv/linux/tile/*: ... here. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/*: Move to ... * sysdeps/unix/sysv/linux/tile/tilegx32/*: ... here. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/*: Move to ... * sysdeps/unix/sysv/linux/tile/tilegx64/*: ... here.
2017-12-05tilegx: work around vector insn bug in gccChris Metcalf
Avoid an issue in gcc where some of the vector (aka SIMD) ops will sometimes end up getting wrongly optimized out. We use these instructions in many of the string implementations. If/when we have an upstreamed fix for this problem in gcc we can conditionalize the use of the extended assembly workaround in glibc.
2017-01-01Update copyright dates with scripts/update-copyrights.Joseph Myers
2016-01-04Update copyright dates with scripts/update-copyrights.Joseph Myers
2015-06-02Use libc_hidden_proto / libc_hidden_def with __strnlen.Joseph Myers
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.
2015-01-02Update copyright dates with scripts/update-copyrights.Joseph Myers
2014-10-06tile: fix copyright header blocks in just-committed filesChris Metcalf
I accidentally committed versions not following the conventions.
2014-10-06tilegx: provide optimized strnlen, strstr, and strcasestrChris Metcalf
strnlen() is based on the existing tile strlen() with length checking added. It speeds up by up to 5x, but on average across the benchtest corpus by around 35%. No regressions are seen. strstr() does 8-byte aligned loads and compares using a 2-byte filter on the first two bytes of the needle and then testing the remaining bytes in needle using memcmp(). It speeds up about 5x in the best case (for "found" needles), about 2x looking at benchtest as a whole, with some slowdowns as much as 45%. on a few cases (including the "fail" case for 128KB search). strcasestr() is based on strstr() but uses a SIMD tolower routine to convert 8-bytes to lower case in 5 instructions. It also uses a 2-byte filter and then strncasecmp() for the remaining bytes. strncasecmp() is not optimized for SIMD, so there is futher room for improvement. However, it is still up to 16x faster for "found" needles, averaging 2x faster on the whole corpus of benchtests. It does slow down by up to 35% on a few cases, similarly to strstr().