--- /dev/null
+From e4ca6de1bc5e4ba3f94cf0c501a293c5bc827b10 Mon Sep 17 00:00:00 2001
+From: Anton Blanchard <anton@ozlabs.org>
+Date: Tue, 27 Jul 2021 15:47:49 +1000
+Subject: [PATCH 1/3] powerpc64: Replace some PPC_FEATURE_HAS_VSX with
+ PPC_FEATURE_ARCH_2_06
+
+We use PPC_FEATURE_HAS_VSX to select a number of POWER7 optimised
+functions. These functions don't use any VSX instructions, so
+PPC_FEATURE_ARCH_2_06 seems like a better fit.
+
+Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
+Signed-off-by: Joel Stanley <joel@jms.id.au>
+---
+ .../powerpc64/multiarch/ifunc-impl-list.c | 38 +++++++++----------
+ sysdeps/powerpc/powerpc64/multiarch/memchr.c | 2 +-
+ sysdeps/powerpc/powerpc64/multiarch/memcmp.c | 2 +-
+ sysdeps/powerpc/powerpc64/multiarch/memrchr.c | 2 +-
+ sysdeps/powerpc/powerpc64/multiarch/memset.c | 2 +-
+ .../powerpc/powerpc64/multiarch/rawmemchr.c | 2 +-
+ sysdeps/powerpc/powerpc64/multiarch/stpncpy.c | 2 +-
+ .../powerpc/powerpc64/multiarch/strcasecmp.c | 2 +-
+ .../powerpc64/multiarch/strcasecmp_l.c | 2 +-
+ sysdeps/powerpc/powerpc64/multiarch/strchr.c | 2 +-
+ .../powerpc/powerpc64/multiarch/strchrnul.c | 2 +-
+ sysdeps/powerpc/powerpc64/multiarch/strcmp.c | 2 +-
+ sysdeps/powerpc/powerpc64/multiarch/strlen.c | 2 +-
+ .../powerpc/powerpc64/multiarch/strncase.c | 2 +-
+ .../powerpc/powerpc64/multiarch/strncase_l.c | 2 +-
+ sysdeps/powerpc/powerpc64/multiarch/strncmp.c | 2 +-
+ sysdeps/powerpc/powerpc64/multiarch/strncpy.c | 2 +-
+ sysdeps/powerpc/powerpc64/multiarch/strnlen.c | 2 +-
+ sysdeps/powerpc/powerpc64/multiarch/strrchr.c | 2 +-
+ sysdeps/powerpc/powerpc64/multiarch/strstr.c | 2 +-
+ 20 files changed, 38 insertions(+), 38 deletions(-)
+
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
+index 0acdf22ba374..32564c8f1f25 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
+@@ -95,7 +95,7 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ #endif
+ IFUNC_IMPL_ADD (array, i, memset, hwcap2 & PPC_FEATURE2_ARCH_2_07,
+ __memset_power8)
+- IFUNC_IMPL_ADD (array, i, memset, hwcap & PPC_FEATURE_HAS_VSX,
++ IFUNC_IMPL_ADD (array, i, memset, hwcap & PPC_FEATURE_ARCH_2_06,
+ __memset_power7)
+ IFUNC_IMPL_ADD (array, i, memset, hwcap & PPC_FEATURE_ARCH_2_05,
+ __memset_power6)
+@@ -139,7 +139,7 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ #endif
+ IFUNC_IMPL_ADD (array, i, strlen, hwcap2 & PPC_FEATURE2_ARCH_2_07,
+ __strlen_power8)
+- IFUNC_IMPL_ADD (array, i, strlen, hwcap & PPC_FEATURE_HAS_VSX,
++ IFUNC_IMPL_ADD (array, i, strlen, hwcap & PPC_FEATURE_ARCH_2_06,
+ __strlen_power7)
+ IFUNC_IMPL_ADD (array, i, strlen, 1,
+ __strlen_ppc))
+@@ -152,7 +152,7 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ #endif
+ IFUNC_IMPL_ADD (array, i, strncmp, hwcap2 & PPC_FEATURE2_ARCH_2_07,
+ __strncmp_power8)
+- IFUNC_IMPL_ADD (array, i, strncmp, hwcap & PPC_FEATURE_HAS_VSX,
++ IFUNC_IMPL_ADD (array, i, strncmp, hwcap & PPC_FEATURE_ARCH_2_06,
+ __strncmp_power7)
+ IFUNC_IMPL_ADD (array, i, strncmp, hwcap & PPC_FEATURE_POWER4,
+ __strncmp_power4)
+@@ -165,7 +165,7 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ hwcap2 & PPC_FEATURE2_ARCH_2_07,
+ __strchr_power8)
+ IFUNC_IMPL_ADD (array, i, strchr,
+- hwcap & PPC_FEATURE_HAS_VSX,
++ hwcap & PPC_FEATURE_ARCH_2_06,
+ __strchr_power7)
+ IFUNC_IMPL_ADD (array, i, strchr, 1,
+ __strchr_ppc))
+@@ -176,7 +176,7 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ hwcap2 & PPC_FEATURE2_ARCH_2_07,
+ __strchrnul_power8)
+ IFUNC_IMPL_ADD (array, i, strchrnul,
+- hwcap & PPC_FEATURE_HAS_VSX,
++ hwcap & PPC_FEATURE_ARCH_2_06,
+ __strchrnul_power7)
+ IFUNC_IMPL_ADD (array, i, strchrnul, 1,
+ __strchrnul_ppc))
+@@ -192,7 +192,7 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ #endif
+ IFUNC_IMPL_ADD (array, i, memcmp, hwcap2 & PPC_FEATURE2_ARCH_2_07,
+ __memcmp_power8)
+- IFUNC_IMPL_ADD (array, i, memcmp, hwcap & PPC_FEATURE_HAS_VSX,
++ IFUNC_IMPL_ADD (array, i, memcmp, hwcap & PPC_FEATURE_ARCH_2_06,
+ __memcmp_power7)
+ IFUNC_IMPL_ADD (array, i, memcmp, hwcap & PPC_FEATURE_POWER4,
+ __memcmp_power4)
+@@ -244,7 +244,7 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ hwcap2 & PPC_FEATURE2_ARCH_2_07,
+ __memchr_power8)
+ IFUNC_IMPL_ADD (array, i, memchr,
+- hwcap & PPC_FEATURE_HAS_VSX,
++ hwcap & PPC_FEATURE_ARCH_2_06,
+ __memchr_power7)
+ IFUNC_IMPL_ADD (array, i, memchr, 1,
+ __memchr_ppc))
+@@ -255,7 +255,7 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ hwcap2 & PPC_FEATURE2_ARCH_2_07,
+ __memrchr_power8)
+ IFUNC_IMPL_ADD (array, i, memrchr,
+- hwcap & PPC_FEATURE_HAS_VSX,
++ hwcap & PPC_FEATURE_ARCH_2_06,
+ __memrchr_power7)
+ IFUNC_IMPL_ADD (array, i, memrchr, 1,
+ __memrchr_ppc))
+@@ -272,7 +272,7 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ __rawmemchr_power9)
+ #endif
+ IFUNC_IMPL_ADD (array, i, rawmemchr,
+- hwcap & PPC_FEATURE_HAS_VSX,
++ hwcap & PPC_FEATURE_ARCH_2_06,
+ __rawmemchr_power7)
+ IFUNC_IMPL_ADD (array, i, rawmemchr, 1,
+ __rawmemchr_ppc))
+@@ -282,7 +282,7 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ IFUNC_IMPL_ADD (array, i, strnlen,
+ hwcap2 & PPC_FEATURE2_ARCH_2_07,
+ __strnlen_power8)
+- IFUNC_IMPL_ADD (array, i, strnlen, hwcap & PPC_FEATURE_HAS_VSX,
++ IFUNC_IMPL_ADD (array, i, strnlen, hwcap & PPC_FEATURE_ARCH_2_06,
+ __strnlen_power7)
+ IFUNC_IMPL_ADD (array, i, strnlen, 1,
+ __strnlen_ppc))
+@@ -293,14 +293,14 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ hwcap2 & PPC_FEATURE2_ARCH_2_07,
+ __strcasecmp_power8)
+ IFUNC_IMPL_ADD (array, i, strcasecmp,
+- hwcap & PPC_FEATURE_HAS_VSX,
++ hwcap & PPC_FEATURE_ARCH_2_06,
+ __strcasecmp_power7)
+ IFUNC_IMPL_ADD (array, i, strcasecmp, 1, __strcasecmp_ppc))
+
+ /* Support sysdeps/powerpc/powerpc64/multiarch/strcasecmp_l.c. */
+ IFUNC_IMPL (i, name, strcasecmp_l,
+ IFUNC_IMPL_ADD (array, i, strcasecmp_l,
+- hwcap & PPC_FEATURE_HAS_VSX,
++ hwcap & PPC_FEATURE_ARCH_2_06,
+ __strcasecmp_l_power7)
+ IFUNC_IMPL_ADD (array, i, strcasecmp_l, 1,
+ __strcasecmp_l_ppc))
+@@ -311,14 +311,14 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ hwcap2 & PPC_FEATURE2_ARCH_2_07,
+ __strncasecmp_power8)
+ IFUNC_IMPL_ADD (array, i, strncasecmp,
+- hwcap & PPC_FEATURE_HAS_VSX,
++ hwcap & PPC_FEATURE_ARCH_2_06,
+ __strncasecmp_power7)
+ IFUNC_IMPL_ADD (array, i, strncasecmp, 1, __strncasecmp_ppc))
+
+ /* Support sysdeps/powerpc/powerpc64/multiarch/strncase_l.c. */
+ IFUNC_IMPL (i, name, strncasecmp_l,
+ IFUNC_IMPL_ADD (array, i, strncasecmp_l,
+- hwcap & PPC_FEATURE_HAS_VSX,
++ hwcap & PPC_FEATURE_ARCH_2_06,
+ __strncasecmp_l_power7)
+ IFUNC_IMPL_ADD (array, i, strncasecmp_l, 1,
+ __strncasecmp_l_ppc))
+@@ -329,7 +329,7 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ hwcap2 & PPC_FEATURE2_ARCH_2_07,
+ __strrchr_power8)
+ IFUNC_IMPL_ADD (array, i, strrchr,
+- hwcap & PPC_FEATURE_HAS_VSX,
++ hwcap & PPC_FEATURE_ARCH_2_06,
+ __strrchr_power7)
+ IFUNC_IMPL_ADD (array, i, strrchr, 1,
+ __strrchr_ppc))
+@@ -357,7 +357,7 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ hwcap2 & PPC_FEATURE2_ARCH_2_07,
+ __strncpy_power8)
+ IFUNC_IMPL_ADD (array, i, strncpy,
+- hwcap & PPC_FEATURE_HAS_VSX,
++ hwcap & PPC_FEATURE_ARCH_2_06,
+ __strncpy_power7)
+ IFUNC_IMPL_ADD (array, i, strncpy, 1,
+ __strncpy_ppc))
+@@ -374,7 +374,7 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ hwcap2 & PPC_FEATURE2_ARCH_2_07,
+ __stpncpy_power8)
+ IFUNC_IMPL_ADD (array, i, stpncpy,
+- hwcap & PPC_FEATURE_HAS_VSX,
++ hwcap & PPC_FEATURE_ARCH_2_06,
+ __stpncpy_power7)
+ IFUNC_IMPL_ADD (array, i, stpncpy, 1,
+ __stpncpy_ppc))
+@@ -390,7 +390,7 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ hwcap2 & PPC_FEATURE2_ARCH_2_07,
+ __strcmp_power8)
+ IFUNC_IMPL_ADD (array, i, strcmp,
+- hwcap & PPC_FEATURE_HAS_VSX,
++ hwcap & PPC_FEATURE_ARCH_2_06,
+ __strcmp_power7)
+ IFUNC_IMPL_ADD (array, i, strcmp, 1,
+ __strcmp_ppc))
+@@ -425,7 +425,7 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ /* Support sysdeps/powerpc/powerpc64/multiarch/strstr.c. */
+ IFUNC_IMPL (i, name, strstr,
+ IFUNC_IMPL_ADD (array, i, strstr,
+- hwcap & PPC_FEATURE_HAS_VSX,
++ hwcap & PPC_FEATURE_ARCH_2_06,
+ __strstr_power7)
+ IFUNC_IMPL_ADD (array, i, strstr, 1,
+ __strstr_ppc))
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/memchr.c b/sysdeps/powerpc/powerpc64/multiarch/memchr.c
+index 0c718d4f1522..c24186689e59 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/memchr.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/memchr.c
+@@ -30,7 +30,7 @@ extern __typeof (__memchr) __memchr_power8 attribute_hidden;
+ libc_ifunc (__memchr,
+ (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+ ? __memchr_power8 :
+- (hwcap & PPC_FEATURE_HAS_VSX)
++ (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __memchr_power7
+ : __memchr_ppc);
+
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/memcmp.c b/sysdeps/powerpc/powerpc64/multiarch/memcmp.c
+index 4fd089aba71c..99559bce26f9 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/memcmp.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/memcmp.c
+@@ -40,7 +40,7 @@ libc_ifunc_redirected (__redirect_memcmp, memcmp,
+ #endif
+ (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+ ? __memcmp_power8 :
+- (hwcap & PPC_FEATURE_HAS_VSX)
++ (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __memcmp_power7
+ : (hwcap & PPC_FEATURE_POWER4)
+ ? __memcmp_power4
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/memrchr.c b/sysdeps/powerpc/powerpc64/multiarch/memrchr.c
+index e06d6468b8bd..16bb6f004214 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/memrchr.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/memrchr.c
+@@ -30,7 +30,7 @@ extern __typeof (__memrchr) __memrchr_power8 attribute_hidden;
+ libc_ifunc (__memrchr,
+ (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+ ? __memrchr_power8 :
+- (hwcap & PPC_FEATURE_HAS_VSX)
++ (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __memrchr_power7
+ : __memrchr_ppc);
+
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/memset.c b/sysdeps/powerpc/powerpc64/multiarch/memset.c
+index 5994bf02e622..c1aa143f607d 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/memset.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/memset.c
+@@ -48,7 +48,7 @@ libc_ifunc (__libc_memset,
+ # endif
+ (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+ ? __memset_power8 :
+- (hwcap & PPC_FEATURE_HAS_VSX)
++ (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __memset_power7 :
+ (hwcap & PPC_FEATURE_ARCH_2_05)
+ ? __memset_power6 :
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/rawmemchr.c b/sysdeps/powerpc/powerpc64/multiarch/rawmemchr.c
+index c0ffea2b9376..b5d2d3a63542 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/rawmemchr.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/rawmemchr.c
+@@ -41,7 +41,7 @@ libc_ifunc_redirected (__redirect___rawmemchr, __rawmemchr,
+ (hwcap2 & PPC_FEATURE2_ARCH_3_00)
+ ? __rawmemchr_power9 :
+ # endif
+- (hwcap & PPC_FEATURE_HAS_VSX)
++ (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __rawmemchr_power7
+ : __rawmemchr_ppc);
+
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/stpncpy.c b/sysdeps/powerpc/powerpc64/multiarch/stpncpy.c
+index bebd377fd97f..e7035761a72e 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/stpncpy.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/stpncpy.c
+@@ -40,7 +40,7 @@ libc_ifunc_redirected (__redirect___stpncpy, __stpncpy,
+ # endif
+ (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+ ? __stpncpy_power8
+- : (hwcap & PPC_FEATURE_HAS_VSX)
++ : (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __stpncpy_power7
+ : __stpncpy_ppc);
+ weak_alias (__stpncpy, stpncpy)
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/strcasecmp.c b/sysdeps/powerpc/powerpc64/multiarch/strcasecmp.c
+index dcd777440377..55ca6c85c416 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/strcasecmp.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/strcasecmp.c
+@@ -29,7 +29,7 @@ extern __typeof (__strcasecmp) __strcasecmp_power8 attribute_hidden;
+ libc_ifunc (__libc_strcasecmp,
+ (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+ ? __strcasecmp_power8:
+- (hwcap & PPC_FEATURE_HAS_VSX)
++ (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __strcasecmp_power7
+ : __strcasecmp_ppc);
+
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/strcasecmp_l.c b/sysdeps/powerpc/powerpc64/multiarch/strcasecmp_l.c
+index 96a70b8b118c..1afee5d7fd12 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/strcasecmp_l.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/strcasecmp_l.c
+@@ -32,7 +32,7 @@ extern __typeof (__strcasecmp_l) __strcasecmp_l_power7 attribute_hidden;
+
+ extern __typeof (__strcasecmp_l) __libc_strcasecmp_l;
+ libc_ifunc (__libc_strcasecmp_l,
+- (hwcap & PPC_FEATURE_HAS_VSX)
++ (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __strcasecmp_l_power7
+ : __strcasecmp_l_ppc);
+
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/strchr.c b/sysdeps/powerpc/powerpc64/multiarch/strchr.c
+index ea9ac1134f4e..27c794c6b735 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/strchr.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/strchr.c
+@@ -35,7 +35,7 @@ extern __typeof (strchr) __strchr_power8 attribute_hidden;
+ libc_ifunc_redirected (__redirect_strchr, strchr,
+ (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+ ? __strchr_power8 :
+- (hwcap & PPC_FEATURE_HAS_VSX)
++ (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __strchr_power7
+ : __strchr_ppc);
+ weak_alias (strchr, index)
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/strchrnul.c b/sysdeps/powerpc/powerpc64/multiarch/strchrnul.c
+index 4688e7c3f0d4..4a07b4a2420e 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/strchrnul.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/strchrnul.c
+@@ -30,7 +30,7 @@ extern __typeof (__strchrnul) __strchrnul_power8 attribute_hidden;
+ libc_ifunc (__strchrnul,
+ (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+ ? __strchrnul_power8 :
+- (hwcap & PPC_FEATURE_HAS_VSX)
++ (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __strchrnul_power7
+ : __strchrnul_ppc);
+
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/strcmp.c b/sysdeps/powerpc/powerpc64/multiarch/strcmp.c
+index 72f9a639bfbf..4b0b25fff6ea 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/strcmp.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/strcmp.c
+@@ -40,7 +40,7 @@ libc_ifunc_redirected (__redirect_strcmp, strcmp,
+ # endif
+ (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+ ? __strcmp_power8
+- : (hwcap & PPC_FEATURE_HAS_VSX)
++ : (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __strcmp_power7
+ : __strcmp_ppc);
+ #endif
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/strlen.c b/sysdeps/powerpc/powerpc64/multiarch/strlen.c
+index 109c8a90bdfa..0cd1c6faff14 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/strlen.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/strlen.c
+@@ -42,7 +42,7 @@ libc_ifunc (__libc_strlen,
+ # endif
+ (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+ ? __strlen_power8 :
+- (hwcap & PPC_FEATURE_HAS_VSX)
++ (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __strlen_power7
+ : __strlen_ppc);
+
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/strncase.c b/sysdeps/powerpc/powerpc64/multiarch/strncase.c
+index 2013a5d75a54..644046bd742b 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/strncase.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/strncase.c
+@@ -29,7 +29,7 @@ extern __typeof (__strncasecmp) __strncasecmp_power8 attribute_hidden;
+ libc_ifunc (__libc_strncasecmp,
+ (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+ ? __strncasecmp_power8:
+- (hwcap & PPC_FEATURE_HAS_VSX)
++ (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __strncasecmp_power7
+ : __strncasecmp_ppc);
+
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/strncase_l.c b/sysdeps/powerpc/powerpc64/multiarch/strncase_l.c
+index cad6da302dbd..d2d761af7226 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/strncase_l.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/strncase_l.c
+@@ -34,7 +34,7 @@ extern __typeof (__strncasecmp_l) __strncasecmp_l_power7 attribute_hidden;
+ ifunc symbol properly. */
+ extern __typeof (__strncasecmp_l) __libc_strncasecmp_l;
+ libc_ifunc (__libc_strncasecmp_l,
+- (hwcap & PPC_FEATURE_HAS_VSX)
++ (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __strncasecmp_l_power7
+ : __strncasecmp_l_ppc);
+
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/strncmp.c b/sysdeps/powerpc/powerpc64/multiarch/strncmp.c
+index eef524ddfbd0..1f689e5c05c5 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/strncmp.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/strncmp.c
+@@ -43,7 +43,7 @@ libc_ifunc_redirected (__redirect_strncmp, strncmp,
+ # endif
+ (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+ ? __strncmp_power8
+- : (hwcap & PPC_FEATURE_HAS_VSX)
++ : (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __strncmp_power7
+ : (hwcap & PPC_FEATURE_POWER4)
+ ? __strncmp_power4
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/strncpy.c b/sysdeps/powerpc/powerpc64/multiarch/strncpy.c
+index 7da9def35862..d4d3463bd196 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/strncpy.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/strncpy.c
+@@ -43,7 +43,7 @@ libc_ifunc_redirected (__redirect_strncpy, strncpy,
+ # endif
+ (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+ ? __strncpy_power8
+- : (hwcap & PPC_FEATURE_HAS_VSX)
++ : (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __strncpy_power7
+ : __strncpy_ppc);
+
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/strnlen.c b/sysdeps/powerpc/powerpc64/multiarch/strnlen.c
+index 264b7a752d32..baf375a75a1c 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/strnlen.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/strnlen.c
+@@ -31,7 +31,7 @@ extern __typeof (__strnlen) __strnlen_power8 attribute_hidden;
+ libc_ifunc_redirected (__redirect___strnlen, __strnlen,
+ (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+ ? __strnlen_power8 :
+- (hwcap & PPC_FEATURE_HAS_VSX)
++ (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __strnlen_power7
+ : __strnlen_ppc);
+ weak_alias (__strnlen, strnlen)
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/strrchr.c b/sysdeps/powerpc/powerpc64/multiarch/strrchr.c
+index bb06b93d19a1..1c9eea1817f5 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/strrchr.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/strrchr.c
+@@ -33,7 +33,7 @@ extern __typeof (strrchr) __strrchr_power8 attribute_hidden;
+ libc_ifunc_redirected (__redirect_strrchr, strrchr,
+ (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+ ? __strrchr_power8 :
+- (hwcap & PPC_FEATURE_HAS_VSX)
++ (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __strrchr_power7
+ : __strrchr_ppc);
+ weak_alias (strrchr, rindex)
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/strstr.c b/sysdeps/powerpc/powerpc64/multiarch/strstr.c
+index bb0588844eeb..6582798dda75 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/strstr.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/strstr.c
+@@ -30,7 +30,7 @@ extern __typeof (strstr) __strstr_power7 attribute_hidden;
+ /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
+ ifunc symbol properly. */
+ libc_ifunc_redirected (__redirect_strstr, strstr,
+- (hwcap & PPC_FEATURE_HAS_VSX)
++ (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __strstr_power7
+ : __strstr_ppc);
+ #endif
+--
+2.32.0
+
--- /dev/null
+From 60b4dd25790342b40e8942e3a4115f511a6b6911 Mon Sep 17 00:00:00 2001
+From: Anton Blanchard <anton@ozlabs.org>
+Date: Tue, 27 Jul 2021 15:47:51 +1000
+Subject: [PATCH 3/3] powerpc64: Add checks for Altivec and VSX in ifunc
+ selection
+
+We'd like to support processors without Altivec or VSX, so check
+the relevant hwcap bits before selecting them.
+
+Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
+Signed-off-by: Joel Stanley <joel@jms.id.au>
+---
+ sysdeps/powerpc/powerpc64/multiarch/bzero.c | 6 +-
+ .../powerpc64/multiarch/ifunc-impl-list.c | 103 ++++++++++++------
+ sysdeps/powerpc/powerpc64/multiarch/memchr.c | 3 +-
+ sysdeps/powerpc/powerpc64/multiarch/memcmp.c | 3 +-
+ sysdeps/powerpc/powerpc64/multiarch/memcpy.c | 7 +-
+ sysdeps/powerpc/powerpc64/multiarch/memmove.c | 3 +-
+ sysdeps/powerpc/powerpc64/multiarch/mempcpy.c | 3 +-
+ sysdeps/powerpc/powerpc64/multiarch/memrchr.c | 3 +-
+ sysdeps/powerpc/powerpc64/multiarch/memset.c | 1 +
+ .../powerpc/powerpc64/multiarch/rawmemchr.c | 3 +-
+ sysdeps/powerpc/powerpc64/multiarch/stpcpy.c | 9 +-
+ .../powerpc/powerpc64/multiarch/strcasecmp.c | 3 +-
+ .../powerpc/powerpc64/multiarch/strcasestr.c | 3 +-
+ sysdeps/powerpc/powerpc64/multiarch/strcat.c | 6 +-
+ sysdeps/powerpc/powerpc64/multiarch/strchr.c | 3 +-
+ .../powerpc/powerpc64/multiarch/strchrnul.c | 3 +-
+ sysdeps/powerpc/powerpc64/multiarch/strcmp.c | 3 +-
+ sysdeps/powerpc/powerpc64/multiarch/strcpy.c | 9 +-
+ sysdeps/powerpc/powerpc64/multiarch/strcspn.c | 3 +-
+ sysdeps/powerpc/powerpc64/multiarch/strlen.c | 9 +-
+ .../powerpc/powerpc64/multiarch/strncase.c | 3 +-
+ sysdeps/powerpc/powerpc64/multiarch/strncat.c | 6 +-
+ sysdeps/powerpc/powerpc64/multiarch/strncmp.c | 3 +-
+ sysdeps/powerpc/powerpc64/multiarch/strnlen.c | 3 +-
+ sysdeps/powerpc/powerpc64/multiarch/strrchr.c | 3 +-
+ sysdeps/powerpc/powerpc64/multiarch/strspn.c | 3 +-
+ 26 files changed, 139 insertions(+), 68 deletions(-)
+
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/bzero.c b/sysdeps/powerpc/powerpc64/multiarch/bzero.c
+index 660d7dc686ec..c8ffbea01cda 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/bzero.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/bzero.c
+@@ -38,11 +38,13 @@ libc_ifunc (__bzero,
+ && hwcap & PPC_FEATURE_HAS_VSX)
+ ? __bzero_power10 :
+ # endif
+- (hwcap2 & PPC_FEATURE2_ARCH_2_07)
++ (hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC)
+ ? __bzero_power8 :
+ (hwcap & PPC_FEATURE_HAS_VSX)
+ ? __bzero_power7 :
+- (hwcap & PPC_FEATURE_ARCH_2_05)
++ (hwcap & PPC_FEATURE_ARCH_2_05
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC)
+ ? __bzero_power6 :
+ (hwcap & PPC_FEATURE_POWER4)
+ ? __bzero_power4
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
+index a3fdcd43bd58..c3e25c59814c 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
+@@ -60,9 +60,11 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ && hwcap & PPC_FEATURE_HAS_VSX,
+ __memcpy_power10)
+ #endif
+- IFUNC_IMPL_ADD (array, i, memcpy, hwcap2 & PPC_FEATURE2_ARCH_2_07,
++ IFUNC_IMPL_ADD (array, i, memcpy, hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC,
+ __memcpy_power8_cached)
+- IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_HAS_VSX,
++ IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_ARCH_2_06
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC,
+ __memcpy_power7)
+ IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_ARCH_2_06,
+ __memcpy_a2)
+@@ -83,7 +85,8 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ && hwcap & PPC_FEATURE_HAS_VSX,
+ __memmove_power10)
+ #endif
+- IFUNC_IMPL_ADD (array, i, memmove, hwcap & PPC_FEATURE_HAS_VSX,
++ IFUNC_IMPL_ADD (array, i, memmove, hwcap & PPC_FEATURE_ARCH_2_06
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC,
+ __memmove_power7)
+ IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_ppc))
+
+@@ -98,6 +101,7 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ __memset_power10)
+ #endif
+ IFUNC_IMPL_ADD (array, i, memset, hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC
+ && cacheline_size == 128,
+ __memset_power8)
+ IFUNC_IMPL_ADD (array, i, memset, hwcap & PPC_FEATURE_ARCH_2_06
+@@ -114,12 +118,15 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ /* Support sysdeps/powerpc/powerpc64/multiarch/strcpy.c. */
+ IFUNC_IMPL (i, name, strcpy,
+ #ifdef __LITTLE_ENDIAN__
+- IFUNC_IMPL_ADD (array, i, strcpy, hwcap2 & PPC_FEATURE2_ARCH_3_00,
++ IFUNC_IMPL_ADD (array, i, strcpy, hwcap2 & PPC_FEATURE2_ARCH_3_00
++ && hwcap & PPC_FEATURE_HAS_VSX,
+ __strcpy_power9)
+ #endif
+- IFUNC_IMPL_ADD (array, i, strcpy, hwcap2 & PPC_FEATURE2_ARCH_2_07,
++ IFUNC_IMPL_ADD (array, i, strcpy, hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC,
+ __strcpy_power8)
+- IFUNC_IMPL_ADD (array, i, strcpy, hwcap & PPC_FEATURE_HAS_VSX,
++ IFUNC_IMPL_ADD (array, i, strcpy, hwcap & PPC_FEATURE_ARCH_2_06
++ && hwcap & PPC_FEATURE_HAS_VSX,
+ __strcpy_power7)
+ IFUNC_IMPL_ADD (array, i, strcpy, 1,
+ __strcpy_ppc))
+@@ -127,12 +134,15 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ /* Support sysdeps/powerpc/powerpc64/multiarch/stpcpy.c. */
+ IFUNC_IMPL (i, name, stpcpy,
+ #ifdef __LITTLE_ENDIAN__
+- IFUNC_IMPL_ADD (array, i, stpcpy, hwcap2 & PPC_FEATURE2_ARCH_3_00,
++ IFUNC_IMPL_ADD (array, i, stpcpy, hwcap2 & PPC_FEATURE2_ARCH_3_00
++ && hwcap & PPC_FEATURE_HAS_VSX,
+ __stpcpy_power9)
+ #endif
+- IFUNC_IMPL_ADD (array, i, stpcpy, hwcap2 & PPC_FEATURE2_ARCH_2_07,
++ IFUNC_IMPL_ADD (array, i, stpcpy, hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC,
+ __stpcpy_power8)
+- IFUNC_IMPL_ADD (array, i, stpcpy, hwcap & PPC_FEATURE_HAS_VSX,
++ IFUNC_IMPL_ADD (array, i, stpcpy, hwcap & PPC_FEATURE_ARCH_2_06
++ && hwcap & PPC_FEATURE_HAS_VSX,
+ __stpcpy_power7)
+ IFUNC_IMPL_ADD (array, i, stpcpy, 1,
+ __stpcpy_ppc))
+@@ -140,12 +150,15 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ /* Support sysdeps/powerpc/powerpc64/multiarch/strlen.c. */
+ IFUNC_IMPL (i, name, strlen,
+ #ifdef __LITTLE_ENDIAN__
+- IFUNC_IMPL_ADD (array, i, strlen, hwcap2 & PPC_FEATURE2_ARCH_3_1,
++ IFUNC_IMPL_ADD (array, i, strlen, hwcap2 & PPC_FEATURE2_ARCH_3_1
++ && hwcap & PPC_FEATURE_HAS_VSX,
+ __strlen_power10)
+- IFUNC_IMPL_ADD (array, i, strlen, hwcap2 & PPC_FEATURE2_ARCH_3_00,
++ IFUNC_IMPL_ADD (array, i, strlen, hwcap2 & PPC_FEATURE2_ARCH_3_00
++ && hwcap & PPC_FEATURE_HAS_VSX,
+ __strlen_power9)
+ #endif
+- IFUNC_IMPL_ADD (array, i, strlen, hwcap2 & PPC_FEATURE2_ARCH_2_07,
++ IFUNC_IMPL_ADD (array, i, strlen, hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC,
+ __strlen_power8)
+ IFUNC_IMPL_ADD (array, i, strlen, hwcap & PPC_FEATURE_ARCH_2_06,
+ __strlen_power7)
+@@ -155,7 +168,8 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ /* Support sysdeps/powerpc/powerpc64/multiarch/strncmp.c. */
+ IFUNC_IMPL (i, name, strncmp,
+ #ifdef __LITTLE_ENDIAN__
+- IFUNC_IMPL_ADD (array, i, strncmp, hwcap2 & PPC_FEATURE2_ARCH_3_00,
++ IFUNC_IMPL_ADD (array, i, strncmp, hwcap2 & PPC_FEATURE2_ARCH_3_00
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC,
+ __strncmp_power9)
+ #endif
+ IFUNC_IMPL_ADD (array, i, strncmp, hwcap2 & PPC_FEATURE2_ARCH_2_07,
+@@ -170,7 +184,8 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ /* Support sysdeps/powerpc/powerpc64/multiarch/strchr.c. */
+ IFUNC_IMPL (i, name, strchr,
+ IFUNC_IMPL_ADD (array, i, strchr,
+- hwcap2 & PPC_FEATURE2_ARCH_2_07,
++ hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC,
+ __strchr_power8)
+ IFUNC_IMPL_ADD (array, i, strchr,
+ hwcap & PPC_FEATURE_ARCH_2_06,
+@@ -181,7 +196,8 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ /* Support sysdeps/powerpc/powerpc64/multiarch/strchrnul.c. */
+ IFUNC_IMPL (i, name, strchrnul,
+ IFUNC_IMPL_ADD (array, i, strchrnul,
+- hwcap2 & PPC_FEATURE2_ARCH_2_07,
++ hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC,
+ __strchrnul_power8)
+ IFUNC_IMPL_ADD (array, i, strchrnul,
+ hwcap & PPC_FEATURE_ARCH_2_06,
+@@ -198,7 +214,8 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ && hwcap & PPC_FEATURE_HAS_VSX,
+ __memcmp_power10)
+ #endif
+- IFUNC_IMPL_ADD (array, i, memcmp, hwcap2 & PPC_FEATURE2_ARCH_2_07,
++ IFUNC_IMPL_ADD (array, i, memcmp, hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC,
+ __memcmp_power8)
+ IFUNC_IMPL_ADD (array, i, memcmp, hwcap & PPC_FEATURE_ARCH_2_06,
+ __memcmp_power7)
+@@ -215,11 +232,13 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ && hwcap & PPC_FEATURE_HAS_VSX,
+ __bzero_power10)
+ #endif
+- IFUNC_IMPL_ADD (array, i, bzero, hwcap2 & PPC_FEATURE2_ARCH_2_07,
++ IFUNC_IMPL_ADD (array, i, bzero, hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC,
+ __bzero_power8)
+ IFUNC_IMPL_ADD (array, i, bzero, hwcap & PPC_FEATURE_HAS_VSX,
+ __bzero_power7)
+- IFUNC_IMPL_ADD (array, i, bzero, hwcap & PPC_FEATURE_ARCH_2_05,
++ IFUNC_IMPL_ADD (array, i, bzero, hwcap & PPC_FEATURE_ARCH_2_05
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC,
+ __bzero_power6)
+ IFUNC_IMPL_ADD (array, i, bzero, hwcap & PPC_FEATURE_POWER4,
+ __bzero_power4)
+@@ -241,7 +260,8 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ /* Support sysdeps/powerpc/powerpc64/multiarch/mempcpy.c. */
+ IFUNC_IMPL (i, name, mempcpy,
+ IFUNC_IMPL_ADD (array, i, mempcpy,
+- hwcap & PPC_FEATURE_HAS_VSX,
++ hwcap & PPC_FEATURE_ARCH_2_06
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC,
+ __mempcpy_power7)
+ IFUNC_IMPL_ADD (array, i, mempcpy, 1,
+ __mempcpy_ppc))
+@@ -249,7 +269,8 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ /* Support sysdeps/powerpc/powerpc64/multiarch/memchr.c. */
+ IFUNC_IMPL (i, name, memchr,
+ IFUNC_IMPL_ADD (array, i, memchr,
+- hwcap2 & PPC_FEATURE2_ARCH_2_07,
++ hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC,
+ __memchr_power8)
+ IFUNC_IMPL_ADD (array, i, memchr,
+ hwcap & PPC_FEATURE_ARCH_2_06,
+@@ -260,7 +281,8 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ /* Support sysdeps/powerpc/powerpc64/multiarch/memrchr.c. */
+ IFUNC_IMPL (i, name, memrchr,
+ IFUNC_IMPL_ADD (array, i, memrchr,
+- hwcap2 & PPC_FEATURE2_ARCH_2_07,
++ hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC,
+ __memrchr_power8)
+ IFUNC_IMPL_ADD (array, i, memrchr,
+ hwcap & PPC_FEATURE_ARCH_2_06,
+@@ -276,7 +298,8 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ && (hwcap & PPC_FEATURE_HAS_VSX),
+ __rawmemchr_power10)
+ IFUNC_IMPL_ADD (array, i, rawmemchr,
+- hwcap2 & PPC_FEATURE2_ARCH_3_00,
++ hwcap2 & PPC_FEATURE2_ARCH_3_00
++ && hwcap & PPC_FEATURE_HAS_VSX,
+ __rawmemchr_power9)
+ #endif
+ IFUNC_IMPL_ADD (array, i, rawmemchr,
+@@ -288,7 +311,8 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ /* Support sysdeps/powerpc/powerpc64/multiarch/strnlen.c. */
+ IFUNC_IMPL (i, name, strnlen,
+ IFUNC_IMPL_ADD (array, i, strnlen,
+- hwcap2 & PPC_FEATURE2_ARCH_2_07,
++ hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC,
+ __strnlen_power8)
+ IFUNC_IMPL_ADD (array, i, strnlen, hwcap & PPC_FEATURE_ARCH_2_06,
+ __strnlen_power7)
+@@ -298,7 +322,8 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ /* Support sysdeps/powerpc/powerpc64/multiarch/strcasecmp.c. */
+ IFUNC_IMPL (i, name, strcasecmp,
+ IFUNC_IMPL_ADD (array, i, strcasecmp,
+- hwcap2 & PPC_FEATURE2_ARCH_2_07,
++ hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC,
+ __strcasecmp_power8)
+ IFUNC_IMPL_ADD (array, i, strcasecmp,
+ hwcap & PPC_FEATURE_ARCH_2_06,
+@@ -316,7 +341,8 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ /* Support sysdeps/powerpc/powerpc64/multiarch/strncase.c. */
+ IFUNC_IMPL (i, name, strncasecmp,
+ IFUNC_IMPL_ADD (array, i, strncasecmp,
+- hwcap2 & PPC_FEATURE2_ARCH_2_07,
++ hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC,
+ __strncasecmp_power8)
+ IFUNC_IMPL_ADD (array, i, strncasecmp,
+ hwcap & PPC_FEATURE_ARCH_2_06,
+@@ -334,7 +360,8 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ /* Support sysdeps/powerpc/powerpc64/multiarch/strrchr.c. */
+ IFUNC_IMPL (i, name, strrchr,
+ IFUNC_IMPL_ADD (array, i, strrchr,
+- hwcap2 & PPC_FEATURE2_ARCH_2_07,
++ hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC,
+ __strrchr_power8)
+ IFUNC_IMPL_ADD (array, i, strrchr,
+ hwcap & PPC_FEATURE_ARCH_2_06,
+@@ -345,10 +372,12 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ /* Support sysdeps/powerpc/powerpc64/multiarch/strncat.c. */
+ IFUNC_IMPL (i, name, strncat,
+ IFUNC_IMPL_ADD (array, i, strncat,
+- hwcap2 & PPC_FEATURE2_ARCH_2_07,
++ hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_VSX,
+ __strncat_power8)
+ IFUNC_IMPL_ADD (array, i, strncat,
+- hwcap & PPC_FEATURE_HAS_VSX,
++ hwcap & PPC_FEATURE_ARCH_2_06
++ && hwcap & PPC_FEATURE_HAS_VSX,
+ __strncat_power7)
+ IFUNC_IMPL_ADD (array, i, strncat, 1,
+ __strncat_ppc))
+@@ -391,7 +420,8 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ IFUNC_IMPL (i, name, strcmp,
+ #ifdef __LITTLE_ENDIAN__
+ IFUNC_IMPL_ADD (array, i, strcmp,
+- hwcap2 & PPC_FEATURE2_ARCH_3_00,
++ hwcap2 & PPC_FEATURE2_ARCH_3_00
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC,
+ __strcmp_power9)
+ #endif
+ IFUNC_IMPL_ADD (array, i, strcmp,
+@@ -406,10 +436,12 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ /* Support sysdeps/powerpc/powerpc64/multiarch/strcat.c. */
+ IFUNC_IMPL (i, name, strcat,
+ IFUNC_IMPL_ADD (array, i, strcat,
+- hwcap2 & PPC_FEATURE2_ARCH_2_07,
++ hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_VSX,
+ __strcat_power8)
+ IFUNC_IMPL_ADD (array, i, strcat,
+- hwcap & PPC_FEATURE_HAS_VSX,
++ hwcap & PPC_FEATURE_ARCH_2_06
++ && hwcap & PPC_FEATURE_HAS_VSX,
+ __strcat_power7)
+ IFUNC_IMPL_ADD (array, i, strcat, 1,
+ __strcat_ppc))
+@@ -417,7 +449,8 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ /* Support sysdeps/powerpc/powerpc64/multiarch/strspn.c. */
+ IFUNC_IMPL (i, name, strspn,
+ IFUNC_IMPL_ADD (array, i, strspn,
+- hwcap2 & PPC_FEATURE2_ARCH_2_07,
++ hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_VSX,
+ __strspn_power8)
+ IFUNC_IMPL_ADD (array, i, strspn, 1,
+ __strspn_ppc))
+@@ -425,7 +458,8 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ /* Support sysdeps/powerpc/powerpc64/multiarch/strcspn.c. */
+ IFUNC_IMPL (i, name, strcspn,
+ IFUNC_IMPL_ADD (array, i, strcspn,
+- hwcap2 & PPC_FEATURE2_ARCH_2_07,
++ hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_VSX,
+ __strcspn_power8)
+ IFUNC_IMPL_ADD (array, i, strcspn, 1,
+ __strcspn_ppc))
+@@ -442,7 +476,8 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+ /* Support sysdeps/powerpc/powerpc64/multiarch/strcasestr.c. */
+ IFUNC_IMPL (i, name, strcasestr,
+ IFUNC_IMPL_ADD (array, i, strcasestr,
+- hwcap2 & PPC_FEATURE2_ARCH_2_07,
++ hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC,
+ __strcasestr_power8)
+ IFUNC_IMPL_ADD (array, i, strcasestr, 1,
+ __strcasestr_ppc))
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/memchr.c b/sysdeps/powerpc/powerpc64/multiarch/memchr.c
+index c24186689e59..f40013e06113 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/memchr.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/memchr.c
+@@ -28,7 +28,8 @@ extern __typeof (__memchr) __memchr_power8 attribute_hidden;
+ /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
+ ifunc symbol properly. */
+ libc_ifunc (__memchr,
+- (hwcap2 & PPC_FEATURE2_ARCH_2_07)
++ (hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC)
+ ? __memchr_power8 :
+ (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __memchr_power7
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/memcmp.c b/sysdeps/powerpc/powerpc64/multiarch/memcmp.c
+index 99559bce26f9..89b56c103bbf 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/memcmp.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/memcmp.c
+@@ -38,7 +38,8 @@ libc_ifunc_redirected (__redirect_memcmp, memcmp,
+ && hwcap & PPC_FEATURE_HAS_VSX)
+ ? __memcmp_power10 :
+ #endif
+- (hwcap2 & PPC_FEATURE2_ARCH_2_07)
++ (hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC)
+ ? __memcmp_power8 :
+ (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __memcmp_power7
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/memcpy.c b/sysdeps/powerpc/powerpc64/multiarch/memcpy.c
+index 53ab32ef26c7..684ee064f23f 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/memcpy.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/memcpy.c
+@@ -45,9 +45,12 @@ libc_ifunc (__libc_memcpy,
+ (hwcap2 & PPC_FEATURE2_ARCH_3_1 && hwcap & PPC_FEATURE_HAS_VSX)
+ ? __memcpy_power10 :
+ # endif
+- ((hwcap2 & PPC_FEATURE2_ARCH_2_07) && use_cached_memopt)
++ (hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC
++ && use_cached_memopt)
+ ? __memcpy_power8_cached :
+- (hwcap & PPC_FEATURE_HAS_VSX)
++ (hwcap & PPC_FEATURE_ARCH_2_06
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC)
+ ? __memcpy_power7 :
+ (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __memcpy_a2 :
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/memmove.c b/sysdeps/powerpc/powerpc64/multiarch/memmove.c
+index 637b2cbf7f35..50253b4554f9 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/memmove.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/memmove.c
+@@ -41,7 +41,8 @@ libc_ifunc (__libc_memmove,
+ && hwcap & PPC_FEATURE_HAS_VSX)
+ ? __memmove_power10 :
+ #endif
+- (hwcap & PPC_FEATURE_HAS_VSX)
++ (hwcap & PPC_FEATURE_ARCH_2_06
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC)
+ ? __memmove_power7
+ : __memmove_ppc);
+
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/mempcpy.c b/sysdeps/powerpc/powerpc64/multiarch/mempcpy.c
+index b37e0f35b504..563095a5ec98 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/mempcpy.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/mempcpy.c
+@@ -33,7 +33,8 @@ extern __typeof (__mempcpy) __mempcpy_power7 attribute_hidden;
+ /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
+ ifunc symbol properly. */
+ libc_ifunc_redirected (__redirect___mempcpy, __mempcpy,
+- (hwcap & PPC_FEATURE_HAS_VSX)
++ (hwcap & PPC_FEATURE_ARCH_2_06
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC)
+ ? __mempcpy_power7
+ : __mempcpy_ppc);
+
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/memrchr.c b/sysdeps/powerpc/powerpc64/multiarch/memrchr.c
+index 16bb6f004214..a8b985b06a89 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/memrchr.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/memrchr.c
+@@ -28,7 +28,8 @@ extern __typeof (__memrchr) __memrchr_power8 attribute_hidden;
+ /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
+ ifunc symbol properly. */
+ libc_ifunc (__memrchr,
+- (hwcap2 & PPC_FEATURE2_ARCH_2_07)
++ (hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC)
+ ? __memrchr_power8 :
+ (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __memrchr_power7
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/memset.c b/sysdeps/powerpc/powerpc64/multiarch/memset.c
+index 056e911699b2..a2bc223bcc91 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/memset.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/memset.c
+@@ -48,6 +48,7 @@ libc_ifunc (__libc_memset,
+ ? __memset_power10 :
+ # endif
+ (hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC
+ && GLRO(dl_cache_line_size) == 128)
+ ? __memset_power8 :
+ (hwcap & PPC_FEATURE_ARCH_2_06
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/rawmemchr.c b/sysdeps/powerpc/powerpc64/multiarch/rawmemchr.c
+index b5d2d3a63542..43eb459e025d 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/rawmemchr.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/rawmemchr.c
+@@ -38,7 +38,8 @@ libc_ifunc_redirected (__redirect___rawmemchr, __rawmemchr,
+ (hwcap2 & PPC_FEATURE2_ARCH_3_1)
+ && (hwcap & PPC_FEATURE_HAS_VSX)
+ ? __rawmemchr_power10 :
+- (hwcap2 & PPC_FEATURE2_ARCH_3_00)
++ (hwcap2 & PPC_FEATURE2_ARCH_3_00
++ && hwcap & PPC_FEATURE_HAS_VSX)
+ ? __rawmemchr_power9 :
+ # endif
+ (hwcap & PPC_FEATURE_ARCH_2_06)
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/stpcpy.c b/sysdeps/powerpc/powerpc64/multiarch/stpcpy.c
+index d4eb4285fc3f..5be413405ee8 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/stpcpy.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/stpcpy.c
+@@ -32,12 +32,15 @@ extern __typeof (__stpcpy) __stpcpy_power9 attribute_hidden;
+
+ libc_ifunc_hidden (__stpcpy, __stpcpy,
+ # ifdef __LITTLE_ENDIAN__
+- (hwcap2 & PPC_FEATURE2_ARCH_3_00)
++ (hwcap2 & PPC_FEATURE2_ARCH_3_00
++ && hwcap & PPC_FEATURE_HAS_VSX)
+ ? __stpcpy_power9 :
+ # endif
+- (hwcap2 & PPC_FEATURE2_ARCH_2_07)
++ (hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC)
+ ? __stpcpy_power8
+- : (hwcap & PPC_FEATURE_HAS_VSX)
++ : (hwcap & PPC_FEATURE_ARCH_2_06
++ && hwcap & PPC_FEATURE_HAS_VSX)
+ ? __stpcpy_power7
+ : __stpcpy_ppc);
+
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/strcasecmp.c b/sysdeps/powerpc/powerpc64/multiarch/strcasecmp.c
+index 55ca6c85c416..21ce2d279b99 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/strcasecmp.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/strcasecmp.c
+@@ -27,7 +27,8 @@ extern __typeof (__strcasecmp) __strcasecmp_power7 attribute_hidden;
+ extern __typeof (__strcasecmp) __strcasecmp_power8 attribute_hidden;
+
+ libc_ifunc (__libc_strcasecmp,
+- (hwcap2 & PPC_FEATURE2_ARCH_2_07)
++ (hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC)
+ ? __strcasecmp_power8:
+ (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __strcasecmp_power7
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/strcasestr.c b/sysdeps/powerpc/powerpc64/multiarch/strcasestr.c
+index 7e4bd3b5ac98..5bb301602288 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/strcasestr.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/strcasestr.c
+@@ -27,7 +27,8 @@ extern __typeof (__strcasestr) __strcasestr_power8 attribute_hidden;
+ /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
+ ifunc symbol properly. */
+ libc_ifunc (__strcasestr,
+- (hwcap2 & PPC_FEATURE2_ARCH_2_07)
++ (hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC)
+ ? __strcasestr_power8
+ : __strcasestr_ppc);
+
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/strcat.c b/sysdeps/powerpc/powerpc64/multiarch/strcat.c
+index 6d342324c4de..d8d98708249f 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/strcat.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/strcat.c
+@@ -28,9 +28,11 @@ extern __typeof (strcat) __strcat_power8 attribute_hidden;
+ # undef strcat
+
+ libc_ifunc_redirected (__redirect_strcat, strcat,
+- (hwcap2 & PPC_FEATURE2_ARCH_2_07)
++ (hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_VSX)
+ ? __strcat_power8
+- : (hwcap & PPC_FEATURE_HAS_VSX)
++ : (hwcap & PPC_FEATURE_ARCH_2_06
++ && hwcap & PPC_FEATURE_HAS_VSX)
+ ? __strcat_power7
+ : __strcat_ppc);
+ #endif
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/strchr.c b/sysdeps/powerpc/powerpc64/multiarch/strchr.c
+index 27c794c6b735..62b202baf908 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/strchr.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/strchr.c
+@@ -33,7 +33,8 @@ extern __typeof (strchr) __strchr_power8 attribute_hidden;
+ /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
+ ifunc symbol properly. */
+ libc_ifunc_redirected (__redirect_strchr, strchr,
+- (hwcap2 & PPC_FEATURE2_ARCH_2_07)
++ (hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC)
+ ? __strchr_power8 :
+ (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __strchr_power7
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/strchrnul.c b/sysdeps/powerpc/powerpc64/multiarch/strchrnul.c
+index 4a07b4a2420e..40e529b9d984 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/strchrnul.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/strchrnul.c
+@@ -28,7 +28,8 @@ extern __typeof (__strchrnul) __strchrnul_power8 attribute_hidden;
+ /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
+ ifunc symbol properly. */
+ libc_ifunc (__strchrnul,
+- (hwcap2 & PPC_FEATURE2_ARCH_2_07)
++ (hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC)
+ ? __strchrnul_power8 :
+ (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __strchrnul_power7
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/strcmp.c b/sysdeps/powerpc/powerpc64/multiarch/strcmp.c
+index 4b0b25fff6ea..8132682a992e 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/strcmp.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/strcmp.c
+@@ -35,7 +35,8 @@ extern __typeof (strcmp) __strcmp_power9 attribute_hidden;
+
+ libc_ifunc_redirected (__redirect_strcmp, strcmp,
+ # ifdef __LITTLE_ENDIAN__
+- (hwcap2 & PPC_FEATURE2_ARCH_3_00)
++ (hwcap2 & PPC_FEATURE2_ARCH_3_00
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC)
+ ? __strcmp_power9 :
+ # endif
+ (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/strcpy.c b/sysdeps/powerpc/powerpc64/multiarch/strcpy.c
+index b733fa5a239c..5af1d45cc17b 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/strcpy.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/strcpy.c
+@@ -32,12 +32,15 @@ extern __typeof (strcpy) __strcpy_power9 attribute_hidden;
+
+ libc_ifunc_redirected (__redirect_strcpy, strcpy,
+ # ifdef __LITTLE_ENDIAN__
+- (hwcap2 & PPC_FEATURE2_ARCH_3_00)
++ (hwcap2 & PPC_FEATURE2_ARCH_3_00
++ && hwcap & PPC_FEATURE_HAS_VSX)
+ ? __strcpy_power9 :
+ # endif
+- (hwcap2 & PPC_FEATURE2_ARCH_2_07)
++ (hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC)
+ ? __strcpy_power8
+- : (hwcap & PPC_FEATURE_HAS_VSX)
++ : (hwcap & PPC_FEATURE_ARCH_2_06
++ && hwcap & PPC_FEATURE_HAS_VSX)
+ ? __strcpy_power7
+ : __strcpy_ppc);
+ #endif
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/strcspn.c b/sysdeps/powerpc/powerpc64/multiarch/strcspn.c
+index 683aa104d709..8ba01c13b179 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/strcspn.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/strcspn.c
+@@ -27,7 +27,8 @@ extern __typeof (strcspn) __strcspn_ppc attribute_hidden;
+ extern __typeof (strcspn) __strcspn_power8 attribute_hidden;
+
+ libc_ifunc (__libc_strcspn,
+- (hwcap2 & PPC_FEATURE2_ARCH_2_07)
++ (hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_VSX)
+ ? __strcspn_power8
+ : __strcspn_ppc);
+
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/strlen.c b/sysdeps/powerpc/powerpc64/multiarch/strlen.c
+index 0cd1c6faff14..f1e28414e0e5 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/strlen.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/strlen.c
+@@ -35,12 +35,15 @@ extern __typeof (__redirect_strlen) __strlen_power10 attribute_hidden;
+
+ libc_ifunc (__libc_strlen,
+ # ifdef __LITTLE_ENDIAN__
+- (hwcap2 & PPC_FEATURE2_ARCH_3_1)
++ (hwcap2 & PPC_FEATURE2_ARCH_3_1
++ && hwcap & PPC_FEATURE_HAS_VSX)
+ ? __strlen_power10 :
+- (hwcap2 & PPC_FEATURE2_ARCH_3_00)
++ (hwcap2 & PPC_FEATURE2_ARCH_3_00
++ && hwcap & PPC_FEATURE_HAS_VSX)
+ ? __strlen_power9 :
+ # endif
+- (hwcap2 & PPC_FEATURE2_ARCH_2_07)
++ (hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC)
+ ? __strlen_power8 :
+ (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __strlen_power7
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/strncase.c b/sysdeps/powerpc/powerpc64/multiarch/strncase.c
+index 644046bd742b..2802cf2c3f38 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/strncase.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/strncase.c
+@@ -27,7 +27,8 @@ extern __typeof (__strncasecmp) __strncasecmp_power7 attribute_hidden;
+ extern __typeof (__strncasecmp) __strncasecmp_power8 attribute_hidden;
+
+ libc_ifunc (__libc_strncasecmp,
+- (hwcap2 & PPC_FEATURE2_ARCH_2_07)
++ (hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC)
+ ? __strncasecmp_power8:
+ (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __strncasecmp_power7
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/strncat.c b/sysdeps/powerpc/powerpc64/multiarch/strncat.c
+index 0036fca91a1b..9ea294a72db2 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/strncat.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/strncat.c
+@@ -26,9 +26,11 @@ extern __typeof (strncat) __strncat_power7 attribute_hidden;
+ extern __typeof (strncat) __strncat_power8 attribute_hidden;
+
+ libc_ifunc (strncat,
+- (hwcap2 & PPC_FEATURE2_ARCH_2_07)
++ (hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_VSX)
+ ? __strncat_power8
+- : (hwcap & PPC_FEATURE_HAS_VSX)
++ : (hwcap & PPC_FEATURE_ARCH_2_06
++ && hwcap & PPC_FEATURE_HAS_VSX)
+ ? __strncat_power7
+ : __strncat_ppc);
+ #endif
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/strncmp.c b/sysdeps/powerpc/powerpc64/multiarch/strncmp.c
+index 1f689e5c05c5..2d2112285445 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/strncmp.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/strncmp.c
+@@ -38,7 +38,8 @@ extern __typeof (strncmp) __strncmp_power9 attribute_hidden;
+ ifunc symbol properly. */
+ libc_ifunc_redirected (__redirect_strncmp, strncmp,
+ # ifdef __LITTLE_ENDIAN__
+- (hwcap2 & PPC_FEATURE2_ARCH_3_00)
++ (hwcap2 & PPC_FEATURE2_ARCH_3_00
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC)
+ ? __strncmp_power9 :
+ # endif
+ (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/strnlen.c b/sysdeps/powerpc/powerpc64/multiarch/strnlen.c
+index baf375a75a1c..e68e9d9f8818 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/strnlen.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/strnlen.c
+@@ -29,7 +29,8 @@ extern __typeof (__strnlen) __strnlen_power8 attribute_hidden;
+ # undef strnlen
+ # undef __strnlen
+ libc_ifunc_redirected (__redirect___strnlen, __strnlen,
+- (hwcap2 & PPC_FEATURE2_ARCH_2_07)
++ (hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC)
+ ? __strnlen_power8 :
+ (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __strnlen_power7
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/strrchr.c b/sysdeps/powerpc/powerpc64/multiarch/strrchr.c
+index 1c9eea1817f5..7f0cf2a1b754 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/strrchr.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/strrchr.c
+@@ -31,7 +31,8 @@ extern __typeof (strrchr) __strrchr_power8 attribute_hidden;
+ /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
+ ifunc symbol properly. */
+ libc_ifunc_redirected (__redirect_strrchr, strrchr,
+- (hwcap2 & PPC_FEATURE2_ARCH_2_07)
++ (hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_ALTIVEC)
+ ? __strrchr_power8 :
+ (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __strrchr_power7
+diff --git a/sysdeps/powerpc/powerpc64/multiarch/strspn.c b/sysdeps/powerpc/powerpc64/multiarch/strspn.c
+index 70167a176bc2..7613ab3d55df 100644
+--- a/sysdeps/powerpc/powerpc64/multiarch/strspn.c
++++ b/sysdeps/powerpc/powerpc64/multiarch/strspn.c
+@@ -27,7 +27,8 @@ extern __typeof (strspn) __strspn_ppc attribute_hidden;
+ extern __typeof (strspn) __strspn_power8 attribute_hidden;
+
+ libc_ifunc (__libc_strspn,
+- (hwcap2 & PPC_FEATURE2_ARCH_2_07)
++ (hwcap2 & PPC_FEATURE2_ARCH_2_07
++ && hwcap & PPC_FEATURE_HAS_VSX)
+ ? __strspn_power8
+ : __strspn_ppc);
+
+--
+2.32.0
+