1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* strlen.S: Sparc optimized strlen code
3 * Hand optimized from GNU libc's strlen
4 * Copyright (C) 1991,1996 Free Software Foundation
5 * Copyright (C) 1996,2008 David S. Miller (davem@davemloft.net)
6 * Copyright (C) 1996, 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
9 #include <linux/linkage.h>
11 #include <asm/export.h>
13 #define LO_MAGIC 0x01010101
14 #define HI_MAGIC 0x80808080
21 sethi %hi(HI_MAGIC), %o4
23 BRANCH_REG_ZERO(pn, %o5, 11f)
27 or %o4, %lo(HI_MAGIC), %o3
29 BRANCH_REG_ZERO(pn, %o5, 12f)
33 sethi %hi(LO_MAGIC), %o4
35 BRANCH_REG_ZERO(pn, %o5, 13f)
38 or %o4, %lo(LO_MAGIC), %o2
40 or %o4, %lo(HI_MAGIC), %o3
42 sethi %hi(LO_MAGIC), %o4
44 or %o4, %lo(LO_MAGIC), %o2
53 /* Check every byte. */
67 BRANCH32_ANNUL(bne, pt, 2b)