From patchwork Tue Jun 12 22:19:23 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: 27760 Received: (qmail 91567 invoked by alias); 12 Jun 2018 22:19:48 -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 91457 invoked by uid 89); 12 Jun 2018 22:19:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.1 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_SOFTFAIL autolearn=ham version=3.3.2 spammy=2711, UD:sym 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 04/20] libcpu-rt-c/x86-64: Add memchr Date: Tue, 12 Jun 2018 15:19:23 -0700 Message-Id: <20180612221939.19545-5-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 memchr. (vpath %.c $(..)string): New. * sysdeps/x86_64/memchr.S: Don't define alias __memchr in libcpu-rt-c. * sysdeps/x86_64/multiarch/Makefile (libcpu-rt-c-sysdep_routines): Add memchr-sse2 and memchr-avx2. * sysdeps/x86_64/multiarch/memchr-avx2.S: Support libcpu-rt-c. * sysdeps/x86_64/multiarch/memchr-sse2.S: Likewise. * sysdeps/x86_64/multiarch/memchr.c: Likewise. --- sysdeps/x86_64/Makefile | 7 +++++++ sysdeps/x86_64/memchr.S | 2 +- sysdeps/x86_64/multiarch/Makefile | 4 ++++ sysdeps/x86_64/multiarch/memchr-avx2.S | 2 +- sysdeps/x86_64/multiarch/memchr-sse2.S | 2 +- sysdeps/x86_64/multiarch/memchr.c | 6 ++++-- 6 files changed, 18 insertions(+), 5 deletions(-) diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile index 9f1562f1b2..d8f6d83d88 100644 --- a/sysdeps/x86_64/Makefile +++ b/sysdeps/x86_64/Makefile @@ -146,6 +146,13 @@ CFLAGS-tst-avx512mod.c += $(AVX512-CFLAGS) endif endif +ifeq ($(subdir),cpu-rt-c) +cpu-rt-c-routines += memchr + +# For the CPU run-time tests. +vpath %.c $(..)string +endif + ifeq ($(subdir),csu) gen-as-const-headers += tlsdesc.sym rtld-offsets.sym endif diff --git a/sysdeps/x86_64/memchr.S b/sysdeps/x86_64/memchr.S index feef5d4f24..2a17b01733 100644 --- a/sysdeps/x86_64/memchr.S +++ b/sysdeps/x86_64/memchr.S @@ -324,7 +324,7 @@ L(return_null): ret END(MEMCHR) -#ifndef USE_AS_WMEMCHR +#if !defined USE_AS_WMEMCHR && !IS_IN (libcpu_rt_c) strong_alias (memchr, __memchr) libc_hidden_builtin_def(memchr) #endif diff --git a/sysdeps/x86_64/multiarch/Makefile b/sysdeps/x86_64/multiarch/Makefile index bb5e970735..2c43179b0f 100644 --- a/sysdeps/x86_64/multiarch/Makefile +++ b/sysdeps/x86_64/multiarch/Makefile @@ -65,3 +65,7 @@ sysdep_routines += memcpy_chk-nonshared mempcpy_chk-nonshared \ memmove_chk-nonshared memset_chk-nonshared \ wmemset_chk-nonshared endif + +ifeq ($(subdir),cpu-rt-c) +libcpu-rt-c-sysdep_routines += memchr-sse2 memchr-avx2 +endif diff --git a/sysdeps/x86_64/multiarch/memchr-avx2.S b/sysdeps/x86_64/multiarch/memchr-avx2.S index 5f5e772554..15710b69f6 100644 --- a/sysdeps/x86_64/multiarch/memchr-avx2.S +++ b/sysdeps/x86_64/multiarch/memchr-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/memchr-sse2.S b/sysdeps/x86_64/multiarch/memchr-sse2.S index 8a5e7fd1c5..6f299d5119 100644 --- a/sysdeps/x86_64/multiarch/memchr-sse2.S +++ b/sysdeps/x86_64/multiarch/memchr-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 memchr __memchr_sse2 # undef strong_alias diff --git a/sysdeps/x86_64/multiarch/memchr.c b/sysdeps/x86_64/multiarch/memchr.c index 016f57846a..25927f72ed 100644 --- a/sysdeps/x86_64/multiarch/memchr.c +++ b/sysdeps/x86_64/multiarch/memchr.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 memchr __redirect_memchr # include # undef memchr @@ -27,9 +27,11 @@ # include "ifunc-avx2.h" libc_ifunc_redirected (__redirect_memchr, memchr, IFUNC_SELECTOR ()); +# if !IS_IN (libcpu_rt_c) strong_alias (memchr, __memchr) -# ifdef SHARED +# ifdef SHARED __hidden_ver1 (memchr, __GI_memchr, __redirect_memchr) __attribute__((visibility ("hidden"))); +# endif # endif #endif