glibc/sysdeps/powerpc/powerpc64
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
..
a2 Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
be Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
bits Define wordsize.h macros everywhere 2016-11-04 09:37:44 -07:00
cell Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
fpu Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
le powerpc: Add optimized rawmemchr for POWER10 2021-05-17 10:30:35 -03:00
multiarch powerpc: Add optimized rawmemchr for POWER10 2021-05-17 10:30:35 -03: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
power7 powerpc64le: Optimized memmove for POWER10 2021-04-30 18:12:08 -03:00
power8 Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
__longjmp-common.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
__longjmp.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
addmul_1.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
atomic-machine.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
backtrace.c powerpc64: Workaround sigtramp vdso return call 2021-01-28 13:57:50 -03:00
bsd-_setjmp.S PowerPC64 ABI fixes 2010-08-12 09:19:19 -07:00
bsd-setjmp.S PowerPC64 ABI fixes 2010-08-12 09:19:19 -07:00
bzero.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
configure powerpc64: Fix calls when r2 is not used [BZ #26173] 2020-07-10 19:41:06 -03:00
configure.ac powerpc64: Fix calls when r2 is not used [BZ #26173] 2020-07-10 19:41:06 -03:00
crti.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
crtn.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
dl-dtprocnum.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
dl-irel.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
dl-machine.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
dl-machine.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
dl-trampoline.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
entry.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
ffsll.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
hp-timing.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
Implies Revert "Use ieee754/dbl-64/wordsize-64 on powerpc64" 2013-01-10 10:44:05 +01:00
lshift.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
Makefile powerpc64: apply -mabi=ibmlongdouble to special files 2020-03-25 14:34:23 -05:00
memcpy.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memset.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
mul_1.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
ppc-mcount.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
register-dump.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
rtld-memset.c powerpc: Use generic memset for RTLD for ppc32/64 2010-09-29 12:21:14 -04:00
setjmp-bug21895.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
setjmp-common.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
setjmp.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
stackguard-macros.h PowerPC: Fix POINTER_CHK_GUARD thread register for PPC64 2013-09-25 13:43:04 -05:00
start.S Reduce the statically linked startup code [BZ #23323] 2021-02-25 12:13:02 +01:00
strchr.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strcmp.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strlen.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strncmp.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
submul_1.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
sysdep.h powerpc64: Select POWER9 machine for the scv instruction 2021-01-22 10:45:27 +01:00
tls-macros.h tst-tlsopt-powerpc as a shared lib 2017-08-03 15:39:21 +09:30
tst-audit.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
tst-setjmp-bug21895-static.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
tst-ucontext-ppc64-vscr.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00