aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/aarch64/multiarch/memset.c
diff options
context:
space:
mode:
authorWilco Dijkstra <wdijkstr@arm.com>2022-10-26 14:12:55 +0100
committerWilco Dijkstra <wdijkstr@arm.com>2022-10-26 14:12:55 +0100
commita8e72913fea0c6e2832c50523c60907ffa3b753b (patch)
tree768b29a35beb995c4edd7fdac881bb21005d0c13 /sysdeps/aarch64/multiarch/memset.c
parent891a7958a28eac6d4af1517dd2896fef5e4951d4 (diff)
downloadglibc-a8e72913fea0c6e2832c50523c60907ffa3b753b.zip
glibc-a8e72913fea0c6e2832c50523c60907ffa3b753b.tar.gz
glibc-a8e72913fea0c6e2832c50523c60907ffa3b753b.tar.bz2
aarch64: Cleanup memset ifunc
Cleanup memset ifunc selectors. The A64FX memset relies on a ZVA size of 256, so add an explicit check.
Diffstat (limited to 'sysdeps/aarch64/multiarch/memset.c')
-rw-r--r--sysdeps/aarch64/multiarch/memset.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/sysdeps/aarch64/multiarch/memset.c b/sysdeps/aarch64/multiarch/memset.c
index c4008f3..1e9ad21 100644
--- a/sysdeps/aarch64/multiarch/memset.c
+++ b/sysdeps/aarch64/multiarch/memset.c
@@ -31,25 +31,34 @@ extern __typeof (__redirect_memset) __libc_memset;
extern __typeof (__redirect_memset) __memset_falkor attribute_hidden;
extern __typeof (__redirect_memset) __memset_emag attribute_hidden;
extern __typeof (__redirect_memset) __memset_kunpeng attribute_hidden;
-# if HAVE_AARCH64_SVE_ASM
extern __typeof (__redirect_memset) __memset_a64fx attribute_hidden;
-# endif
extern __typeof (__redirect_memset) __memset_generic attribute_hidden;
-libc_ifunc (__libc_memset,
- IS_KUNPENG920 (midr)
- ?__memset_kunpeng
- : ((IS_FALKOR (midr) || IS_PHECDA (midr)) && zva_size == 64
- ? __memset_falkor
- : (IS_EMAG (midr) && zva_size == 64
- ? __memset_emag
-# if HAVE_AARCH64_SVE_ASM
- : (IS_A64FX (midr) && sve
- ? __memset_a64fx
- : __memset_generic))));
-# else
- : __memset_generic)));
-# endif
+static inline __typeof (__redirect_memset) *
+select_memset_ifunc (void)
+{
+ INIT_ARCH ();
+
+ if (sve && HAVE_AARCH64_SVE_ASM)
+ {
+ if (IS_A64FX (midr) && zva_size == 256)
+ return __memset_a64fx;
+ return __memset_generic;
+ }
+
+ if (IS_KUNPENG920 (midr))
+ return __memset_kunpeng;
+
+ if ((IS_FALKOR (midr) || IS_PHECDA (midr)) && zva_size == 64)
+ return __memset_falkor;
+
+ if (IS_EMAG (midr) && zva_size == 64)
+ return __memset_emag;
+
+ return __memset_generic;
+}
+
+libc_ifunc (__libc_memset, select_memset_ifunc ());
# undef memset
strong_alias (__libc_memset, memset);