glibc/sysdeps/powerpc/powerpc64/multiarch
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
..
bcopy-ppc64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
bcopy.c powerpc64le: Fix ifunc selection for memset, memmove, bzero and bcopy 2021-05-07 15:52:23 -03:00
bzero.c powerpc64le: Fix ifunc selection for memset, memmove, bzero and bcopy 2021-05-07 15:52:23 -03:00
ifunc-impl-list.c powerpc: Add optimized rawmemchr for POWER10 2021-05-17 10:30:35 -03:00
init-arch.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
Makefile powerpc: Add optimized rawmemchr for POWER10 2021-05-17 10:30:35 -03:00
memchr-power7.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memchr-power8.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memchr-ppc64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memchr.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memcmp-power4.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memcmp-power7.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memcmp-power8.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memcmp-ppc64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memcmp.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memcpy-a2.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memcpy-cell.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memcpy-power4.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memcpy-power6.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memcpy-power7.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memcpy-power8-cached.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memcpy-power10.S powerpc64le: Optimize memcpy for POWER10 2021-04-30 18:12:08 -03:00
memcpy-ppc64.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memcpy.c powerpc64le: Optimize memcpy for POWER10 2021-04-30 18:12:08 -03:00
memmove-power7.S powerpc64le: Optimized memmove for POWER10 2021-04-30 18:12:08 -03:00
memmove-power10.S powerpc64le: Optimized memmove for POWER10 2021-04-30 18:12:08 -03:00
memmove-ppc64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memmove.c powerpc64le: Fix ifunc selection for memset, memmove, bzero and bcopy 2021-05-07 15:52:23 -03:00
mempcpy-power7.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
mempcpy-ppc64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
mempcpy.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memrchr-power7.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memrchr-power8.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memrchr-ppc64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memrchr.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memset-power4.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memset-power6.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memset-power7.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memset-power8.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memset-power10.S powerpc64le: Optimize memset for POWER10 2021-04-30 18:12:08 -03:00
memset-ppc64.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memset.c powerpc64le: Fix ifunc selection for memset, memmove, bzero and bcopy 2021-05-07 15:52:23 -03:00
rawmemchr-power7.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
rawmemchr-power9.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
rawmemchr-power10.S powerpc: Add optimized rawmemchr for POWER10 2021-05-17 10:30:35 -03:00
rawmemchr-ppc64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
rawmemchr.c powerpc: Add optimized rawmemchr for POWER10 2021-05-17 10:30:35 -03:00
rtld-memset.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
rtld-strchr.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
stpcpy-power7.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
stpcpy-power8.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
stpcpy-power9.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
stpcpy-ppc64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
stpcpy.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
stpncpy-power7.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
stpncpy-power8.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
stpncpy-power9.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
stpncpy-ppc64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
stpncpy.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strcasecmp_l-power7.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strcasecmp_l.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strcasecmp-power7.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strcasecmp-power8.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strcasecmp-ppc64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strcasecmp.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strcasestr-power8.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strcasestr-ppc64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strcasestr.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strcat-power7.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strcat-power8.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strcat-ppc64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strcat.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strchr-power7.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strchr-power8.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strchr-ppc64.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strchr.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strchrnul-power7.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strchrnul-power8.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strchrnul-ppc64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strchrnul.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strcmp-power7.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strcmp-power8.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strcmp-power9.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strcmp-ppc64.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strcmp.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strcpy-power7.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strcpy-power8.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strcpy-power9.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strcpy-ppc64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strcpy.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strcspn-power8.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strcspn-ppc64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strcspn.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strlen-power7.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strlen-power8.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strlen-power9.S powerpc64le: add optimized strlen for P9 2020-06-05 15:30:00 -05:00
strlen-power10.S powerpc: Add optimized strlen for POWER10 2021-04-22 16:18:06 -03:00
strlen-ppc64.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strlen.c powerpc: Add optimized strlen for POWER10 2021-04-22 16:18:06 -03:00
strncase_l-power7.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strncase_l.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strncase-power7.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strncase-power8.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strncase-ppc64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strncase.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strncat-power7.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strncat-power8.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strncat-ppc64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strncat.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strncmp-power4.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strncmp-power7.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strncmp-power8.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strncmp-power9.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strncmp-ppc64.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strncmp.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strncpy-power7.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strncpy-power8.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strncpy-power9.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strncpy-ppc64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strncpy.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strnlen-power7.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strnlen-power8.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strnlen-ppc64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strnlen.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strrchr-power7.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strrchr-power8.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strrchr-ppc64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strrchr.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strspn-power8.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strspn-ppc64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strspn.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strstr-power7.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strstr-ppc64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
strstr.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
wordcopy-ppc64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00