diff mbox series

[v1] x86: Add missing IS_IN (libc) check to strcspn-sse4.c

Message ID 20220630015618.3586787-2-goldstein.w.n@gmail.com
State New
Headers show
Series [v1] x86: Add missing IS_IN (libc) check to strcspn-sse4.c | expand

Commit Message

Noah Goldstein June 30, 2022, 1:56 a.m. UTC
Was missing to for the multiarch build rtld-strcspn-sse4.os was
being built and exporting symbols:

build/glibc/string/rtld-strcspn-sse4.os:
                 U ___m128i_shift_right
                 U __strcspn_generic
0000000000000000 T __strcspn_sse42
                 U strlen

build/glibc/string/rtld-varshift.os:
0000000000000000 R ___m128i_shift_right

Introduced in:

commit 06e51c8f3de38761f8855700841bc49cf495c8c0
Author: H.J. Lu <hongjiu.lu@intel.com>
Date:   Fri Jul 3 02:48:56 2009 -0700

    Add SSE4.2 support for strcspn, strpbrk, and strspn on x86-64.
---
 sysdeps/x86_64/multiarch/strcspn-sse4.c | 39 +++++++++++++------------
 sysdeps/x86_64/multiarch/varshift.c     |  5 +++-
 2 files changed, 25 insertions(+), 19 deletions(-)

Comments

H.J. Lu June 30, 2022, 2:03 a.m. UTC | #1
On Wed, Jun 29, 2022 at 6:56 PM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
>
> Was missing to for the multiarch build rtld-strcspn-sse4.os was
> being built and exporting symbols:
>
> build/glibc/string/rtld-strcspn-sse4.os:
>                  U ___m128i_shift_right
>                  U __strcspn_generic
> 0000000000000000 T __strcspn_sse42
>                  U strlen
>
> build/glibc/string/rtld-varshift.os:
> 0000000000000000 R ___m128i_shift_right
>
> Introduced in:
>
> commit 06e51c8f3de38761f8855700841bc49cf495c8c0
> Author: H.J. Lu <hongjiu.lu@intel.com>
> Date:   Fri Jul 3 02:48:56 2009 -0700
>
>     Add SSE4.2 support for strcspn, strpbrk, and strspn on x86-64.
> ---
>  sysdeps/x86_64/multiarch/strcspn-sse4.c | 39 +++++++++++++------------
>  sysdeps/x86_64/multiarch/varshift.c     |  5 +++-
>  2 files changed, 25 insertions(+), 19 deletions(-)
>
> diff --git a/sysdeps/x86_64/multiarch/strcspn-sse4.c b/sysdeps/x86_64/multiarch/strcspn-sse4.c
> index 59f64f9fe8..d11e87ab6c 100644
> --- a/sysdeps/x86_64/multiarch/strcspn-sse4.c
> +++ b/sysdeps/x86_64/multiarch/strcspn-sse4.c
> @@ -16,9 +16,11 @@
>     License along with the GNU C Library; if not, see
>     <https://www.gnu.org/licenses/>.  */
>
> -#include <nmmintrin.h>
> -#include <string.h>
> -#include "varshift.h"
> +#if IS_IN (libc)
> +
> +# include <nmmintrin.h>
> +# include <string.h>
> +# include "varshift.h"
>
>  /* We use 0x2:
>         _SIDD_SBYTE_OPS
> @@ -52,31 +54,31 @@
>     when either CFlag or ZFlag is 1.  If CFlag == 1, ECX has the offset
>     X for case 1.  */
>
> -#ifndef STRCSPN_GENERIC
> -# define STRCSPN_GENERIC __strcspn_generic
> -# define STRCSPN_SSE42 __strcspn_sse42
> -#endif
> +# ifndef STRCSPN_GENERIC
> +#  define STRCSPN_GENERIC __strcspn_generic
> +#  define STRCSPN_SSE42 __strcspn_sse42
> +# endif
>
> -#ifdef USE_AS_STRPBRK
> -# define RETURN(val1, val2) return val1
> -#else
> -# define RETURN(val1, val2) return val2
> -#endif
> +# ifdef USE_AS_STRPBRK
> +#  define RETURN(val1, val2) return val1
> +# else
> +#  define RETURN(val1, val2) return val2
> +# endif
>
>  extern
> -#ifdef USE_AS_STRPBRK
> +# ifdef USE_AS_STRPBRK
>  char *
> -#else
> +# else
>  size_t
> -#endif
> +# endif
>  STRCSPN_GENERIC (const char *, const char *) attribute_hidden;
>
>
> -#ifdef USE_AS_STRPBRK
> +# ifdef USE_AS_STRPBRK
>  char *
> -#else
> +# else
>  size_t
> -#endif
> +# endif
>  __attribute__ ((section (".text.sse4.2")))
>  STRCSPN_SSE42 (const char *s, const char *a)
>  {
> @@ -161,3 +163,4 @@ start_loop:
>        aligned += 16;
>      }
>  }
> +#endif
> diff --git a/sysdeps/x86_64/multiarch/varshift.c b/sysdeps/x86_64/multiarch/varshift.c
> index d27767520a..5e2f2bdf51 100644
> --- a/sysdeps/x86_64/multiarch/varshift.c
> +++ b/sysdeps/x86_64/multiarch/varshift.c
> @@ -16,7 +16,8 @@
>     License along with the GNU C Library; if not, see
>     <https://www.gnu.org/licenses/>.  */
>
> -#include <stdint.h>
> +#if IS_IN (libc)
> +# include <stdint.h>
>
>  const int8_t ___m128i_shift_right[31] attribute_hidden
>      __attribute__((aligned(32))) =
> @@ -24,3 +25,5 @@ const int8_t ___m128i_shift_right[31] attribute_hidden
>      0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
>      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
>    };
> +
> +#endif
> --
> 2.34.1
>

LGTM.

Thanks.
diff mbox series

Patch

diff --git a/sysdeps/x86_64/multiarch/strcspn-sse4.c b/sysdeps/x86_64/multiarch/strcspn-sse4.c
index 59f64f9fe8..d11e87ab6c 100644
--- a/sysdeps/x86_64/multiarch/strcspn-sse4.c
+++ b/sysdeps/x86_64/multiarch/strcspn-sse4.c
@@ -16,9 +16,11 @@ 
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <nmmintrin.h>
-#include <string.h>
-#include "varshift.h"
+#if IS_IN (libc)
+
+# include <nmmintrin.h>
+# include <string.h>
+# include "varshift.h"
 
 /* We use 0x2:
 	_SIDD_SBYTE_OPS
@@ -52,31 +54,31 @@ 
    when either CFlag or ZFlag is 1.  If CFlag == 1, ECX has the offset
    X for case 1.  */
 
-#ifndef STRCSPN_GENERIC
-# define STRCSPN_GENERIC __strcspn_generic
-# define STRCSPN_SSE42 __strcspn_sse42
-#endif
+# ifndef STRCSPN_GENERIC
+#  define STRCSPN_GENERIC __strcspn_generic
+#  define STRCSPN_SSE42 __strcspn_sse42
+# endif
 
-#ifdef USE_AS_STRPBRK
-# define RETURN(val1, val2) return val1
-#else
-# define RETURN(val1, val2) return val2
-#endif
+# ifdef USE_AS_STRPBRK
+#  define RETURN(val1, val2) return val1
+# else
+#  define RETURN(val1, val2) return val2
+# endif
 
 extern
-#ifdef USE_AS_STRPBRK
+# ifdef USE_AS_STRPBRK
 char *
-#else
+# else
 size_t
-#endif
+# endif
 STRCSPN_GENERIC (const char *, const char *) attribute_hidden;
 
 
-#ifdef USE_AS_STRPBRK
+# ifdef USE_AS_STRPBRK
 char *
-#else
+# else
 size_t
-#endif
+# endif
 __attribute__ ((section (".text.sse4.2")))
 STRCSPN_SSE42 (const char *s, const char *a)
 {
@@ -161,3 +163,4 @@  start_loop:
       aligned += 16;
     }
 }
+#endif
diff --git a/sysdeps/x86_64/multiarch/varshift.c b/sysdeps/x86_64/multiarch/varshift.c
index d27767520a..5e2f2bdf51 100644
--- a/sysdeps/x86_64/multiarch/varshift.c
+++ b/sysdeps/x86_64/multiarch/varshift.c
@@ -16,7 +16,8 @@ 
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <stdint.h>
+#if IS_IN (libc)
+# include <stdint.h>
 
 const int8_t ___m128i_shift_right[31] attribute_hidden
     __attribute__((aligned(32))) =
@@ -24,3 +25,5 @@  const int8_t ___m128i_shift_right[31] attribute_hidden
     0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
     -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
   };
+
+#endif