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: 928510 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-93108-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="YVT4OqSW"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4154835KRyz9s0W for ; Wed, 13 Jun 2018 08:20:19 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=XFkCR1lHAbo1uAQaEReXnADPBKnCZb6 eVrTD6FLrIwYYs+Qe62qLh5QCWFDGLhB09PAYceazNgn6nBt/OI509RbjNLwpAtk h6AfdNKdju8HGdbc3FtGpQXYW3I+8pgD/BvPCFOR9d4SjZ/MH3z3FToeWl8gmHQ5 nBp9wIr4bOFE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=M8hh2zAfDx7Vqt0jhmkfGdjfqSU=; b=YVT4O qSWnMncz/pZGj/js2TvckcjWrueCnlGsgzXCQvh+Y+x1Tnh39257+P4B6r4bTOu0 t4CQZmgfiC7X66Dr6zMgmTF6fR3xw45etrm+fBSmDJ6163uLO7W5SB8yjMEQVtyC yM025ah8Yq4v2xovwAtsd+pN09RTJjUA/v2r5Y= 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