* [PATCH v1] x86: Add missing IS_IN (libc) check to memmove-ssse3.S @ 2022-06-30 1:56 Noah Goldstein 2022-06-30 1:56 ` [PATCH v1] x86: Add missing IS_IN (libc) check to strcspn-sse4.c Noah Goldstein ` (2 more replies) 0 siblings, 3 replies; 7+ messages in thread From: Noah Goldstein @ 2022-06-30 1:56 UTC (permalink / raw) To: libc-alpha Was missing to for the multiarch build rtld-memmove-ssse3.os was being built and exporting symbols: >$ nm string/rtld-memmove-ssse3.os U __GI___chk_fail 0000000000000020 T __memcpy_chk_ssse3 0000000000000040 T __memcpy_ssse3 0000000000000020 T __memmove_chk_ssse3 0000000000000040 T __memmove_ssse3 0000000000000000 T __mempcpy_chk_ssse3 0000000000000010 T __mempcpy_ssse3 U __x86_shared_cache_size_half Introduced after 2.35 in: commit 26b2478322db94edc9e0e8f577b2f71d291e5acb Author: Noah Goldstein <goldstein.w.n@gmail.com> Date: Thu Apr 14 11:47:40 2022 -0500 x86: Reduce code size of mem{move|pcpy|cpy}-ssse3 --- sysdeps/x86_64/multiarch/memmove-ssse3.S | 60 +++++++++++++++++------- 1 file changed, 44 insertions(+), 16 deletions(-) diff --git a/sysdeps/x86_64/multiarch/memmove-ssse3.S b/sysdeps/x86_64/multiarch/memmove-ssse3.S index 310ff62b86..a88fde4a8f 100644 --- a/sysdeps/x86_64/multiarch/memmove-ssse3.S +++ b/sysdeps/x86_64/multiarch/memmove-ssse3.S @@ -1,19 +1,42 @@ -#include <sysdep.h> - -#ifndef MEMMOVE -# define MEMMOVE __memmove_ssse3 -# define MEMMOVE_CHK __memmove_chk_ssse3 -# define MEMCPY __memcpy_ssse3 -# define MEMCPY_CHK __memcpy_chk_ssse3 -# define MEMPCPY __mempcpy_ssse3 -# define MEMPCPY_CHK __mempcpy_chk_ssse3 -#endif +/* memmove/memcpy/mempcpy optimized for aligned access with SSSE3. + All versions must be listed in ifunc-impl-list.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 + <https://www.gnu.org/licenses/>. */ + + +#if IS_IN (libc) + +# include <sysdep.h> +# ifndef MEMMOVE +# define MEMMOVE __memmove_ssse3 +# define MEMMOVE_CHK __memmove_chk_ssse3 +# define MEMCPY __memcpy_ssse3 +# define MEMCPY_CHK __memcpy_chk_ssse3 +# define MEMPCPY __mempcpy_ssse3 +# define MEMPCPY_CHK __mempcpy_chk_ssse3 +# endif .section .text.ssse3, "ax", @progbits +# if defined SHARED ENTRY(MEMPCPY_CHK) cmp %RDX_LP, %RCX_LP jb HIDDEN_JUMPTARGET(__chk_fail) END(MEMPCPY_CHK) +# endif ENTRY(MEMPCPY) mov %RDI_LP, %RAX_LP @@ -21,10 +44,12 @@ ENTRY(MEMPCPY) jmp L(start) END(MEMPCPY) +# if defined SHARED ENTRY(MEMMOVE_CHK) cmp %RDX_LP, %RCX_LP jb HIDDEN_JUMPTARGET(__chk_fail) END(MEMMOVE_CHK) +# endif ENTRY_P2ALIGN(MEMMOVE, 6) # ifdef __ILP32__ @@ -124,11 +149,11 @@ L(more_2x_vec): loop. */ movups %xmm0, (%rdi) -#ifdef SHARED_CACHE_SIZE_HALF +# ifdef SHARED_CACHE_SIZE_HALF cmp $SHARED_CACHE_SIZE_HALF, %RDX_LP -#else +# else cmp __x86_shared_cache_size_half(%rip), %rdx -#endif +# endif ja L(large_memcpy) leaq -64(%rdi, %rdx), %r8 @@ -206,7 +231,7 @@ L(end_loop_fwd): /* Extactly 64 bytes if `jmp L(end_loop_fwd)` is long encoding. 60 bytes otherwise. */ -#define ALIGNED_LOOP_FWD(align_by); \ +# define ALIGNED_LOOP_FWD(align_by); \ .p2align 6; \ L(loop_fwd_ ## align_by): \ movaps 16(%rsi), %xmm0; \ @@ -275,7 +300,7 @@ L(end_large_loop_fwd): /* Size > 64 bytes and <= 96 bytes. 32-byte align between ensure 96-byte spacing between each. */ -#define ALIGNED_LARGE_LOOP_FWD(align_by); \ +# define ALIGNED_LARGE_LOOP_FWD(align_by); \ .p2align 5; \ L(large_loop_fwd_ ## align_by): \ movaps 16(%rsi), %xmm0; \ @@ -343,7 +368,7 @@ L(end_loop_bkwd): /* Extactly 64 bytes if `jmp L(end_loop_bkwd)` is long encoding. 60 bytes otherwise. */ -#define ALIGNED_LOOP_BKWD(align_by); \ +# define ALIGNED_LOOP_BKWD(align_by); \ .p2align 6; \ L(loop_bkwd_ ## align_by): \ movaps 32(%rsi), %xmm1; \ @@ -381,4 +406,7 @@ L(loop_bkwd_ ## align_by): \ END(MEMMOVE) strong_alias (MEMMOVE, MEMCPY) +# if defined SHARED strong_alias (MEMMOVE_CHK, MEMCPY_CHK) +# endif +#endif -- 2.34.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v1] x86: Add missing IS_IN (libc) check to strcspn-sse4.c 2022-06-30 1:56 [PATCH v1] x86: Add missing IS_IN (libc) check to memmove-ssse3.S Noah Goldstein @ 2022-06-30 1:56 ` Noah Goldstein 2022-06-30 2:03 ` H.J. Lu 2022-06-30 1:56 ` [PATCH v1] x86: Add missing IS_IN (libc) check to strncmp-sse4_2.S Noah Goldstein 2022-06-30 2:02 ` [PATCH v1] x86: Add missing IS_IN (libc) check to memmove-ssse3.S H.J. Lu 2 siblings, 1 reply; 7+ messages in thread From: Noah Goldstein @ 2022-06-30 1:56 UTC (permalink / raw) To: libc-alpha 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v1] x86: Add missing IS_IN (libc) check to strcspn-sse4.c 2022-06-30 1:56 ` [PATCH v1] x86: Add missing IS_IN (libc) check to strcspn-sse4.c Noah Goldstein @ 2022-06-30 2:03 ` H.J. Lu 0 siblings, 0 replies; 7+ messages in thread From: H.J. Lu @ 2022-06-30 2:03 UTC (permalink / raw) To: Noah Goldstein; +Cc: GNU C Library, Carlos O'Donell 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. -- H.J. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v1] x86: Add missing IS_IN (libc) check to strncmp-sse4_2.S 2022-06-30 1:56 [PATCH v1] x86: Add missing IS_IN (libc) check to memmove-ssse3.S Noah Goldstein 2022-06-30 1:56 ` [PATCH v1] x86: Add missing IS_IN (libc) check to strcspn-sse4.c Noah Goldstein @ 2022-06-30 1:56 ` Noah Goldstein 2022-06-30 2:03 ` H.J. Lu 2022-06-30 2:02 ` [PATCH v1] x86: Add missing IS_IN (libc) check to memmove-ssse3.S H.J. Lu 2 siblings, 1 reply; 7+ messages in thread From: Noah Goldstein @ 2022-06-30 1:56 UTC (permalink / raw) To: libc-alpha Was missing to for the multiarch build rtld-strncmp-sse4_2.os was being built and exporting symbols: build/glibc/string/rtld-strncmp-sse4_2.os: 0000000000000000 T __strncmp_sse42 Introduced in: commit 11ffcacb64a939c10cfc713746b8ec88837f5c4a Author: H.J. Lu <hjl.tools@gmail.com> Date: Wed Jun 21 12:10:50 2017 -0700 x86-64: Implement strcmp family IFUNC selectors in C --- sysdeps/x86_64/multiarch/strncmp-sse4_2.S | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sysdeps/x86_64/multiarch/strncmp-sse4_2.S b/sysdeps/x86_64/multiarch/strncmp-sse4_2.S index 9773e5fc09..310a6dbe77 100644 --- a/sysdeps/x86_64/multiarch/strncmp-sse4_2.S +++ b/sysdeps/x86_64/multiarch/strncmp-sse4_2.S @@ -16,6 +16,8 @@ License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ -#define STRCMP_SSE42 __strncmp_sse42 -#define USE_AS_STRNCMP -#include "strcmp-sse42.S" +#if IS_IN (libc) +# define STRCMP_SSE42 __strncmp_sse42 +# define USE_AS_STRNCMP +# include "strcmp-sse42.S" +#endif -- 2.34.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v1] x86: Add missing IS_IN (libc) check to strncmp-sse4_2.S 2022-06-30 1:56 ` [PATCH v1] x86: Add missing IS_IN (libc) check to strncmp-sse4_2.S Noah Goldstein @ 2022-06-30 2:03 ` H.J. Lu 2022-07-14 3:08 ` Sunil Pandey 0 siblings, 1 reply; 7+ messages in thread From: H.J. Lu @ 2022-06-30 2:03 UTC (permalink / raw) To: Noah Goldstein; +Cc: GNU C Library, Carlos O'Donell 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-strncmp-sse4_2.os was > being built and exporting symbols: > > build/glibc/string/rtld-strncmp-sse4_2.os: > 0000000000000000 T __strncmp_sse42 > > Introduced in: > > commit 11ffcacb64a939c10cfc713746b8ec88837f5c4a > Author: H.J. Lu <hjl.tools@gmail.com> > Date: Wed Jun 21 12:10:50 2017 -0700 > > x86-64: Implement strcmp family IFUNC selectors in C > --- > sysdeps/x86_64/multiarch/strncmp-sse4_2.S | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/sysdeps/x86_64/multiarch/strncmp-sse4_2.S b/sysdeps/x86_64/multiarch/strncmp-sse4_2.S > index 9773e5fc09..310a6dbe77 100644 > --- a/sysdeps/x86_64/multiarch/strncmp-sse4_2.S > +++ b/sysdeps/x86_64/multiarch/strncmp-sse4_2.S > @@ -16,6 +16,8 @@ > License along with the GNU C Library; if not, see > <https://www.gnu.org/licenses/>. */ > > -#define STRCMP_SSE42 __strncmp_sse42 > -#define USE_AS_STRNCMP > -#include "strcmp-sse42.S" > +#if IS_IN (libc) > +# define STRCMP_SSE42 __strncmp_sse42 > +# define USE_AS_STRNCMP > +# include "strcmp-sse42.S" > +#endif > -- > 2.34.1 > LGTM. Thanks. -- H.J. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v1] x86: Add missing IS_IN (libc) check to strncmp-sse4_2.S 2022-06-30 2:03 ` H.J. Lu @ 2022-07-14 3:08 ` Sunil Pandey 0 siblings, 0 replies; 7+ messages in thread From: Sunil Pandey @ 2022-07-14 3:08 UTC (permalink / raw) To: H.J. Lu; +Cc: Noah Goldstein, GNU C Library On Wed, Jun 29, 2022 at 7:04 PM H.J. Lu via Libc-alpha <libc-alpha@sourceware.org> wrote: > > 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-strncmp-sse4_2.os was > > being built and exporting symbols: > > > > build/glibc/string/rtld-strncmp-sse4_2.os: > > 0000000000000000 T __strncmp_sse42 > > > > Introduced in: > > > > commit 11ffcacb64a939c10cfc713746b8ec88837f5c4a > > Author: H.J. Lu <hjl.tools@gmail.com> > > Date: Wed Jun 21 12:10:50 2017 -0700 > > > > x86-64: Implement strcmp family IFUNC selectors in C > > --- > > sysdeps/x86_64/multiarch/strncmp-sse4_2.S | 8 +++++--- > > 1 file changed, 5 insertions(+), 3 deletions(-) > > > > diff --git a/sysdeps/x86_64/multiarch/strncmp-sse4_2.S b/sysdeps/x86_64/multiarch/strncmp-sse4_2.S > > index 9773e5fc09..310a6dbe77 100644 > > --- a/sysdeps/x86_64/multiarch/strncmp-sse4_2.S > > +++ b/sysdeps/x86_64/multiarch/strncmp-sse4_2.S > > @@ -16,6 +16,8 @@ > > License along with the GNU C Library; if not, see > > <https://www.gnu.org/licenses/>. */ > > > > -#define STRCMP_SSE42 __strncmp_sse42 > > -#define USE_AS_STRNCMP > > -#include "strcmp-sse42.S" > > +#if IS_IN (libc) > > +# define STRCMP_SSE42 __strncmp_sse42 > > +# define USE_AS_STRNCMP > > +# include "strcmp-sse42.S" > > +#endif > > -- > > 2.34.1 > > > > LGTM. > > Thanks. > > -- > H.J. I would like to backport this patch to release branches. Any comments or objections? --Sunil ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v1] x86: Add missing IS_IN (libc) check to memmove-ssse3.S 2022-06-30 1:56 [PATCH v1] x86: Add missing IS_IN (libc) check to memmove-ssse3.S Noah Goldstein 2022-06-30 1:56 ` [PATCH v1] x86: Add missing IS_IN (libc) check to strcspn-sse4.c Noah Goldstein 2022-06-30 1:56 ` [PATCH v1] x86: Add missing IS_IN (libc) check to strncmp-sse4_2.S Noah Goldstein @ 2022-06-30 2:02 ` H.J. Lu 2 siblings, 0 replies; 7+ messages in thread From: H.J. Lu @ 2022-06-30 2:02 UTC (permalink / raw) To: Noah Goldstein; +Cc: GNU C Library, Carlos O'Donell 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-memmove-ssse3.os was > being built and exporting symbols: > > >$ nm string/rtld-memmove-ssse3.os > U __GI___chk_fail > 0000000000000020 T __memcpy_chk_ssse3 > 0000000000000040 T __memcpy_ssse3 > 0000000000000020 T __memmove_chk_ssse3 > 0000000000000040 T __memmove_ssse3 > 0000000000000000 T __mempcpy_chk_ssse3 > 0000000000000010 T __mempcpy_ssse3 > U __x86_shared_cache_size_half > > Introduced after 2.35 in: > > commit 26b2478322db94edc9e0e8f577b2f71d291e5acb > Author: Noah Goldstein <goldstein.w.n@gmail.com> > Date: Thu Apr 14 11:47:40 2022 -0500 > > x86: Reduce code size of mem{move|pcpy|cpy}-ssse3 > --- > sysdeps/x86_64/multiarch/memmove-ssse3.S | 60 +++++++++++++++++------- > 1 file changed, 44 insertions(+), 16 deletions(-) > > diff --git a/sysdeps/x86_64/multiarch/memmove-ssse3.S b/sysdeps/x86_64/multiarch/memmove-ssse3.S > index 310ff62b86..a88fde4a8f 100644 > --- a/sysdeps/x86_64/multiarch/memmove-ssse3.S > +++ b/sysdeps/x86_64/multiarch/memmove-ssse3.S > @@ -1,19 +1,42 @@ > -#include <sysdep.h> > - > -#ifndef MEMMOVE > -# define MEMMOVE __memmove_ssse3 > -# define MEMMOVE_CHK __memmove_chk_ssse3 > -# define MEMCPY __memcpy_ssse3 > -# define MEMCPY_CHK __memcpy_chk_ssse3 > -# define MEMPCPY __mempcpy_ssse3 > -# define MEMPCPY_CHK __mempcpy_chk_ssse3 > -#endif > +/* memmove/memcpy/mempcpy optimized for aligned access with SSSE3. > + All versions must be listed in ifunc-impl-list.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 > + <https://www.gnu.org/licenses/>. */ > + > + > +#if IS_IN (libc) > + > +# include <sysdep.h> > +# ifndef MEMMOVE > +# define MEMMOVE __memmove_ssse3 > +# define MEMMOVE_CHK __memmove_chk_ssse3 > +# define MEMCPY __memcpy_ssse3 > +# define MEMCPY_CHK __memcpy_chk_ssse3 > +# define MEMPCPY __mempcpy_ssse3 > +# define MEMPCPY_CHK __mempcpy_chk_ssse3 > +# endif > > .section .text.ssse3, "ax", @progbits > +# if defined SHARED > ENTRY(MEMPCPY_CHK) > cmp %RDX_LP, %RCX_LP > jb HIDDEN_JUMPTARGET(__chk_fail) > END(MEMPCPY_CHK) > +# endif > > ENTRY(MEMPCPY) > mov %RDI_LP, %RAX_LP > @@ -21,10 +44,12 @@ ENTRY(MEMPCPY) > jmp L(start) > END(MEMPCPY) > > +# if defined SHARED > ENTRY(MEMMOVE_CHK) > cmp %RDX_LP, %RCX_LP > jb HIDDEN_JUMPTARGET(__chk_fail) > END(MEMMOVE_CHK) > +# endif > > ENTRY_P2ALIGN(MEMMOVE, 6) > # ifdef __ILP32__ > @@ -124,11 +149,11 @@ L(more_2x_vec): > loop. */ > movups %xmm0, (%rdi) > > -#ifdef SHARED_CACHE_SIZE_HALF > +# ifdef SHARED_CACHE_SIZE_HALF > cmp $SHARED_CACHE_SIZE_HALF, %RDX_LP > -#else > +# else > cmp __x86_shared_cache_size_half(%rip), %rdx > -#endif > +# endif > ja L(large_memcpy) > > leaq -64(%rdi, %rdx), %r8 > @@ -206,7 +231,7 @@ L(end_loop_fwd): > > /* Extactly 64 bytes if `jmp L(end_loop_fwd)` is long encoding. > 60 bytes otherwise. */ > -#define ALIGNED_LOOP_FWD(align_by); \ > +# define ALIGNED_LOOP_FWD(align_by); \ > .p2align 6; \ > L(loop_fwd_ ## align_by): \ > movaps 16(%rsi), %xmm0; \ > @@ -275,7 +300,7 @@ L(end_large_loop_fwd): > > /* Size > 64 bytes and <= 96 bytes. 32-byte align between ensure > 96-byte spacing between each. */ > -#define ALIGNED_LARGE_LOOP_FWD(align_by); \ > +# define ALIGNED_LARGE_LOOP_FWD(align_by); \ > .p2align 5; \ > L(large_loop_fwd_ ## align_by): \ > movaps 16(%rsi), %xmm0; \ > @@ -343,7 +368,7 @@ L(end_loop_bkwd): > > /* Extactly 64 bytes if `jmp L(end_loop_bkwd)` is long encoding. > 60 bytes otherwise. */ > -#define ALIGNED_LOOP_BKWD(align_by); \ > +# define ALIGNED_LOOP_BKWD(align_by); \ > .p2align 6; \ > L(loop_bkwd_ ## align_by): \ > movaps 32(%rsi), %xmm1; \ > @@ -381,4 +406,7 @@ L(loop_bkwd_ ## align_by): \ > END(MEMMOVE) > > strong_alias (MEMMOVE, MEMCPY) > +# if defined SHARED > strong_alias (MEMMOVE_CHK, MEMCPY_CHK) > +# endif > +#endif > -- > 2.34.1 > LGTM. Thanks. -- H.J. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-07-14 3:08 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-06-30 1:56 [PATCH v1] x86: Add missing IS_IN (libc) check to memmove-ssse3.S Noah Goldstein 2022-06-30 1:56 ` [PATCH v1] x86: Add missing IS_IN (libc) check to strcspn-sse4.c Noah Goldstein 2022-06-30 2:03 ` H.J. Lu 2022-06-30 1:56 ` [PATCH v1] x86: Add missing IS_IN (libc) check to strncmp-sse4_2.S Noah Goldstein 2022-06-30 2:03 ` H.J. Lu 2022-07-14 3:08 ` Sunil Pandey 2022-06-30 2:02 ` [PATCH v1] x86: Add missing IS_IN (libc) check to memmove-ssse3.S H.J. Lu
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).