summary refs log tree commit diff
path: root/sysdeps/aarch64/multiarch/strlen.c
diff options
context:
space:
mode:
authorWilco Dijkstra <wdijkstr@arm.com>2020-07-17 14:09:36 +0100
committerWilco Dijkstra <wdijkstr@arm.com>2020-07-17 15:07:23 +0100
commitf46ef33ad134bec7ac992f28ee4b8b0614590e3e (patch)
treef34fe31172e393172c15b2bb189382ad9c0b17e2 /sysdeps/aarch64/multiarch/strlen.c
parent76b8442db51a8976de19934638a42532a3af607f (diff)
downloadglibc-f46ef33ad134bec7ac992f28ee4b8b0614590e3e.tar.gz
glibc-f46ef33ad134bec7ac992f28ee4b8b0614590e3e.tar.xz
glibc-f46ef33ad134bec7ac992f28ee4b8b0614590e3e.zip
AArch64: Improve strlen_asimd performance (bug 25824)
Optimize strlen using a mix of scalar and SIMD code.  On modern micro
architectures large strings are 2.6 times faster than existing
strlen_asimd and 35% faster than the new MTE version of strlen.

On a random strlen benchmark using small sizes the speedup is 7% vs
strlen_asimd and 40% vs the MTE strlen.  This fixes the main strlen
regressions on Cortex-A53 and other cores with a simple Neon unit.

Rename __strlen_generic to __strlen_mte, and select strlen_asimd when
MTE is not enabled (this is waiting on support for a HWCAP_MTE bit).

This fixes big-endian bug 25824. Passes GLIBC regression tests.

Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
Diffstat (limited to 'sysdeps/aarch64/multiarch/strlen.c')
-rw-r--r--sysdeps/aarch64/multiarch/strlen.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/sysdeps/aarch64/multiarch/strlen.c b/sysdeps/aarch64/multiarch/strlen.c
index 99f2cf2cde..7c0352dd87 100644
--- a/sysdeps/aarch64/multiarch/strlen.c
+++ b/sysdeps/aarch64/multiarch/strlen.c
@@ -26,17 +26,15 @@
 # include <string.h>
 # include <init-arch.h>
 
-#define USE_ASIMD_STRLEN() IS_FALKOR (midr)
+/* This should check HWCAP_MTE when it is available.  */
+#define MTE_ENABLED() (false)
 
 extern __typeof (__redirect_strlen) __strlen;
 
-extern __typeof (__redirect_strlen) __strlen_generic attribute_hidden;
+extern __typeof (__redirect_strlen) __strlen_mte attribute_hidden;
 extern __typeof (__redirect_strlen) __strlen_asimd attribute_hidden;
 
-libc_ifunc (__strlen,
-	    (USE_ASIMD_STRLEN () || IS_KUNPENG920 (midr)
-	    ? __strlen_asimd
-	    :__strlen_generic));
+libc_ifunc (__strlen, (MTE_ENABLED () ? __strlen_mte : __strlen_asimd));
 
 # undef strlen
 strong_alias (__strlen, strlen);