summary refs log tree commit diff
path: root/sysdeps/x86_64/multiarch/ifunc-impl-list.c
diff options
context:
space:
mode:
authorNoah Goldstein <goldstein.w.n@gmail.com>2022-07-13 16:33:00 -0700
committerNoah Goldstein <goldstein.w.n@gmail.com>2022-07-16 03:07:59 -0700
commit192979ee351315b84ff4277d0985f26243717cd7 (patch)
treea62f2737cc82add1047d89ef9e89984849a6de8d /sysdeps/x86_64/multiarch/ifunc-impl-list.c
parentceabdcd130ca7043b0fcf2676183d79431d10493 (diff)
downloadglibc-192979ee351315b84ff4277d0985f26243717cd7.tar.gz
glibc-192979ee351315b84ff4277d0985f26243717cd7.tar.xz
glibc-192979ee351315b84ff4277d0985f26243717cd7.zip
x86: Add support to build wcscpy with explicit ISA level
1. Add ISA level build guards to different implementations.
    - wcscpy-ssse3.S is used as ISA level 2/3/4.
    - wcscpy-generic.c is only used at ISA level 1 and will
      only build if compiled with ISA level == 1. Otherwise
      there is no reason to include it as we will always use
      wcscpy-ssse3.S

2. Refactor the ifunc selector and ifunc implementation list to use
   the ISA level aware wrapper macros that allow functions below the
   compiled ISA level (with a guranteed replacement) to be skipped.

Tested with and without multiarch on x86_64 for ISA levels:
{generic, x86-64-v2, x86-64-v3, x86-64-v4}

And m32 with and without multiarch.
Diffstat (limited to 'sysdeps/x86_64/multiarch/ifunc-impl-list.c')
-rw-r--r--sysdeps/x86_64/multiarch/ifunc-impl-list.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sysdeps/x86_64/multiarch/ifunc-impl-list.c b/sysdeps/x86_64/multiarch/ifunc-impl-list.c
index 3b1df9b73c..9318e98cc8 100644
--- a/sysdeps/x86_64/multiarch/ifunc-impl-list.c
+++ b/sysdeps/x86_64/multiarch/ifunc-impl-list.c
@@ -791,9 +791,15 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
 
   /* Support sysdeps/x86_64/multiarch/wcscpy.c.  */
   IFUNC_IMPL (i, name, wcscpy,
-	      IFUNC_IMPL_ADD (array, i, wcscpy, CPU_FEATURE_USABLE (SSSE3),
-			      __wcscpy_ssse3)
-	      IFUNC_IMPL_ADD (array, i, wcscpy, 1, __wcscpy_generic))
+	      /* ISA V4 wrapper for SSSE3 implementation because
+	         the SSSE3 implementation is also used at ISA
+	         level 3/4.  */
+	      X86_IFUNC_IMPL_ADD_V4 (array, i, wcscpy,
+				     CPU_FEATURE_USABLE (SSSE3),
+				     __wcscpy_ssse3)
+	      X86_IFUNC_IMPL_ADD_V1 (array, i, wcscpy,
+				     1,
+				     __wcscpy_generic))
 
   /* Support sysdeps/x86_64/multiarch/wcslen.c.  */
   IFUNC_IMPL (i, name, wcslen,