Lines Matching +full:16 +full:- +full:byte

1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (c) 2013-2021, Arm Limited.
6 * https://github.com/ARM-software/optimized-routines/blob/98e4d6a5c13c8e54/string/aarch64/strlen.S
11 #include <asm/mte-def.h>
15 * ARMv8-a, AArch64, unaligned accesses, min page size 4k.
36 /* NUL detection works on the principle that (X - 1) & (~X) & 0x80
37 (=> (X - 1) & ~(X | 0x7f)) is non-zero iff a byte is zero, and
39 (X - 1) & 0x80 is zero for non-NUL ASCII characters, but gives
48 * (16-byte) granularity, and we must ensure that no access straddles this
57 /* Since strings are short on average, we check the first 16 bytes
60 byte we calculate the length from the 2 8-byte words using
64 If the string is longer than 16 bytes, we align src so don't need
66 using the fast NUL check. If we encounter non-ASCII characters,
69 If the page cross check fails, we read 16 bytes from an aligned
72 page in the first 16 bytes are rare (probability of
73 16/MIN_PAGE_SIZE ~= 0.4%), this case does not need to be optimized.
76 checking for larger page sizes - the cost of setting up the correct
83 and tmp1, srcin, MIN_PAGE_SIZE - 1
85 cmp tmp1, MIN_PAGE_SIZE - 16
89 /* For big-endian, carry propagation (if the final byte in the
91 Since we expect strings to be small and early-exit,
92 byte-swap the data now so has_null1/2 will be correct. */
115 NUL check. If we encounter non-ASCII characters, use a second
120 sub src, src, 16
129 ldp data1, data2, [src, 16]
135 add src, src, 16
148 /* For big-endian, carry propagation (if the final byte in the
150 easiest way to get the correct byte is to byte-swap the data
169 ldp data1, data2, [src, 16]!
178 ldp data1, data2, [src, 16]!
189 /* Load 16 bytes from [srcin & ~15] and force the bytes that precede
196 mov tmp4, -1
198 /* Big-endian. Early bytes are at MSB. */
201 /* Little-endian. Early bytes are at LSB. */