diff options
author | Wilco Dijkstra <wdijkstr@arm.com> | 2022-10-26 14:12:55 +0100 |
---|---|---|
committer | Wilco Dijkstra <wilco.dijkstra@arm.com> | 2024-04-08 17:25:52 +0100 |
commit | c503e2206e77506eba9976adbe6fddce6b7407cf (patch) | |
tree | f063326ad27ce002a20e7bf4f3fb3d39fd647b95 /sysdeps/aarch64/multiarch/memset.c | |
parent | 577bd1e049cab8202613e4136f2ffa62e352f788 (diff) | |
download | glibc-c503e2206e77506eba9976adbe6fddce6b7407cf.tar.gz glibc-c503e2206e77506eba9976adbe6fddce6b7407cf.tar.xz glibc-c503e2206e77506eba9976adbe6fddce6b7407cf.zip |
aarch64: Cleanup memset ifunc
Cleanup memset ifunc selectors. The A64FX memset relies on a ZVA size of 256, so add an explicit check. (cherry picked from commit a8e72913fea0c6e2832c50523c60907ffa3b753b)
Diffstat (limited to 'sysdeps/aarch64/multiarch/memset.c')
-rw-r--r-- | sysdeps/aarch64/multiarch/memset.c | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/sysdeps/aarch64/multiarch/memset.c b/sysdeps/aarch64/multiarch/memset.c index c4008f346b..1e9ad2160c 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); |