powerpc64le: Optimize memset for POWER10
commit23fdf8178cce3c2ec320dd5eca8b544245bcaef0
authorRaoni Fassina Firmino <raoni@linux.ibm.com>
Fri, 30 Apr 2021 21:12:08 +0000 (30 18:12 -0300)
committerTulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
Fri, 30 Apr 2021 21:12:08 +0000 (30 18:12 -0300)
tree964850757fe4acf099e9fb3696ac19f79dc24f94
parente941e0ae80626b7661c1db8953a673cafd3b8b19
powerpc64le: Optimize memset for POWER10

This implementation is based on __memset_power8 and integrates a lot
of suggestions from Anton Blanchard.

The biggest difference is that it makes extensive use of stxvl to
alignment and tail code to avoid branches and small stores.  It has
three main execution paths:

a) "Short lengths" for lengths up to 64 bytes, avoiding as many
   branches as possible.

b) "General case" for larger lengths, it has an alignment section
   using stxvl to avoid branches, a 128 bytes loop and then a tail
   code, again using stxvl with few branches.

c) "Zeroing cache blocks" for lengths from 256 bytes upwards and set
   value being zero.  It is mostly the __memset_power8 code but the
   alignment phase was simplified because, at this point, address is
   already 16-bytes aligned and also changed to use vector stores.
   The tail code was also simplified to reuse the general case tail.

All unaligned stores use stxvl instructions that do not generate
alignment interrupts on POWER10, making it safe to use on
caching-inhibited memory.

On average, this implementation provides something around 30%
improvement when compared to __memset_power8.

Reviewed-by: Matheus Castanho <msc@linux.ibm.com>
Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
sysdeps/powerpc/powerpc64/le/power10/memset.S [new file with mode: 0644]
sysdeps/powerpc/powerpc64/multiarch/Makefile
sysdeps/powerpc/powerpc64/multiarch/bzero.c
sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
sysdeps/powerpc/powerpc64/multiarch/memset-power10.S [new file with mode: 0644]
sysdeps/powerpc/powerpc64/multiarch/memset.c