From patchwork Wed Mar 13 14:03:16 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: 160227 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp14356717jad; Wed, 13 Mar 2019 07:03:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqxklic1ArKGLBGRcSrg7EXBokmiJL1bjPH1ULn4HRsvWw1QMI3TFdmZEKv35+M3UT9QU2O2 X-Received: by 2002:a65:4844:: with SMTP id i4mr39115879pgs.347.1552485835387; Wed, 13 Mar 2019 07:03:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552485835; cv=none; d=google.com; s=arc-20160816; b=BDni5XN3/54W2lwCficJqegJKrWceUvHCk6Bhntsc/KtvDtaqaRTJUbWF4fQEvVtPw xLztaIbf3q16OwpOEn/Rk2/aFEA2etmnHbnhOEbcdXlajuI/Tv/d/gumf/93s8s6Osu8 xn35fcn0wk9QYO7f515r/NARhAfnimf6ga+YN2rAtggKCI6tMWlCLxkGaWCqcnnb459s T/1SdBdQUyamjcE+/jgHlzA2FuUZUWlmpZ7j8uzBrItjT8yZ87w6eKW/MvwP7rjQnN+u /k4z/6d/i2BMErb1c92Aa68gr7LoGsDaox91pjGQHtTvHciC/WChWK/Y7Ni4v32jgDF2 Z6oQ== 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=KNrpbzpBrZvGtGrOIdkVTTMiuW1TDfvWHPcrpBf6qzo=; b=wc2grFUZx+e2TfcsSoTxYatoeMNjJ4Xxy3ImePD0vrL1iapcEUng+R4mxNDgtYK7PO MYipluNpJ3v/zPM1VjAYYZ8QDYp4F4gHCjx0MMpgAlnhwc8WK3WtxJSqd+z+JFUZstlP UR/ii0f9RB5YNDo7EktfgQj8QUajT87KONNi7gpY3lYuFUGJw1OPoYTOU3Gxo1KojQwN 4kMeCO1uuG0jQQqnlXnZNyp5aqPoOC15V+1wJp3vXubbQXzOqOZV6nzGtVfjHS8gyRde TGcU0psXW2ghbAUS+F0LTv6t5ynYiRgMrZcuOLAkr2aKjeRe5780GPbbLOiekE0a1u3H ZifQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=Jaod15O+; dkim=pass header.i=@linaro.org header.s=google header.b=aRpXDFL0; spf=pass (google.com: domain of libc-alpha-return-100600-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-100600-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 l27si10439249pfb.258.2019.03.13.07.03.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Mar 2019 07:03:55 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-100600-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=Jaod15O+; dkim=pass header.i=@linaro.org header.s=google header.b=aRpXDFL0; spf=pass (google.com: domain of libc-alpha-return-100600-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-100600-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=GWgWRW76BMlVlTF7Bl0MbX6K7nncKZy 5/9b8eWKUng/DjQW6OvvZq63POeI46WPLvy60h+x8l2pGbYCV7awMUWAoU7lAoZY m2HBgZt/O4bcSYSKaZ8dX1sAOpDyUYsxkEAe1Kl2rXSyQDIQ90wyKNqWzFAmDBRP FmEiSyUwpeFI= 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=/QaCmere3hZ55JhHJCn5q8R7j2M=; b=Jaod1 5O+ehJYD0PCwgbjIyztSy0T6viHJvcuE9fN2P2VMHXWQoxR/8r4Hf4iFfLtecBee s2AEf+vBQvhkPaAbPdCdGhNVq9U/cRW6+j1dFrq8A+3b+VMVRv8i+GT54PfoIDxZ 3b/0Fb11c+S4jinft1Sk6xrZk51Fg4F1PdpTmU= Received: (qmail 51631 invoked by alias); 13 Mar 2019 14:03:33 -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 51544 invoked by uid 89); 13 Mar 2019 14:03:33 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-14.7 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:1086, H*MI:sk:2019031 X-HELO: mail-vs1-f46.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=KNrpbzpBrZvGtGrOIdkVTTMiuW1TDfvWHPcrpBf6qzo=; b=aRpXDFL07PSFBO3/xCxGV07lB4dHfoB3GXvdoLLrf/vDb6vDeoEJKK7RzihXciulw1 jdgjklJYAAH8LRera3kdb4iGtvHNsOAuIJvUouA2QZvb6t8F1qwneTZFJNg0xP1ZyO6p 20y5XuH8L4nhipWDbhDH3TRanZlwH/LmhdbxfILdtLircsvTNWuRfhqgO4K7cMrJBDIt hW0zJ7/n/z8bpDt+Cn80uLqe3R3/5tDyZxE24CpdjgAHG52BfyRZWt0bjcfihoJ4sGlG kwWZP39QJpJSEkpZ1bhenHPPc8N9BszMkMuGBzfPXUMEbpIS5DDRK3rb6HIUqC1LGUYa R2Ow== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: "Gabriel F . T . Gomes" Subject: [PATCH v2 5/6] wcsmbs: Use loop_unroll on wcsrchr Date: Wed, 13 Mar 2019 11:03:16 -0300 Message-Id: <20190313140317.8894-5-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/wcsrchr.c (WCSRCHR): Use loop_unroll.h to parametrize the loop unroll. --- wcsmbs/wcsrchr.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) -- 2.17.1 Reviewed-by: Gabriel F. T. Gomes diff --git a/wcsmbs/wcsrchr.c b/wcsmbs/wcsrchr.c index 0d4bad0704..3175df357d 100644 --- a/wcsmbs/wcsrchr.c +++ b/wcsmbs/wcsrchr.c @@ -17,6 +17,7 @@ . */ #include +#include #ifndef WCSRCHR # define WCSRCHR wcsrchr @@ -26,12 +27,21 @@ wchar_t * WCSRCHR (const wchar_t *wcs, const wchar_t wc) { - const wchar_t *retval = NULL; + wchar_t *retval = NULL; - do - if (*wcs == wc) - retval = wcs; - while (*wcs++ != L'\0'); +#define ITERATION(index) \ + ({ \ + if (*wcs == wc) \ + retval = (wchar_t*) wcs; \ + *wcs++ != L'\0'; \ + }) - return (wchar_t *) retval; +#ifndef UNROLL_NTIMES +# define UNROLL_NTIMES 1 +#endif + + while (1) + UNROLL_REPEAT(UNROLL_NTIMES, ITERATION); + + return retval; }