xref: /linux/arch/sh/lib/memchr.S (revision 5a7eeb8ba143d860050ecea924a8f074f02d8023)
1/* SPDX-License-Identifier: GPL-2.0 */
2/* $Id: memchr.S,v 1.1 2000/04/14 16:49:01 mjd Exp $
3 *
4 * "memchr" implementation of SuperH
5 *
6 * Copyright (C) 1999  Niibe Yutaka
7 *
8 */
9
10/*
11 * void *memchr(const void *s, int c, size_t n);
12 */
13
14#include <linux/linkage.h>
15ENTRY(memchr)
16	tst	r6,r6
17	bt/s	2f
18	 exts.b	r5,r5
191:	mov.b	@r4,r1
20	cmp/eq	r1,r5
21	bt/s	3f
22	 dt	r6
23	bf/s	1b
24	 add	#1,r4
252:	mov	#0,r4
263:	rts
27	 mov	r4,r0
28