1 /* Copyright (C) 2012-2023 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library. If not, see
17 <https://www.gnu.org/licenses/>. */
23 * ARMv8-a, AArch64, Advanced SIMD.
28 # define STRLEN __strlen
46 Process the string in 16-byte aligned chunks. Compute a 64-bit mask with
47 four bits per byte using the shrn instruction. A count trailing zeros then
48 identifies the first zero byte. */
53 ld1 {vdata.16b}, [src]
54 cmeq vhas_nul.16b, vdata.16b, 0
56 shrn vend.8b, vhas_nul.8h, 4 /* 128->64 */
69 cmeq vhas_nul.16b, vdata.16b, 0
70 umaxp vend.16b, vhas_nul.16b, vhas_nul.16b
72 cbnz synd, L(loop_end)
74 cmeq vhas_nul.16b, vdata.16b, 0
75 umaxp vend.16b, vhas_nul.16b, vhas_nul.16b
80 shrn vend.8b, vhas_nul.8h, 4 /* 128->64 */
81 sub result, src, srcin
86 add result, result, 16
88 add result, result, tmp, lsr 2
92 weak_alias (STRLEN, strlen)
93 libc_hidden_builtin_def (strlen)