More NEWS entries / fixes for float_t / double_t changes.
[glibc.git] / sysdeps / aarch64 / rawmemchr.S
blobec958e8f54e308c8f28b37f7265e788e281dcc6d
1 /* rawmemchr - find a character in a memory zone
3    Copyright (C) 2015 Free Software Foundation, Inc.
5    This file is part of the GNU C Library.
7    The GNU C Library is free software; you can redistribute it and/or
8    modify it under the terms of the GNU Lesser General Public
9    License as published by the Free Software Foundation; either
10    version 2.1 of the License, or (at your option) any later version.
12    The GNU C Library is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15    Lesser General Public License for more details.
17    You should have received a copy of the GNU Lesser General Public
18    License along with the GNU C Library.  If not, see
19    <http://www.gnu.org/licenses/>.  */
21 #include <sysdep.h>
23 /* Special case rawmemchr (s, 0) as strlen, otherwise tailcall memchr.
24    Call strlen without setting up a full frame - it preserves x14/x15.
27 ENTRY (__rawmemchr)
28         cbz     w1, L(do_strlen)
29         mov     x2, -1
30         b       __memchr
32 L(do_strlen):
33         mov     x15, x30
34         cfi_return_column (x15)
35         mov     x14, x0
36         bl      __strlen
37         add     x0, x14, x0
38         ret     x15
40 END (__rawmemchr)
41 weak_alias (__rawmemchr, rawmemchr)
42 libc_hidden_builtin_def (__rawmemchr)