glibc/sysdeps/powerpc/powerpc64/multiarch
Matheus Castanho 10624a97e8 powerpc: Add optimized strlen for POWER10
Improvements compared to POWER9 version:

1. Take into account first 16B comparison for aligned strings

   The previous version compares the first 16B and increments r4 by the number
   of bytes until the address is 16B-aligned, then starts doing aligned loads at
   that address. For aligned strings, this causes the first 16B to be compared
   twice, because the increment is 0. Here we calculate the next 16B-aligned
   address differently, which avoids that issue.

2. Use simple comparisons for the first ~192 bytes

   The main loop is good for big strings, but comparing 16B each time is better
   for smaller strings.  So after aligning the address to 16 Bytes, we check
   more 176B in 16B chunks.  There may be some overlaps with the main loop for
   unaligned strings, but we avoid using the more aggressive strategy too soon,
   and also allow the loop to start at a 64B-aligned address.  This greatly
   benefits smaller strings and avoids overlapping checks if the string is
   already aligned at a 64B boundary.

3. Reduce dependencies between load blocks caused by address calculation on loop

   Doing a precise time tracing on the code showed many loads in the loop were
   stalled waiting for updates to r4 from previous code blocks.  This
   implementation avoids that as much as possible by using 2 registers (r4 and
   r5) to hold addresses to be used by different parts of the code.

   Also, the previous code aligned the address to 16B, then to 64B by doing a
   few 48B loops (if needed) until the address was aligned. The main loop could
   not start until that 48B loop had finished and r4 was updated with the
   current address. Here we calculate the address used by the loop very early,
   so it can start sooner.

   The main loop now uses 2 pointers 128B apart to make pointer updates less
   frequent, and also unrolls 1 iteration to guarantee there is enough time
   between iterations to update the pointers, reducing stalled cycles.

4. Use new P10 instructions

   lxvp is used to load 32B with a single instruction, reducing contention in
   the load queue.

   vextractbm allows simplifying the tail code for the loop, replacing
   vbpermq and avoiding having to generate a permute control vector.

Reviewed-by: Paul E Murphy <murphyp@linux.ibm.com>
Reviewed-by: Raphael M Zinsly <rzinsly@linux.ibm.com>
Reviewed-by: Lucas A. M. Magalhaes <lamm@linux.ibm.com>
2021-04-22 16:18:06 -03:00
..
bcopy-ppc64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
bcopy.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
bzero.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
ifunc-impl-list.c powerpc: Add optimized strlen for POWER10 2021-04-22 16:18:06 -03:00
init-arch.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
Makefile powerpc: Add optimized strlen for POWER10 2021-04-22 16:18:06 -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-ppc64.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memcpy.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memmove-power7.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memmove-ppc64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memmove.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08: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-ppc64.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
memset.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08: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-ppc64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
rawmemchr.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08: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