From patchwork Wed Mar 13 14:03:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 160225 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp14356360jad; Wed, 13 Mar 2019 07:03:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqyEA/NfChOGJbdfgLv/ERty3EUf5Z/9ngEGsyglpeQBWsXTmG3jOsexO14E5ihDL0gWQ5FB X-Received: by 2002:a17:902:bb94:: with SMTP id m20mr28151539pls.255.1552485818786; Wed, 13 Mar 2019 07:03:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552485818; cv=none; d=google.com; s=arc-20160816; b=D+pqnT36SHrz8FWsjqDefQbXOFp9rEneIITEQ6ZFG5LOhNh6LL+VVarFzWfF5SdWU3 YMcx9tNiotLbG94eQhue2kDzFUUa351+iErmQYeuBrfCLLIrJLiR/Rz6IrNDQlh64IT/ R/qfSnPqZMZjj4Xl7Rvq2gU28IBgFDbhi+0dZr0yOcn5iSb0raaWxJmnyJFc5/nHJnG+ h5pfALFqt4n/D1Eo1kL6izLtLoBa52/+smvGPOEj7o3tw+UiBr2YS4LxN9DeBw5iVhXR +dXKu2uGno33Mj8LOiGQJpUdTm6A3iHnHcC+HUISqZgN9OsoVqRdMFu6xvwu99KDyah9 /46A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=jG1CqdlcTGnjtCkG3W0BkSrbbCiCMm7705l1Lj0MZDo=; b=lwn5eSlJKIPKJJ0EqxZjBTsszSIwsxkJQMyLq9M0BJDJJS1nqXFy794lkHOSpZM6pL YxyaqZEcEi02DCr1VXrjXGC/ba1j2RJBvR9ho5INjz/ylZyZ78CcVUz5Aj/V9UANs+P/ BGXmHJMdb7nWmZS6Ktc1vQGey5NNx10GoSz8aSyLjzMDjjxkuRnDBcQr73IHjCI33XVD S4CRmi4h7ZngkQsGqJT9huRiSJZq2WzSgcZIRUpzamFkQgKL2d2fF0GhZFNGjF6S3n+b +UyQmO4ifi8r2JJfEmEeGnkBuTvUrmHQkyhjsmFTQloo80wuANCrxWK/d977+Fu26O1G letQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=kIpVySMI; dkim=pass header.i=@linaro.org header.s=google header.b=yfrERmFZ; spf=pass (google.com: domain of libc-alpha-return-100598-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-100598-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id 101si6261133pld.334.2019.03.13.07.03.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Mar 2019 07:03:38 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-100598-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=kIpVySMI; dkim=pass header.i=@linaro.org header.s=google header.b=yfrERmFZ; spf=pass (google.com: domain of libc-alpha-return-100598-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-100598-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=cFabiI4qkpoeUbNqf8SGwcde7ncWN09 AAy/TOZCNBSo22P1b5425GfIDXWQkfaWmJW2pMzllFjM4I6KPYfgJdUyv2ctGfAx +gjcFsd2w1vPVItoHv1XxONQBj26/4bbFSqXggGPDy7srOvPlrVzObaMgZyvSUiv aYIWcOSb9dCw= 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:cc:subject:date:message-id:in-reply-to :references; s=default; bh=xCSNuHktyLFwnRx1y4J8h3LC1eY=; b=kIpVy SMIvATc/5ipyOUiIEoZ3tm3yhcgFv51w1Rck+81LnPBo8q+DgUoPYl8hJPGOcKfM abxL363k2zvluf4ntATuq2Sl1D4h8j32J9bR+PiIG0kBTK1qQCpx7ZETrgX5nf7e ppqUOQpv0i59eXSAK3r63znVFptHdWbzj6H57U= Received: (qmail 50985 invoked by alias); 13 Mar 2019 14:03:29 -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 50976 invoked by uid 89); 13 Mar 2019 14:03:29 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-14.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1108, H*MI:sk:2019031 X-HELO: mail-ua1-f67.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jG1CqdlcTGnjtCkG3W0BkSrbbCiCMm7705l1Lj0MZDo=; b=yfrERmFZxrApiarYCQ/ulr7go1CEVsC2ZMPM+lFVB3ELf4DG9DqmhmTZbWjsPFe/ae ESV5J1U1tsqoEArvVMeMuqZ6oJOa+SehOjKwN4vjqkZHxH74ZFbZ/hjYaO3H0Xd3USSl fmWjHxRT+5er5n0PIDs644K0lpBXotqpwjCCxRZz84udFGpQkvvg6JQLR9RILleb8jUR mzNABKom2gIiVaSFwJ7D5/veWAi/cgjIV+vwEqQ75dMFE1w3wc8Xr248yCDOUVmPdhaF 1OZEv1ZfBDYYNdELqI16tDh2W71Y8cSpQBACW4GnBrG81kzfMF1xOgo1/zWwxh7gMlk3 ONjw== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: "Gabriel F . T . Gomes" Subject: [PATCH v2 3/6] wcsmbs: Use loop_unroll on wcschr Date: Wed, 13 Mar 2019 11:03:14 -0300 Message-Id: <20190313140317.8894-3-adhemerval.zanella@linaro.org> In-Reply-To: <20190313140317.8894-1-adhemerval.zanella@linaro.org> References: <20190313140317.8894-1-adhemerval.zanella@linaro.org> This allows an architecture to set explicit loop unrolling. Checked on aarch64-linux-gnu. * wcsmbs/wcschr.c (WCSCHR): Use loop_unroll.h to parametrize the loop unroll. --- wcsmbs/wcschr.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) -- 2.17.1 Reviewed-by: Gabriel F. T. Gomes diff --git a/wcsmbs/wcschr.c b/wcsmbs/wcschr.c index cd66b2a58c..9de302298d 100644 --- a/wcsmbs/wcschr.c +++ b/wcsmbs/wcschr.c @@ -16,6 +16,7 @@ . */ #include +#include #ifndef WCSCHR # define WCSCHR __wcschr @@ -25,12 +26,23 @@ wchar_t * WCSCHR (const wchar_t *wcs, const wchar_t wc) { - do - if (*wcs == wc) - return (wchar_t *) wcs; - while (*wcs++ != L'\0'); + wchar_t *dest = NULL; - return NULL; +#define ITERATION(index) \ + ({ \ + if (*wcs == wc) \ + dest = (wchar_t*) wcs; \ + dest == NULL && *wcs++ != L'\0'; \ + }) + +#ifndef UNROLL_NTIMES +# define UNROLL_NTIMES 1 +#endif + + while (1) + UNROLL_REPEAT(UNROLL_NTIMES, ITERATION); + + return dest; } libc_hidden_def (__wcschr) weak_alias (__wcschr, wcschr)