From patchwork Wed Feb 6 14:58:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 157623 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp6507140jaa; Wed, 6 Feb 2019 06:59:25 -0800 (PST) X-Google-Smtp-Source: AHgI3IatwksOJdE6CsfpI8h9Jtw2g4I1e7IMkN03aElGY+RLhuW2tu90QY8Fq/oeAiViis2//hFa X-Received: by 2002:a62:2606:: with SMTP id m6mr10656967pfm.133.1549465165018; Wed, 06 Feb 2019 06:59:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549465165; cv=none; d=google.com; s=arc-20160816; b=NphuCohxQoCY37j9T75mF0LYKzQxbWLxbAN2fJluxLEQ+hyB+50Qw5tNqZEOXQUB+B bQum91zKLMPyvKtNfQhYia3xQuRgpf2UW6RjmKxad/vuq8/7jHx1mB5lFDGsUHWBigoc qSxeYbQpoI5vErVm9jxpeVSPWTIh4jn5qSpqq+bkTyX6HYQgTHQFxr2XX7ZHO3dJVBkr mvGEeQeJkqzYEYT975Vyk1VK/C8nVSsvcSyr8EuunscO2NGgU7V3At3vH5YBv5WvRQ0E OeH4wRKZeUsrlRS/1oFh4+DC3J/Ay5nNG+N4/1QZCezrAHMJSe8/BB1y0CJyy0mOKiD9 +9WQ== 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: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=S76CAuspJZwpLYcbne6+GnRiSQhycXIyeGCQWmiG0JA=; b=xMyK/yx5XUc/a/bv+BU6O6i2pawCM7rAgVBXh8XhYyBAbn0Tlwjq6i2T5enTuq0t98 Rmg7EVOGumifuWFQdwUQf9IG98ZUM48+2M3JcdUgZIYAahDa8DOtIiKAtg2VBPAcLloa 00gHEy8Ad9ZI5TI/rlV5Er3xanKuZuMBPm4Y3J84Hh7Uo3179yevQyKv79n1Q+syc+Qb kZujrwiA3JzEGinNhigTY6+Wxgd2wKzg9LZArije/TN8THY0d4eQyWSS16lVtNDjAhoL BtBiZJ0rNvHMG5o3Da542v26uV95rnlpDMGwbnYtVrL7d8Xkkg7Za9cL8w1uP0IgoM7I amxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=MwksyTfr; dkim=pass header.i=@linaro.org header.s=google header.b=l7CP17sI; spf=pass (google.com: domain of libc-alpha-return-99817-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-99817-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 n187si3425008pfn.83.2019.02.06.06.59.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Feb 2019 06:59:25 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-99817-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=MwksyTfr; dkim=pass header.i=@linaro.org header.s=google header.b=l7CP17sI; spf=pass (google.com: domain of libc-alpha-return-99817-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-99817-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:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=ZtJ4w+GVJPll8hUb5dVdRUFDuTKcQ81 CVvh/SWSZnBFQwJQgfH9hXEeDHJ2r1kFbhUMuGQBsWGzUF+DnUz9KGOVsnXD+WFV eJ0j/HtiKn8FTBeuxQX9q+PINPK5tbK7qr70bqHoT4jyUfD+RwMJadfLuecDo5wm UcacJ2Z8pdws= 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=Y90K5ByF90XZefyM6SmlKqpZQJ8=; b=Mwksy TfrBmHRQhuH/XcCJVNGiGZB1LE4G3dzfURMjvBBohCdanHfSLTtNgo1MPiQzb8Ze 34MxEdCVKGUbOgmu34Y1KxfeC8FgUS25AKlTWhvvVIYm1tOK57ucWOgUXqAfeE3b kRhQ54v+c6oCT44Tz+R4xN0cpiioTycUJUvFjQ= Received: (qmail 109503 invoked by alias); 6 Feb 2019 14:59:02 -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 109426 invoked by uid 89); 6 Feb 2019 14:59:02 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-qt1-f196.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=S76CAuspJZwpLYcbne6+GnRiSQhycXIyeGCQWmiG0JA=; b=l7CP17sIkxnKw+GB4DWpZvN5Y66SvmlgCwVnCN2UZSECi88Id5yY9jDJUhapTZQJAp 05P1PQz49P5LAz1WJecyDdJrzY6d1dwpzF6kqd1/c1RZbFEzG7+jVaTM8JvMZD4eAJUS uY8NJymmqY9q6XMVLq1FTZ0oYVjQOPuwIKIyMdXT7mg4q6cGdbwlAA3JKzFfnIDrP3/P brAjzkqrLC7Wjok0EW36nupQC7+zLPKfe/1U0KV8vRpK5uj/vBnODilzfPgtk7skHHH2 mewkhjrKH/WMoYgK2WUEks912cG7QJ+n9eFesNgZZeZgoIxhHPdUy2A+uX9Xtkdfs5aa zsaA== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 4/7] wcsmbs: optimize wcscpy Date: Wed, 6 Feb 2019 12:58:47 -0200 Message-Id: <20190206145850.22003-4-adhemerval.zanella@linaro.org> In-Reply-To: <20190206145850.22003-1-adhemerval.zanella@linaro.org> References: <20190206145850.22003-1-adhemerval.zanella@linaro.org> This patch rewrites wcscpy using wcslen and wmemcpy. This is similar to the optimization done on strcpy by b863d2bc4d. Checked on x86_64-linux-gnu. * wcsmbs/wcscpy.c (__wcpcpy): Rewrite using wcslen and wmemcpy. --- wcsmbs/wcscpy.c | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) -- 2.17.1 diff --git a/wcsmbs/wcscpy.c b/wcsmbs/wcscpy.c index 636bf6bd01..0ed4d4b3d7 100644 --- a/wcsmbs/wcscpy.c +++ b/wcsmbs/wcscpy.c @@ -19,7 +19,6 @@ #include #include - #ifdef WCSCPY # define __wcscpy WCSCPY #endif @@ -28,35 +27,7 @@ wchar_t * __wcscpy (wchar_t *dest, const wchar_t *src) { - wint_t c; - wchar_t *wcp; - - if (__alignof__ (wchar_t) >= sizeof (wchar_t)) - { - const ptrdiff_t off = dest - src - 1; - - wcp = (wchar_t *) src; - - do - { - c = *wcp++; - wcp[off] = c; - } - while (c != L'\0'); - } - else - { - wcp = dest; - - do - { - c = *src++; - *wcp++ = c; - } - while (c != L'\0'); - } - - return dest; + return __wmemcpy (dest, src, __wcslen (src) + 1); } #ifndef WCSCPY weak_alias (__wcscpy, wcscpy)