xref: /linux/arch/arm/lib/memchr.S (revision 75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37)
1*d2912cb1SThomas Gleixner/* SPDX-License-Identifier: GPL-2.0-only */
21da177e4SLinus Torvalds/*
31da177e4SLinus Torvalds *  linux/arch/arm/lib/memchr.S
41da177e4SLinus Torvalds *
51da177e4SLinus Torvalds *  Copyright (C) 1995-2000 Russell King
61da177e4SLinus Torvalds *
71da177e4SLinus Torvalds *  ASM optimised string functions
81da177e4SLinus Torvalds */
91da177e4SLinus Torvalds#include <linux/linkage.h>
101da177e4SLinus Torvalds#include <asm/assembler.h>
111da177e4SLinus Torvalds
121da177e4SLinus Torvalds	.text
131da177e4SLinus Torvalds	.align	5
141da177e4SLinus TorvaldsENTRY(memchr)
151da177e4SLinus Torvalds1:	subs	r2, r2, #1
161da177e4SLinus Torvalds	bmi	2f
171da177e4SLinus Torvalds	ldrb	r3, [r0], #1
181da177e4SLinus Torvalds	teq	r3, r1
191da177e4SLinus Torvalds	bne	1b
201da177e4SLinus Torvalds	sub	r0, r0, #1
211da177e4SLinus Torvalds2:	movne	r0, #0
226ebbf2ceSRussell King	ret	lr
2393ed3970SCatalin MarinasENDPROC(memchr)
24