From: Anton Blanchard via Libc-alpha <libc-alpha@sourceware.org>
To: tuliom@linux.ibm.com
Cc: libc-alpha@sourceware.org
Subject: [PATCH 2/3] powerpc64: Check cacheline size before using optimised memset routines
Date: Tue, 6 Jul 2021 20:51:06 +1000 [thread overview]
Message-ID: <20210706105107.1866836-2-anton@ozlabs.org> (raw)
In-Reply-To: <20210706105107.1866836-1-anton@ozlabs.org>
A number of optimised memset routines assume the cacheline size is 128B,
so we better check before using them.
---
sysdeps/powerpc/powerpc64/multiarch/memset.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/memset.c b/sysdeps/powerpc/powerpc64/multiarch/memset.c
index c1aa143f60..056e911699 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/memset.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/memset.c
@@ -43,16 +43,21 @@ libc_ifunc (__libc_memset,
# ifdef __LITTLE_ENDIAN__
(hwcap2 & PPC_FEATURE2_ARCH_3_1
&& hwcap2 & PPC_FEATURE2_HAS_ISEL
- && hwcap & PPC_FEATURE_HAS_VSX)
+ && hwcap & PPC_FEATURE_HAS_VSX
+ && GLRO(dl_cache_line_size) == 128)
? __memset_power10 :
# endif
- (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+ (hwcap2 & PPC_FEATURE2_ARCH_2_07
+ && GLRO(dl_cache_line_size) == 128)
? __memset_power8 :
- (hwcap & PPC_FEATURE_ARCH_2_06)
+ (hwcap & PPC_FEATURE_ARCH_2_06
+ && GLRO(dl_cache_line_size) == 128)
? __memset_power7 :
- (hwcap & PPC_FEATURE_ARCH_2_05)
+ (hwcap & PPC_FEATURE_ARCH_2_05
+ && GLRO(dl_cache_line_size) == 128)
? __memset_power6 :
- (hwcap & PPC_FEATURE_POWER4)
+ (hwcap & PPC_FEATURE_POWER4
+ && GLRO(dl_cache_line_size) == 128)
? __memset_power4
: __memset_ppc);
--
2.31.1
next prev parent reply other threads:[~2021-07-06 10:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-06 10:51 [PATCH 1/3] powerpc64: Replace some PPC_FEATURE_HAS_VSX with PPC_FEATURE_ARCH_2_06 Anton Blanchard via Libc-alpha
2021-07-06 10:51 ` Anton Blanchard via Libc-alpha [this message]
2021-07-08 22:33 ` [PATCH 2/3] powerpc64: Check cacheline size before using optimised memset routines Tulio Magno Quites Machado Filho via Libc-alpha
2021-07-06 10:51 ` [PATCH 3/3] powerpc64: Add checks for Altivec and VSX in ifunc selection Anton Blanchard via Libc-alpha
2021-07-06 15:05 ` [PATCH 1/3] powerpc64: Replace some PPC_FEATURE_HAS_VSX with PPC_FEATURE_ARCH_2_06 Adhemerval Zanella via Libc-alpha
2021-07-08 22:29 ` Tulio Magno Quites Machado Filho via Libc-alpha
2021-07-13 19:03 ` Adhemerval Zanella via Libc-alpha
2021-07-16 13:28 ` Tulio Magno Quites Machado Filho via Libc-alpha
2021-07-26 23:23 ` Anton Blanchard via Libc-alpha
-- strict thread matches above, loose matches on Subject: below --
2021-07-27 5:47 Anton Blanchard via Libc-alpha
2021-07-27 5:47 ` [PATCH 2/3] powerpc64: Check cacheline size before using optimised memset routines Anton Blanchard via Libc-alpha
2021-08-06 19:50 ` Tulio Magno Quites Machado Filho via Libc-alpha
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/libc/involved.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210706105107.1866836-2-anton@ozlabs.org \
--to=libc-alpha@sourceware.org \
--cc=anton@ozlabs.org \
--cc=tuliom@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).