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: 928514 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-93111-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="rzx7fmwv"; 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 41548b2W3Qz9s31 for ; Wed, 13 Jun 2018 08:20:47 +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=YvJgQvu34Iwy/1zOgzM8iShgl0IbJgA Ax5MJ7Pfiwj9HrB3ncV5usrRt73LwzmMbv3vXRZhUdddEA2Crgs9vGTJ5Qn+C6V+ OZJYx0JTjRhz3z9ZsKCsTFJXw4ZfA4raGgp8bT1ctiInusFbUvWctSbflAypn0oy j1SFbz3skMc0= 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=Ec0qYiBSgh3xYd3Ughb0HDbV2uQ=; b=rzx7f mwvTS4B5tiPPEMXmU306ecqviuA4BwhPJvhLDpl427kvbk6HHds6mARjwyBUZyd2 tQfOV75ds3ZJ+Dn+kbC+AUG2QNUetmruBU1zLUTdERP3r1QkG+LtEdEE9xclIN58 Jw/qgspRGTtvu1ZnajxvA6Jx2dNlVVNsSZUlRg= 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