From patchwork Tue Jun 12 22:19:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 27763 Received: (qmail 92101 invoked by alias); 12 Jun 2018 22:19:52 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 91878 invoked by uid 89); 12 Jun 2018 22:19:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-23.8 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, KAM_STOCKGEN, SPF_SOFTFAIL autolearn=ham version=3.3.2 spammy= X-HELO: mga01.intel.com X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 From: "H.J. Lu" To: libc-alpha@sourceware.org Subject: [PATCH 07/20] libcpu-rt-c/x86-64: Add memrchr Date: Tue, 12 Jun 2018 15:19:26 -0700 Message-Id: <20180612221939.19545-8-hjl.tools@gmail.com> In-Reply-To: <20180612221939.19545-1-hjl.tools@gmail.com> References: <20180612221939.19545-1-hjl.tools@gmail.com> * sysdeps/x86_64/Makefile (cpu-rt-c-routines): Add memrchr. * sysdeps/x86_64/memrchr.S: Support libcpu-rt-c. * sysdeps/x86_64/multiarch/memrchr-avx2.S: Likewise. * sysdeps/x86_64/multiarch/memrchr-sse2.S: Likewise. * sysdeps/x86_64/multiarch/memrchr.c: Likewise. * sysdeps/x86_64/multiarch/Makefile (libcpu-rt-c-sysdep_routines): Add memrchr-sse2 and memrchr-avx2. --- sysdeps/x86_64/Makefile | 2 +- sysdeps/x86_64/memrchr.S | 6 ++++++ sysdeps/x86_64/multiarch/Makefile | 3 ++- sysdeps/x86_64/multiarch/memrchr-avx2.S | 2 +- sysdeps/x86_64/multiarch/memrchr-sse2.S | 2 +- sysdeps/x86_64/multiarch/memrchr.c | 8 +++++++- 6 files changed, 18 insertions(+), 5 deletions(-) diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile index 978cff6cba..da3264f27f 100644 --- a/sysdeps/x86_64/Makefile +++ b/sysdeps/x86_64/Makefile @@ -147,7 +147,7 @@ endif endif ifeq ($(subdir),cpu-rt-c) -cpu-rt-c-routines += memchr memcmp memcpy memmove mempcpy +cpu-rt-c-routines += memchr memcmp memcpy memmove mempcpy memrchr # For the CPU run-time tests. vpath %.c $(..)string diff --git a/sysdeps/x86_64/memrchr.S b/sysdeps/x86_64/memrchr.S index b8e3fa1d87..1488225145 100644 --- a/sysdeps/x86_64/memrchr.S +++ b/sysdeps/x86_64/memrchr.S @@ -20,6 +20,10 @@ #include +#if !defined __memrchr && IS_IN (libcpu_rt_c) +# define __memrchr memrchr +#endif + .text ENTRY (__memrchr) movd %esi, %xmm1 @@ -377,4 +381,6 @@ L(length_less16_part2_return): ret END (__memrchr) +#if !IS_IN (libcpu_rt_c) weak_alias (__memrchr, memrchr) +#endif diff --git a/sysdeps/x86_64/multiarch/Makefile b/sysdeps/x86_64/multiarch/Makefile index 8e86e44e33..582ca629d0 100644 --- a/sysdeps/x86_64/multiarch/Makefile +++ b/sysdeps/x86_64/multiarch/Makefile @@ -75,5 +75,6 @@ libcpu-rt-c-sysdep_routines += memchr-sse2 memchr-avx2 \ memmove-ssse3 memmove-ssse3-back \ memmove-avx-unaligned-erms \ memmove-avx512-unaligned-erms \ - memmove-avx512-no-vzeroupper + memmove-avx512-no-vzeroupper \ + memrchr-sse2 memrchr-avx2 endif diff --git a/sysdeps/x86_64/multiarch/memrchr-avx2.S b/sysdeps/x86_64/multiarch/memrchr-avx2.S index b41a58bcba..ee4d461fe2 100644 --- a/sysdeps/x86_64/multiarch/memrchr-avx2.S +++ b/sysdeps/x86_64/multiarch/memrchr-avx2.S @@ -16,7 +16,7 @@ License along with the GNU C Library; if not, see . */ -#if IS_IN (libc) +#if IS_IN (libc) || IS_IN (libcpu_rt_c) # include diff --git a/sysdeps/x86_64/multiarch/memrchr-sse2.S b/sysdeps/x86_64/multiarch/memrchr-sse2.S index 12281663ec..f0d0668262 100644 --- a/sysdeps/x86_64/multiarch/memrchr-sse2.S +++ b/sysdeps/x86_64/multiarch/memrchr-sse2.S @@ -16,7 +16,7 @@ License along with the GNU C Library; if not, see . */ -#if IS_IN (libc) +#if IS_IN (libc) || IS_IN (libcpu_rt_c) # define __memrchr __memrchr_sse2 # undef weak_alias diff --git a/sysdeps/x86_64/multiarch/memrchr.c b/sysdeps/x86_64/multiarch/memrchr.c index d227fe7819..da4cff9e22 100644 --- a/sysdeps/x86_64/multiarch/memrchr.c +++ b/sysdeps/x86_64/multiarch/memrchr.c @@ -18,7 +18,7 @@ . */ /* Define multiple versions only for the definition in libc. */ -#if IS_IN (libc) +#if IS_IN (libc) || IS_IN (libcpu_rt_c) # define memrchr __redirect_memrchr # include # undef memrchr @@ -26,6 +26,12 @@ # define SYMBOL_NAME memrchr # include "ifunc-avx2.h" +# if IS_IN (libcpu_rt_c) +# define __memrchr memrchr +# endif + libc_ifunc_redirected (__redirect_memrchr, __memrchr, IFUNC_SELECTOR ()); +# if !IS_IN (libcpu_rt_c) weak_alias (__memrchr, memrchr) +# endif #endif