From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-xb2a.google.com (mail-yb1-xb2a.google.com [IPv6:2607:f8b0:4864:20::b2a]) by sourceware.org (Postfix) with ESMTPS id 5744A38515CD for ; Thu, 30 Jun 2022 03:27:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5744A38515CD Received: by mail-yb1-xb2a.google.com with SMTP id l11so31444653ybu.13 for ; Wed, 29 Jun 2022 20:27:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=nUWDnRHgsMCJS4/4TigP7X9a0v/z2Q0uCKk0nBt0NHA=; b=wtjXSNwJwp+EapAz1xc/Tz8cBXQHd7X+S1JSKKSvMQ/NzUL5+015lTvEKNIpZdI1L7 6lv2f9hu+aqlsdpFE7lmyH4dytNnJCA22l0u7IE9nF4srNKJEsXUTEmo8c673y8hC5oh jA5yQz4AH8vzT3HE+icjHFNUgo3BPsfapnfggKUFWdfRfDnLeRSVk3kKXP85bB9aXhYS 2pWXFz2pfGudRexNynuZzb2ubFbNHH+hgZU+ODOTF6uNYykVSzX7G/oD2eMGLHbC9NPo flYvHWqBOMZSevHqh8a0TMCzkw8obUXiGyafI+lhmCcoEz3amWxz3FwsGddkzjzmeFVO BnkQ== X-Gm-Message-State: AJIora/EsF2ThSYQS8mMUzYtfSRrDQpX/Kja3Ge8VtyAFSVORbWUic0+ g4hervvaI9WaNo+fnwvH/j9YK8oDJQNcSD88fnpiPCOsshk= X-Google-Smtp-Source: AGRyM1uOMm0tJPt3ssaMa4bQwW/jEUlDxWvVAEDfzwVosZi2nIuVMIjkLq0vCHda7MfR1ulP4R212ksUAlVxpNeTGSM= X-Received: by 2002:a25:b9c3:0:b0:668:a418:13c with SMTP id y3-20020a25b9c3000000b00668a418013cmr7250379ybj.498.1656559678517; Wed, 29 Jun 2022 20:27:58 -0700 (PDT) MIME-Version: 1.0 References: <20220628152717.17838-1-goldstein.w.n@gmail.com> <20220629220552.1241553-1-goldstein.w.n@gmail.com> <20220629220552.1241553-2-goldstein.w.n@gmail.com> In-Reply-To: From: Noah Goldstein Date: Wed, 29 Jun 2022 20:27:47 -0700 Message-ID: Subject: Re: [PATCH v2 2/2] x86: Add support for building str{c|p}{brk|spn} with explicit ISA level To: "H.J. Lu" Cc: GNU C Library , "Carlos O'Donell" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2022 03:28:02 -0000 On Wed, Jun 29, 2022 at 8:11 PM Noah Goldstein wrote: > > On Wed, Jun 29, 2022 at 3:16 PM H.J. Lu wrote: > > > > On Wed, Jun 29, 2022 at 3:05 PM Noah Goldstein wrote: > > > > > > The changes for these functions are different than the others because > > > the best implementation (sse4_2) requires the generic > > > implementation as a fallback to be built as well. > > > > > > Changes are: > > > > > > 1. Add non-multiarch functions for str{c|p}{brk|spn}.c to statically > > > select the best implementation based on the configured ISA build > > > level. > > > > > > 2. Add stubs for str{c|p}{brk|spn}-generic and varshift.c to in the > > > sysdeps/x86_64 directory so that the the sse4 implementation will > > > have all of its dependencies for the non-multiarch / rtld build > > > when ISA level >= 2. > > > > > > 3. Add new multiarch/rtld-strcspn.c that just include the > > > non-multiarch strcspn.c which will in turn select the best > > > implementation based on the compiled ISA level. > > > > > > 4. 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. > > > --- > > > sysdeps/x86_64/Makefile | 9 +++++++- > > > sysdeps/x86_64/multiarch/ifunc-impl-list.c | 6 +++++ > > > sysdeps/x86_64/multiarch/ifunc-sse4_2.h | 2 +- > > > sysdeps/x86_64/multiarch/rtld-strcspn.c | 18 +++++++++++++++ > > > sysdeps/x86_64/multiarch/strcspn-generic.c | 6 +++-- > > > sysdeps/x86_64/multiarch/strcspn-sse4.c | 6 +++-- > > > sysdeps/x86_64/multiarch/strpbrk-generic.c | 5 +++- > > > sysdeps/x86_64/multiarch/strpbrk-sse4.c | 6 ++++- > > > sysdeps/x86_64/multiarch/strspn-generic.c | 7 ++++-- > > > sysdeps/x86_64/multiarch/strspn-sse4.c | 5 +++- > > > sysdeps/x86_64/strcspn-generic.c | 25 ++++++++++++++++++++ > > > sysdeps/x86_64/strcspn.c | 27 ++++++++++++++++++++++ > > > sysdeps/x86_64/strpbrk-generic.c | 25 ++++++++++++++++++++ > > > sysdeps/x86_64/strpbrk.c | 27 ++++++++++++++++++++++ > > > sysdeps/x86_64/strspn-generic.c | 26 +++++++++++++++++++++ > > > sysdeps/x86_64/strspn.c | 27 ++++++++++++++++++++++ > > > sysdeps/x86_64/varshift.c | 26 +++++++++++++++++++++ > > > 17 files changed, 242 insertions(+), 11 deletions(-) > > > create mode 100644 sysdeps/x86_64/multiarch/rtld-strcspn.c > > > create mode 100644 sysdeps/x86_64/strcspn-generic.c > > > create mode 100644 sysdeps/x86_64/strcspn.c > > > create mode 100644 sysdeps/x86_64/strpbrk-generic.c > > > create mode 100644 sysdeps/x86_64/strpbrk.c > > > create mode 100644 sysdeps/x86_64/strspn-generic.c > > > create mode 100644 sysdeps/x86_64/strspn.c > > > create mode 100644 sysdeps/x86_64/varshift.c > > > > > > diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile > > > index 79365aff2a..e597a4855f 100644 > > > --- a/sysdeps/x86_64/Makefile > > > +++ b/sysdeps/x86_64/Makefile > > > @@ -14,7 +14,14 @@ sysdep_noprof += _mcount > > > endif > > > > > > ifeq ($(subdir),string) > > > -sysdep_routines += strcasecmp_l-nonascii strncase_l-nonascii > > > +sysdep_routines += \ > > > + strcasecmp_l-nonascii \ > > > + strcspn-generic \ > > > + strncase_l-nonascii \ > > > + strpbrk-generic \ > > > + strspn-generic \ > > > + varshift \ > > > +# sysdep_routines > > > gen-as-const-headers += locale-defines.sym > > > tests += \ > > > tst-rsi-strlen > > > diff --git a/sysdeps/x86_64/multiarch/ifunc-impl-list.c b/sysdeps/x86_64/multiarch/ifunc-impl-list.c > > > index 0d28319905..6c03f53a8b 100644 > > > --- a/sysdeps/x86_64/multiarch/ifunc-impl-list.c > > > +++ b/sysdeps/x86_64/multiarch/ifunc-impl-list.c > > > @@ -531,6 +531,8 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, > > > > > > /* Support sysdeps/x86_64/multiarch/strcspn.c. */ > > > IFUNC_IMPL (i, name, strcspn, > > > + /* All implementations of strcspn are built at all ISA > > > + levels. */ > > > IFUNC_IMPL_ADD (array, i, strcspn, CPU_FEATURE_USABLE (SSE4_2), > > > __strcspn_sse42) > > > IFUNC_IMPL_ADD (array, i, strcspn, 1, __strcspn_generic)) > > > @@ -607,6 +609,8 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, > > > > > > /* Support sysdeps/x86_64/multiarch/strpbrk.c. */ > > > IFUNC_IMPL (i, name, strpbrk, > > > + /* All implementations of strpbrk are built at all ISA > > > + levels. */ > > > IFUNC_IMPL_ADD (array, i, strpbrk, CPU_FEATURE_USABLE (SSE4_2), > > > __strpbrk_sse42) > > > IFUNC_IMPL_ADD (array, i, strpbrk, 1, __strpbrk_generic)) > > > @@ -614,6 +618,8 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, > > > > > > /* Support sysdeps/x86_64/multiarch/strspn.c. */ > > > IFUNC_IMPL (i, name, strspn, > > > + /* All implementations of strspn are built at all ISA > > > + levels. */ > > > IFUNC_IMPL_ADD (array, i, strspn, CPU_FEATURE_USABLE (SSE4_2), > > > __strspn_sse42) > > > IFUNC_IMPL_ADD (array, i, strspn, 1, __strspn_generic)) > > > diff --git a/sysdeps/x86_64/multiarch/ifunc-sse4_2.h b/sysdeps/x86_64/multiarch/ifunc-sse4_2.h > > > index 973041d23b..f8943c8210 100644 > > > --- a/sysdeps/x86_64/multiarch/ifunc-sse4_2.h > > > +++ b/sysdeps/x86_64/multiarch/ifunc-sse4_2.h > > > @@ -31,7 +31,7 @@ IFUNC_SELECTOR (void) > > > there is no other optimized implementation keep using. If an > > > optimized fallback is added add a X86_ISA_CPU_FEATURE_ARCH_P > > > (cpu_features, Slow_SSE4_2) check. */ > > > - if (ISA_CPU_FEATURE_USABLE_P (cpu_features, SSE4_2)) > > > + if (X86_ISA_CPU_FEATURE_USABLE_P (cpu_features, SSE4_2)) > > > return OPTIMIZE (sse42); > > > > > > return OPTIMIZE (generic); > > > diff --git a/sysdeps/x86_64/multiarch/rtld-strcspn.c b/sysdeps/x86_64/multiarch/rtld-strcspn.c > > > new file mode 100644 > > > index 0000000000..99e3c59e00 > > > --- /dev/null > > > +++ b/sysdeps/x86_64/multiarch/rtld-strcspn.c > > > @@ -0,0 +1,18 @@ > > > +/* Copyright (C) 2022 Free Software Foundation, Inc. > > > + This file is part of the GNU C Library. > > > + > > > + The GNU C Library is free software; you can redistribute it and/or > > > + modify it under the terms of the GNU Lesser General Public > > > + License as published by the Free Software Foundation; either > > > + version 2.1 of the License, or (at your option) any later version. > > > + > > > + The GNU C Library is distributed in the hope that it will be useful, > > > + but WITHOUT ANY WARRANTY; without even the implied warranty of > > > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > > > + Lesser General Public License for more details. > > > + > > > + You should have received a copy of the GNU Lesser General Public > > > + License along with the GNU C Library; if not, see > > > + . */ > > > + > > > +#include "../strcspn.c" > > > diff --git a/sysdeps/x86_64/multiarch/strcspn-generic.c b/sysdeps/x86_64/multiarch/strcspn-generic.c > > > index 423de2e2b2..86cda7b037 100644 > > > --- a/sysdeps/x86_64/multiarch/strcspn-generic.c > > > +++ b/sysdeps/x86_64/multiarch/strcspn-generic.c > > > @@ -16,8 +16,10 @@ > > > License along with the GNU C Library; if not, see > > > . */ > > > > > > -#if IS_IN (libc) > > > - > > > +/* We always need to build this implementation as strcspn-sse4 needs > > > + to be able to fallback to it. */ > > > +#include > > > +#if IS_IN (libc) || MINIMUM_X86_ISA_LEVEL >= 2 > > > # include > > > # define STRCSPN __strcspn_generic > > > > > > diff --git a/sysdeps/x86_64/multiarch/strcspn-sse4.c b/sysdeps/x86_64/multiarch/strcspn-sse4.c > > > index 59f64f9fe8..becdaf05f3 100644 > > > --- a/sysdeps/x86_64/multiarch/strcspn-sse4.c > > > +++ b/sysdeps/x86_64/multiarch/strcspn-sse4.c > > > @@ -52,9 +52,11 @@ > > > when either CFlag or ZFlag is 1. If CFlag == 1, ECX has the offset > > > X for case 1. */ > > > > > > +#ifndef STRCSPN > > > +# define STRCSPN __strcspn_sse42 > > > +#endif > > > #ifndef STRCSPN_GENERIC > > > # define STRCSPN_GENERIC __strcspn_generic > > > -# define STRCSPN_SSE42 __strcspn_sse42 > > > #endif > > > > > > #ifdef USE_AS_STRPBRK > > > @@ -78,7 +80,7 @@ char * > > > size_t > > > #endif > > > __attribute__ ((section (".text.sse4.2"))) > > > -STRCSPN_SSE42 (const char *s, const char *a) > > > +STRCSPN (const char *s, const char *a) > > > { > > > if (*a == 0) > > > RETURN (NULL, strlen (s)); > > > diff --git a/sysdeps/x86_64/multiarch/strpbrk-generic.c b/sysdeps/x86_64/multiarch/strpbrk-generic.c > > > index d31acfe495..058f635774 100644 > > > --- a/sysdeps/x86_64/multiarch/strpbrk-generic.c > > > +++ b/sysdeps/x86_64/multiarch/strpbrk-generic.c > > > @@ -16,8 +16,11 @@ > > > License along with the GNU C Library; if not, see > > > . */ > > > > > > -#if IS_IN (libc) > > > > > > +/* We always need to build this implementation as strpbrk-sse4 needs > > > + to be able to fallback to it. */ > > > +#include > > > +#if IS_IN (libc) || MINIMUM_X86_ISA_LEVEL >= 2 > > > # include > > > # define STRPBRK __strpbrk_generic > > > > > > diff --git a/sysdeps/x86_64/multiarch/strpbrk-sse4.c b/sysdeps/x86_64/multiarch/strpbrk-sse4.c > > > index bf74d660d5..0adb577955 100644 > > > --- a/sysdeps/x86_64/multiarch/strpbrk-sse4.c > > > +++ b/sysdeps/x86_64/multiarch/strpbrk-sse4.c > > > @@ -16,7 +16,11 @@ > > > License along with the GNU C Library; if not, see > > > . */ > > > > > > +#ifndef STRPBRK > > > +# define STRPBRK __strpbrk_sse42 > > > +#endif > > > + > > > #define USE_AS_STRPBRK > > > #define STRCSPN_GENERIC __strpbrk_generic > > > -#define STRCSPN_SSE42 __strpbrk_sse42 > > > +#define STRCSPN STRPBRK > > > #include "strcspn-sse4.c" > > > diff --git a/sysdeps/x86_64/multiarch/strspn-generic.c b/sysdeps/x86_64/multiarch/strspn-generic.c > > > index 6b50c36432..0f485ab4da 100644 > > > --- a/sysdeps/x86_64/multiarch/strspn-generic.c > > > +++ b/sysdeps/x86_64/multiarch/strspn-generic.c > > > @@ -16,13 +16,16 @@ > > > License along with the GNU C Library; if not, see > > > . */ > > > > > > -#if IS_IN (libc) > > > - > > > +/* We always need to build this implementation as strspn-sse4 needs to > > > + be able to fallback to it. */ > > > +#include > > > +#if IS_IN (libc) || MINIMUM_X86_ISA_LEVEL >= 2 > > > # include > > > # define STRSPN __strspn_generic > > > > > > # undef libc_hidden_builtin_def > > > # define libc_hidden_builtin_def(STRSPN) > > > + > > > #endif > > > > > > #include > > > diff --git a/sysdeps/x86_64/multiarch/strspn-sse4.c b/sysdeps/x86_64/multiarch/strspn-sse4.c > > > index d044916688..4d50507a0d 100644 > > > --- a/sysdeps/x86_64/multiarch/strspn-sse4.c > > > +++ b/sysdeps/x86_64/multiarch/strspn-sse4.c > > > @@ -53,10 +53,13 @@ > > > > > > extern size_t __strspn_generic (const char *, const char *) attribute_hidden; > > > > > > +#ifndef STRSPN > > > +# define STRSPN __strspn_sse42 > > > +#endif > > > > > > size_t > > > __attribute__ ((section (".text.sse4.2"))) > > > -__strspn_sse42 (const char *s, const char *a) > > > +STRSPN (const char *s, const char *a) > > > { > > > if (*a == 0) > > > return 0; > > > diff --git a/sysdeps/x86_64/strcspn-generic.c b/sysdeps/x86_64/strcspn-generic.c > > > new file mode 100644 > > > index 0000000000..51fd70b63d > > > --- /dev/null > > > +++ b/sysdeps/x86_64/strcspn-generic.c > > > @@ -0,0 +1,25 @@ > > > +/* Hook for build strcspn-generic for non-multiarch build. Needed for > > > + the ISA level >= 2 because strcspn-sse4 has a dependency on > > > + strcspn-generic. > > > + Copyright (C) 2022 Free Software Foundation, Inc. > > > + This file is part of the GNU C Library. > > > + > > > + The GNU C Library is free software; you can redistribute it and/or > > > + modify it under the terms of the GNU Lesser General Public > > > + License as published by the Free Software Foundation; either > > > + version 2.1 of the License, or (at your option) any later version. > > > + > > > + The GNU C Library is distributed in the hope that it will be useful, > > > + but WITHOUT ANY WARRANTY; without even the implied warranty of > > > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > > > + Lesser General Public License for more details. > > > + > > > + You should have received a copy of the GNU Lesser General Public > > > + License along with the GNU C Library; if not, see > > > + . */ > > > + > > > +#include > > > + > > > +#if MINIMUM_X86_ISA_LEVEL >= 2 > > > +# include "multiarch/strcspn-generic.c" > > > +#endif > > > diff --git a/sysdeps/x86_64/strcspn.c b/sysdeps/x86_64/strcspn.c > > > new file mode 100644 > > > index 0000000000..cd54eed869 > > > --- /dev/null > > > +++ b/sysdeps/x86_64/strcspn.c > > > @@ -0,0 +1,27 @@ > > > +/* strcspn hook for non-multiarch and RTLD build. > > > + Copyright (C) 2022 Free Software Foundation, Inc. > > > + This file is part of the GNU C Library. > > > + > > > + The GNU C Library is free software; you can redistribute it and/or > > > + modify it under the terms of the GNU Lesser General Public > > > + License as published by the Free Software Foundation; either > > > + version 2.1 of the License, or (at your option) any later version. > > > + > > > + The GNU C Library is distributed in the hope that it will be useful, > > > + but WITHOUT ANY WARRANTY; without even the implied warranty of > > > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > > > + Lesser General Public License for more details. > > > + > > > + You should have received a copy of the GNU Lesser General Public > > > + License along with the GNU C Library; if not, see > > > + . */ > > > + > > > +#include > > > + > > > +#if MINIMUM_X86_ISA_LEVEL == 1 > > > +#include > > > +#else > > > +#define STRCSPN strcspn > > > +#include "multiarch/strcspn-sse4.c" > > > +libc_hidden_builtin_def (strcspn) > > > +#endif > > > diff --git a/sysdeps/x86_64/strpbrk-generic.c b/sysdeps/x86_64/strpbrk-generic.c > > > new file mode 100644 > > > index 0000000000..a7d8b11216 > > > --- /dev/null > > > +++ b/sysdeps/x86_64/strpbrk-generic.c > > > @@ -0,0 +1,25 @@ > > > +/* Hook for build strpbrk-generic for non-multiarch build. Needed for > > > + the ISA level >= 2 because strpbrk-sse4 has a dependency on > > > + strpbrk-generic. > > > + Copyright (C) 2022 Free Software Foundation, Inc. > > > + This file is part of the GNU C Library. > > > + > > > + The GNU C Library is free software; you can redistribute it and/or > > > + modify it under the terms of the GNU Lesser General Public > > > + License as published by the Free Software Foundation; either > > > + version 2.1 of the License, or (at your option) any later version. > > > + > > > + The GNU C Library is distributed in the hope that it will be useful, > > > + but WITHOUT ANY WARRANTY; without even the implied warranty of > > > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > > > + Lesser General Public License for more details. > > > + > > > + You should have received a copy of the GNU Lesser General Public > > > + License along with the GNU C Library; if not, see > > > + . */ > > > + > > > +#include > > > + > > > +#if MINIMUM_X86_ISA_LEVEL >= 2 > > > +# include "multiarch/strpbrk-generic.c" > > > +#endif > > > diff --git a/sysdeps/x86_64/strpbrk.c b/sysdeps/x86_64/strpbrk.c > > > new file mode 100644 > > > index 0000000000..e7ea1b334a > > > --- /dev/null > > > +++ b/sysdeps/x86_64/strpbrk.c > > > @@ -0,0 +1,27 @@ > > > +/* strpbrk hook for non-multiarch and RTLD build. > > > + Copyright (C) 2022 Free Software Foundation, Inc. > > > + This file is part of the GNU C Library. > > > + > > > + The GNU C Library is free software; you can redistribute it and/or > > > + modify it under the terms of the GNU Lesser General Public > > > + License as published by the Free Software Foundation; either > > > + version 2.1 of the License, or (at your option) any later version. > > > + > > > + The GNU C Library is distributed in the hope that it will be useful, > > > + but WITHOUT ANY WARRANTY; without even the implied warranty of > > > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > > > + Lesser General Public License for more details. > > > + > > > + You should have received a copy of the GNU Lesser General Public > > > + License along with the GNU C Library; if not, see > > > + . */ > > > + > > > +#include > > > + > > > +#if MINIMUM_X86_ISA_LEVEL == 1 > > > +#include > > > +#else > > > +#define STRPBRK strpbrk > > > +#include "multiarch/strpbrk-sse4.c" > > > +libc_hidden_builtin_def (strpbrk) > > > +#endif > > > diff --git a/sysdeps/x86_64/strspn-generic.c b/sysdeps/x86_64/strspn-generic.c > > > new file mode 100644 > > > index 0000000000..1a2a576e49 > > > --- /dev/null > > > +++ b/sysdeps/x86_64/strspn-generic.c > > > @@ -0,0 +1,26 @@ > > > +/* Hook for build strspn-generic for non-multiarch build. Needed for > > > + the ISA level >= 2 because strspn-sse4 has a dependency on > > > + strspn-generic. > > > + Copyright (C) 2022 Free Software Foundation, Inc. > > > + This file is part of the GNU C Library. > > > + > > > + The GNU C Library is free software; you can redistribute it and/or > > > + modify it under the terms of the GNU Lesser General Public > > > + License as published by the Free Software Foundation; either > > > + version 2.1 of the License, or (at your option) any later version. > > > + > > > + The GNU C Library is distributed in the hope that it will be useful, > > > + but WITHOUT ANY WARRANTY; without even the implied warranty of > > > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > > > + Lesser General Public License for more details. > > > + > > > + You should have received a copy of the GNU Lesser General Public > > > + License along with the GNU C Library; if not, see > > > + . */ > > > + > > > + > > > +#include > > > + > > > +#if MINIMUM_X86_ISA_LEVEL >= 2 > > > +# include "multiarch/strspn-generic.c" > > > +#endif > > > diff --git a/sysdeps/x86_64/strspn.c b/sysdeps/x86_64/strspn.c > > > new file mode 100644 > > > index 0000000000..7b9ede26d9 > > > --- /dev/null > > > +++ b/sysdeps/x86_64/strspn.c > > > @@ -0,0 +1,27 @@ > > > +/* strspn hook for non-multiarch and RTLD build. > > > + Copyright (C) 2022 Free Software Foundation, Inc. > > > + This file is part of the GNU C Library. > > > + > > > + The GNU C Library is free software; you can redistribute it and/or > > > + modify it under the terms of the GNU Lesser General Public > > > + License as published by the Free Software Foundation; either > > > + version 2.1 of the License, or (at your option) any later version. > > > + > > > + The GNU C Library is distributed in the hope that it will be useful, > > > + but WITHOUT ANY WARRANTY; without even the implied warranty of > > > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > > > + Lesser General Public License for more details. > > > + > > > + You should have received a copy of the GNU Lesser General Public > > > + License along with the GNU C Library; if not, see > > > + . */ > > > + > > > +#include > > > + > > > +#if MINIMUM_X86_ISA_LEVEL == 1 > > > +#include > > > +#else > > > +#define STRSPN strspn > > > +#include "multiarch/strspn-sse4.c" > > > +libc_hidden_builtin_def (strspn) > > > +#endif > > > diff --git a/sysdeps/x86_64/varshift.c b/sysdeps/x86_64/varshift.c > > > new file mode 100644 > > > index 0000000000..8f9eb13547 > > > --- /dev/null > > > +++ b/sysdeps/x86_64/varshift.c > > > @@ -0,0 +1,26 @@ > > > +/* Hook for build varshift for non-multiarch build. Needed for the > > > + ISA level >= 2 because strspn-sse4, strcspn-sse4, and strpbrk-sse4 > > > + all have a dependency on varshift.c. > > > + Copyright (C) 2022 Free Software Foundation, Inc. > > > + This file is part of the GNU C Library. > > > + > > > + The GNU C Library is free software; you can redistribute it and/or > > > + modify it under the terms of the GNU Lesser General Public > > > + License as published by the Free Software Foundation; either > > > + version 2.1 of the License, or (at your option) any later version. > > > + > > > + The GNU C Library is distributed in the hope that it will be useful, > > > + but WITHOUT ANY WARRANTY; without even the implied warranty of > > > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > > > + Lesser General Public License for more details. > > > + > > > + You should have received a copy of the GNU Lesser General Public > > > + License along with the GNU C Library; if not, see > > > + . */ > > > + > > > + > > > +#include > > > + > > > +#if MINIMUM_X86_ISA_LEVEL >= 2 > > > +# include "multiarch/varshift.c" > > > +#endif > > > -- > > > 2.34.1 > > > > > > > LGTM. > > > > Thanks. > > > > -- > > H.J. > > Rebsubmitted in V5 after rebase ontop of: > > commit 0aa294fb887bb5aae4cdfa4b764325466a329131 > Author: Noah Goldstein > Date: Wed Jun 29 18:56:17 2022 -0700 > > x86: Add missing IS_IN (libc) check to strcspn-sse4.c There is an issue with this patch. Ignore it.