aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/aarch64/multiarch/memset_emag.S
diff options
context:
space:
mode:
authorFeng Xue <fxue@os.amperecomputing.com>2018-07-30 02:21:42 -0400
committerFeng Xue <fxue@os.amperecomputing.com>2019-02-01 07:59:18 -0500
commitc7d3890ff51bceb38fac0947ce1f2bb0c34f6b15 (patch)
tree2888ed321d26b3c0df7347cf25e0772a41fadf12 /sysdeps/aarch64/multiarch/memset_emag.S
parent07c3d1ec03ee3633918afb59213cd1bac2ab276e (diff)
downloadglibc-c7d3890ff51bceb38fac0947ce1f2bb0c34f6b15.tar
glibc-c7d3890ff51bceb38fac0947ce1f2bb0c34f6b15.tar.gz
glibc-c7d3890ff51bceb38fac0947ce1f2bb0c34f6b15.tar.bz2
glibc-c7d3890ff51bceb38fac0947ce1f2bb0c34f6b15.zip
aarch64: Optimized memset specific to AmpereComputing emag
This version uses general register based memory store instead of vector register based, for the former is faster than the latter in emag. The fact that DC ZVA size in emag is 64-byte, is used by IFUNC dispatch to select this memset, so that cost of runtime-check on DC ZVA size can be saved. * sysdeps/aarch64/multiarch/Makefile (sysdep_routines): Add memset_emag. * sysdeps/aarch64/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list): Add __memset_emag to memset ifunc. * sysdeps/aarch64/multiarch/memset.c (libc_ifunc): Add IS_EMAG check for ifunc dispatch. * sysdeps/aarch64/multiarch/memset_base64.S: New file. * sysdeps/aarch64/multiarch/memset_emag.S: New file.
Diffstat (limited to 'sysdeps/aarch64/multiarch/memset_emag.S')
-rw-r--r--sysdeps/aarch64/multiarch/memset_emag.S32
1 files changed, 32 insertions, 0 deletions
diff --git a/sysdeps/aarch64/multiarch/memset_emag.S b/sysdeps/aarch64/multiarch/memset_emag.S
new file mode 100644
index 0000000000..1c1fabc624
--- /dev/null
+++ b/sysdeps/aarch64/multiarch/memset_emag.S
@@ -0,0 +1,32 @@
+/* Optimized memset for AmpereComputing emag processor.
+ Copyright (C) 2018 Free Software Foundation, Inc.
+
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#if IS_IN (libc)
+# define MEMSET __memset_emag
+
+/*
+ * Using dc zva to zero memory does not produce better performance if
+ * memory size is not very large, especially when there are multiple
+ * processes/threads contending memory/cache. Here we use a somewhat
+ * large threshold to trigger usage of dc zva.
+*/
+# define DC_ZVA_THRESHOLD 1024
+
+# include "./memset_base64.S"
+#endif