4
@ Copyright (c) 2010-2011, Linaro Limited
7
@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
9
@ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
10
@ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
11
@ * Neither the name of Linaro Limited nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
13
@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15
@ Written by Dave Gilbert <david.gilbert@linaro.org>
17
@ A very simple strchr routine, from benchmarks on A9 it's a bit faster than the
18
@ current version in eglibc (2.12.1-0ubuntu14 package)
19
@ I don't think doing a word at a time version is worth it since a lot
20
@ of strchr cases are very short anyway
22
@ 2011-02-07 david.gilbert@linaro.org
23
@ Extracted from local git a5b438d861
28
@ ---------------------------------------------------------------------------
34
.type strchr,%function
36
@ r0 = start of string
37
@ r1 = character to match
38
@ returns NULL for no match, or a pointer to the match
46
@ We're here if it matched
52
@ We're here if we ran off the end
53
cmp r1, #0 @ Corner case - you're allowed to search for the nil and get a pointer to it
54
beq 5b @ A bit messy, if it's common we should branch at the start to a special loop