glibc/sysdeps/powerpc
Matheus Castanho 1a594aa986 powerpc: Add optimized rawmemchr for POWER10
Reuse code for optimized strlen to implement a faster version of rawmemchr.
This takes advantage of the same benefits provided by the strlen implementation,
but needs some extra steps. __strlen_power10 code should be unchanged after this
change.

rawmemchr returns a pointer to the char found, while strlen returns only the
length, so we have to take that into account when preparing the return value.

To quickly check 64B, the loop on __strlen_power10 merges the whole block into
16B by using unsigned minimum vector operations (vminub) and checks if there are
any \0 on the resulting vector. The same code is used by rawmemchr if the char c
is 0. However, this approach does not work when c != 0.  We first need to
subtract each byte by c, so that the value we are looking for is converted to a
0, then taking the minimum and checking for nulls works again.

The new code branches after it has compared ~256 bytes and chooses which of the
two strategies above will be used in the main loop, based on the char c. This
extra branch adds some overhead (~5%) for length ~256, but is quickly amortized
by the faster loop for larger sizes.

Compared to __rawmemchr_power9, this version is ~20% faster for length < 256.
Because of the optimized main loop, the improvement becomes ~35% for c != 0
and ~50% for c = 0 for strings longer than 256.

Reviewed-by: Lucas A. M. Magalhaes <lamm@linux.ibm.com>
Reviewed-by: Raphael M Zinsly <rzinsly@linux.ibm.com>
2021-05-17 10:30:35 -03:00
..
bits Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
fpu powerpc: Update libm test ulps 2021-04-09 17:41:22 -03:00
nofpu Update powerpc-nofpu libm-test-ulps. 2021-01-18 20:21:07 +00:00
nptl nptl: Move pthread_spin_trylock into libc 2021-04-23 17:06:48 +02:00
power4 Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
power6 Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
powerpc32 Implement <unwind-link.h> for dynamically loading the libgcc_s unwinder 2021-03-01 15:58:01 +01:00
powerpc64 powerpc: Add optimized rawmemchr for POWER10 2021-05-17 10:30:35 -03:00
sys/platform Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
abort-instr.h Update. 2002-09-15 18:31:23 +00:00
atomic-machine.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
cpu-features.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
cpu-features.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
dl-procinfo.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
dl-procinfo.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
dl-tls.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
dl-tls.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
dl-tunables.list Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
elf-initfini.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
ffs.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
fpu_control.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
gccframe.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
hwcapinfo.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
hwcapinfo.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
ifunc-sel.h Fix powerpc ifunc-sel.h build for -Os. 2018-03-02 22:27:56 +00:00
jmpbuf-offsets.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
jmpbuf-unwind.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
ldsodefs.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
libc-tls.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
locale-defines.sym powerpc: strcasestr optmization for power8 2016-04-22 19:23:13 +05:30
longjmp.c nptl: Move __pthread_unwind_next into libc 2021-04-21 19:49:50 +02:00
machine-gmon.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
Makefile powerpc: Move cache line size to rtld_global_ro 2020-01-17 09:05:03 -03:00
math-tests-snan-cast.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memusage.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
mod-cache-ppc.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
mod-tlsopt-powerpc.c tst-tlsopt-powerpc as a shared lib 2017-08-03 15:39:21 +09:30
mp_clz_tab.c Update. 2002-03-14 20:48:50 +00:00
novmx-longjmp.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
novmx-sigjmp.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
novmxsetjmp.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
preconfigure powerpc: Add support for POWER10 2020-06-29 10:08:38 -03:00
preconfigure.ac powerpc: Add support for POWER10 2020-06-29 10:08:38 -03:00
rtld-global-offsets.sym powerpc: Move cache line size to rtld_global_ro 2020-01-17 09:05:03 -03:00
sigjmp.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
sotruss-lib.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
stackinfo.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
sysdep.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
test-arith.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
test-arithf.c Update. 1997-08-10 18:37:15 +00:00
test-get_hwcap-static.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
test-get_hwcap.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
test-gettimebase.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
tls-macros.h Split tls-macros.h in sysdeps directories. 2012-07-19 17:04:04 -03:00
tst-cache-ppc-static-dlopen.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
tst-cache-ppc-static.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
tst-cache-ppc.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
tst-set_ppr.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
tst-stack-align.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
tst-tlsifunc-static.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
tst-tlsifunc.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
tst-tlsopt-powerpc.c tst-tlsopt-powerpc as a shared lib 2017-08-03 15:39:21 +09:30
Versions nptl: Move __pthread_unwind_next into libc 2021-04-21 19:49:50 +02:00