This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
Re: [ARM] Optimised strchr and strlen
- From: Richard Henderson <rth at twiddle dot net>
- To: "Dr. David Alan Gilbert" <david dot gilbert at linaro dot org>
- Cc: libc-ports at sourceware dot org, joseph at codesourcery dot com, patches at linaro dot org
- Date: Tue, 20 Dec 2011 12:29:31 -0800
- Subject: Re: [ARM] Optimised strchr and strlen
- References: <20111219172122.GA10120@davesworkthinkpad>
On 12/19/2011 09:21 AM, Dr. David Alan Gilbert wrote:
> + @ r1 currently points to the 2nd byte of the word containing the 0
> + tst r2, # CHARTSTMASK(0) @ 1st character
> + bne 10f
> + adds r1,r1,#1
> + tst r2, # CHARTSTMASK(1) @ 2nd character
> + ittt eq
> + addeq r1,r1,#1
> + tsteq r2, # (3<<15) @ 2nd & 3rd character
> + @ If not the 3rd must be the last one
> + addeq r1,r1,#1
No need to search -- clz can do that for you.
#ifdef __ARMEL__
rbit r2, r2
#endif
clz r2, r2
lsrs r2, r2, #3
adds r1, r1, r2
r~