From patchwork Thu Aug 7 13:40:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wilco X-Patchwork-Id: 377890 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 18069140077 for ; Thu, 7 Aug 2014 23:40:54 +1000 (EST) 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:mime-version :content-type; q=dns; s=default; b=lcNkl+5YP0zIeKIYP0K2bd7WqA+uy nPxRi7YWQ+im/FeK7N3ioySnH0greVb9VF3jCXxAA0tvqe83TDmlqaViCnP58+Jl K+CFGvL5umMgl7GEl6r7CWBJWmEaePlvZTDQ8vMdTeZJ06qOioP4jiBlBNumBllp IzV9sFNIawkLbE= 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:mime-version :content-type; s=default; bh=ewCAauuqXMvTaExtF1KL4Q8WpIA=; b=WGA qqmtF6oNwVZJZpet0jTS3ql9O5BVCAokA1Biy7+sO0BDugj2s+78FV/0i8xKRxbV CIcyP1xt6C9Kn6Kuk8w+7LEG9ql9XkFUT2oA41xlWG+uEoBW/OwIflU0s0JSmnJj hfrzPnc4+kMc//JGfbIQey9v7GZCQuAA43Cv0vMY= Received: (qmail 24396 invoked by alias); 7 Aug 2014 13:40:39 -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 24309 invoked by uid 89); 7 Aug 2014 13:40:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 X-HELO: service87.mimecast.com From: "Wilco Dijkstra" To: Subject: [PATCH] ARM: Fix performance issue in strcpy Date: Thu, 7 Aug 2014 14:40:20 +0100 Message-ID: <000501cfb245$2248d600$66da8200$@com> MIME-Version: 1.0 X-MC-Unique: 114080714403406201 Hi, This patch fixes a performance bug in strcp. The code dealing with unaligned copies uses mvns to detect whether a register is 0. This is incorrect - the zero flag is only set if the value is -1. As a result the code always does a byte-by-byte copy for the full string rather than doing the word-based copy for the misaligned cases. Fixing this more than doubles performance. OK for commit? ChangeLog: 2014-08-07 Wilco Dijkstra * sysdeps/arm/armv6/strcpy.S (strcpy): Fix performance issue in misaligned cases. --- sysdeps/arm/armv6/strcpy.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sysdeps/arm/armv6/strcpy.S b/sysdeps/arm/armv6/strcpy.S index 833a83c..67bd9d8 100644 --- a/sysdeps/arm/armv6/strcpy.S +++ b/sysdeps/arm/armv6/strcpy.S @@ -159,7 +159,7 @@ ENTRY (strcpy) @ Prologue to unaligned loop. Seed shifted non-zero bytes. uqsub8 r4, r7, r2 @ Find EOS uqsub8 r5, r7, r3 - mvns r4, r4 @ EOS in first word? + cmp r4, #0 @ EOS in first word? it ne subne r1, r1, #8 bne .Lbyte_loop @@ -179,7 +179,7 @@ ENTRY (strcpy) @ Rotated unaligned copy loop. The tail of the prologue is @ shared with the loop itself. .balign 8 -1: mvns r5, r5 @ EOS in second word? +1: cmp r5, #0 @ EOS in second word? bne 4f @ Combine first and second words orr r2, r2, r3, lsh_gt #(\unalign*8) @@ -194,7 +194,7 @@ ENTRY (strcpy) sfi_pld r1, #128 uqsub8 r5, r7, r3 sfi_pld r0, #128 - mvns r4, r4 @ EOS in first word? + cmp r4, #0 @ EOS in first word? bne 3f @ Combine the leftover and the first word orr r6, r6, r2, lsh_gt #(\unalign*8)