about summary refs log tree commit diff
path: root/sysdeps/aarch64/memchr.S
diff options
context:
space:
mode:
authorFeng Xue <fxue@os.amperecomputing.com>2018-08-09 04:38:03 -0400
committerFeng Xue <fxue@os.amperecomputing.com>2019-02-01 08:14:21 -0500
commit83d1cc42d8e6b18a4b6ba53addfdae98c694ea36 (patch)
tree31baf4b5309964aadf357cb81b21f5e6614a983e /sysdeps/aarch64/memchr.S
parentc7d3890ff51bceb38fac0947ce1f2bb0c34f6b15 (diff)
downloadglibc-83d1cc42d8e6b18a4b6ba53addfdae98c694ea36.tar.gz
glibc-83d1cc42d8e6b18a4b6ba53addfdae98c694ea36.tar.xz
glibc-83d1cc42d8e6b18a4b6ba53addfdae98c694ea36.zip
aarch64: Optimized memchr specific to AmpereComputing emag
This version uses general register based memory instruction to load
data, because vector register based is slightly slower in emag.

Character-matching is performed on 16-byte (both size and alignment)
memory block in parallel each iteration.

    * sysdeps/aarch64/memchr.S (__memchr): Rename to MEMCHR.
    [!MEMCHR](MEMCHR): Set to __memchr.
    * sysdeps/aarch64/multiarch/Makefile (sysdep_routines):
    Add memchr_generic and memchr_nosimd.
    * sysdeps/aarch64/multiarch/ifunc-impl-list.c
    (__libc_ifunc_impl_list): Add memchr ifuncs.
    * sysdeps/aarch64/multiarch/memchr.c: New file.
    * sysdeps/aarch64/multiarch/memchr_generic.S: Likewise.
    * sysdeps/aarch64/multiarch/memchr_nosimd.S: Likewise.
Diffstat (limited to 'sysdeps/aarch64/memchr.S')
-rw-r--r--sysdeps/aarch64/memchr.S10
1 files changed, 7 insertions, 3 deletions
diff --git a/sysdeps/aarch64/memchr.S b/sysdeps/aarch64/memchr.S
index bb7b971e04..7023d913e7 100644
--- a/sysdeps/aarch64/memchr.S
+++ b/sysdeps/aarch64/memchr.S
@@ -26,6 +26,10 @@
  * Neon Available.
  */
 
+#ifndef MEMCHR
+# define MEMCHR __memchr
+#endif
+
 /* Arguments and results.  */
 #define srcin		x0
 #define chrin		w1
@@ -59,7 +63,7 @@
  * identify exactly which byte has matched.
  */
 
-ENTRY (__memchr)
+ENTRY (MEMCHR)
 	/* Do not dereference srcin if no bytes to compare.  */
 	cbz	cntin, L(zero_length)
 	/*
@@ -152,6 +156,6 @@ L(tail):
 L(zero_length):
 	mov	result, #0
 	ret
-END (__memchr)
-weak_alias (__memchr, memchr)
+END (MEMCHR)
+weak_alias (MEMCHR, memchr)
 libc_hidden_builtin_def (memchr)