glibc/sysdeps
H.J. Lu 2f5d20ac99 x86-64: Optimize memchr/rawmemchr/wmemchr with SSE2/AVX2
SSE2 memchr is extended to support wmemchr.  AVX2 memchr/rawmemchr/wmemchr
are added to search 32 bytes with a single vector compare instruction.
AVX2 memchr/rawmemchr/wmemchr are as fast as SSE2 memchr/rawmemchr/wmemchr
for small sizes and up to 1.5X faster for larger sizes on Haswell and
Skylake.  Select AVX2 memchr/rawmemchr/wmemchr on AVX2 machines where
vzeroupper is preferred and AVX unaligned load is fast.

NB: It uses TZCNT instead of BSF since TZCNT produces the same result
as BSF for non-zero input.  TZCNT is faster than BSF and is executed
as BSF if machine doesn't support TZCNT.

	* sysdeps/x86_64/memchr.S (MEMCHR): New.  Depending on if
	USE_AS_WMEMCHR is defined.
	(PCMPEQ): Likewise.
	(memchr): Renamed to ...
	(MEMCHR): This.  Support wmemchr if USE_AS_WMEMCHR is defined.
	Replace pcmpeqb with PCMPEQ.
	* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
	memchr-sse2, rawmemchr-sse2, memchr-avx2, rawmemchr-avx2,
	wmemchr-sse4_1, wmemchr-avx2 and wmemchr-c.
	* sysdeps/x86_64/multiarch/ifunc-avx2.h: New file.
	* sysdeps/x86_64/multiarch/memchr-avx2.S: Likewise.
	* sysdeps/x86_64/multiarch/memchr-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/memchr.c: Likewise.
	* sysdeps/x86_64/multiarch/rawmemchr-avx2.S: Likewise.
	* sysdeps/x86_64/multiarch/rawmemchr-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/rawmemchr.c: Likewise.
	* sysdeps/x86_64/multiarch/wmemchr-avx2.S: Likewise.
	* sysdeps/x86_64/multiarch/wmemchr-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/wmemchr.c: Likewise.
	* sysdeps/x86_64/multiarch/ifunc-impl-list.c
	(__libc_ifunc_impl_list): Test __memchr_avx2, __memchr_sse2,
	__rawmemchr_avx2, __rawmemchr_sse2, __wmemchr_avx2 and
	__wmemchr_sse2.
2017-06-09 05:13:31 -07:00
..
aarch64 Optimize generic spinlock code and use C11 like atomic macros. 2017-06-06 09:41:56 +02:00
alpha Optimize generic spinlock code and use C11 like atomic macros. 2017-06-06 09:41:56 +02:00
arm Optimize generic spinlock code and use C11 like atomic macros. 2017-06-06 09:41:56 +02:00
generic ld.so: Consolidate 2 strtouls into _dl_strtoul [BZ #21528] 2017-06-08 12:52:42 -07:00
gnu Regenerate sysdeps/gnu/errlist.c. 2017-06-04 15:27:14 -04:00
hppa Optimize generic spinlock code and use C11 like atomic macros. 2017-06-06 09:41:56 +02:00
i386 Optimize generic spinlock code and use C11 like atomic macros. 2017-06-06 09:41:56 +02:00
ia64 Optimize generic spinlock code and use C11 like atomic macros. 2017-06-06 09:41:56 +02:00
ieee754 float128: Add strfromf128 2017-06-07 17:08:21 -03:00
init_array Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
m68k Optimize generic spinlock code and use C11 like atomic macros. 2017-06-06 09:41:56 +02:00
mach Fix struct sigaltstack namespace (bug 21517). 2017-06-05 10:17:46 +00:00
microblaze Optimize generic spinlock code and use C11 like atomic macros. 2017-06-06 09:41:56 +02:00
mips Optimize generic spinlock code and use C11 like atomic macros. 2017-06-06 09:41:56 +02:00
nios2 Optimize generic spinlock code and use C11 like atomic macros. 2017-06-06 09:41:56 +02:00
nptl fork: Remove bogus parent PID assertions [BZ #21386] 2017-05-12 16:04:16 +02:00
posix getaddrinfo: Eliminate another strdup call 2017-06-03 08:37:31 +02:00
powerpc Optimize generic spinlock code and use C11 like atomic macros. 2017-06-06 09:41:56 +02:00
pthread Remove __need macros from signal.h. 2017-05-20 19:04:43 -04:00
s390 S390: Use generic spinlock code. 2017-06-06 09:41:56 +02:00
sh Move shared pthread definitions to common headers 2017-05-09 17:49:17 -03:00
sparc Make LD_HWCAP_MASK usable for static binaries 2017-06-07 11:11:40 +05:30
tile Optimize generic spinlock code and use C11 like atomic macros. 2017-06-06 09:41:56 +02:00
unix aarch64: Fix undefined behavior in _dl_procinfo 2017-06-09 14:18:12 +05:30
wordsize-32 Build divdi3 only for architecture that required it 2017-04-06 15:14:34 -03:00
wordsize-64 Add missing header files throughout the testsuite. 2017-02-16 17:33:18 -05:00
x86 Make LD_HWCAP_MASK usable for static binaries 2017-06-07 11:11:40 +05:30
x86_64 x86-64: Optimize memchr/rawmemchr/wmemchr with SSE2/AVX2 2017-06-09 05:13:31 -07:00