From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14925 invoked by alias); 27 Feb 2013 17:44:57 -0000 Received: (qmail 14853 invoked by uid 22791); 27 Feb 2013 17:44:54 -0000 X-SWARE-Spam-Status: No, hits=-5.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_SPAMHAUS_DROP,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-vc0-f169.google.com (HELO mail-vc0-f169.google.com) (209.85.220.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 27 Feb 2013 17:44:50 +0000 Received: by mail-vc0-f169.google.com with SMTP id n10so570872vcn.28 for ; Wed, 27 Feb 2013 09:44:49 -0800 (PST) X-Received: by 10.52.29.136 with SMTP id k8mr1059941vdh.40.1361987089112; Wed, 27 Feb 2013 09:44:49 -0800 (PST) Received: from anchor.twiddle.net (50-194-63-110-static.hfc.comcastbusiness.net. [50.194.63.110]) by mx.google.com with ESMTPS id b9sm757891vee.3.2013.02.27.09.44.46 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 27 Feb 2013 09:44:48 -0800 (PST) Message-ID: <512E460C.6050708@twiddle.net> Date: Wed, 27 Feb 2013 17:44:00 -0000 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130219 Thunderbird/17.0.3 MIME-Version: 1.0 To: =?ISO-8859-1?Q?M=E5ns_Rullg=E5rd?= CC: libc-ports@sourceware.org, Joseph Myers Subject: Re: [PATCH 20/26] arm: Implement armv6t2 optimized strlen References: <1361934986-17018-1-git-send-email-rth@twiddle.net> <1361934986-17018-21-git-send-email-rth@twiddle.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact libc-ports-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: libc-ports-owner@sourceware.org X-SW-Source: 2013-02/txt/msg00106.txt.bz2 On 02/27/2013 09:12 AM, Måns Rullgård wrote: > Richard Henderson writes: > >> +ENTRY(strlen) ... >> + @ Loop searching for EOS or C, 8 bytes at a time. > > This comment seems to be for strchr(). Whoops. As you can imagine there's some amount of cut and paste here. ;-) > Subtracting the values (with UQSUB8) from 1 instead would result in a 0 > result any non-zero input and a 1 for "found", i.e. the inverse of what > you have here. Testing for a match anywhere in the double-word then > becomes a single ORRS instruction. Unless I'm making some stupid mistake. Yes, this works. And a good idea for improvement. > This code could be made to work for any ARMv6 by (conditionally) > replacing the MOVW/MOVT with some equivalent and the RBIT by REV. REV > works since only the lsb in each byte can be set, so the result of CLZ > will simply be 7 more than we want, and the 3 low-order bits are shifted > out anyway. Ah, I'd mis-read the document the first time round and thought uqadd8 was an armv6t2 instruction. I'll rearrange all these so that armv6 can benefit. Which makes patch 3 once again useful... ;-) r~