blob: 6b7142f691f8307cd1516c5093ae6f00cfb2b0f4 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/* $Id: memchr.S,v 1.1 2000/04/14 16:49:01 mjd Exp $
2 *
3 * "memchr" implementation of SuperH
4 *
5 * Copyright (C) 1999 Niibe Yutaka
6 *
7 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
8 */
9
10/*
11 * void *memchr(const void *s, int c, size_t n);
12 */
13
14#include <sysdep.h>
15
16ENTRY(memchr)
17 tst r6,r6
18 bt/s 2f
19 exts.b r5,r5
201: mov.b @r4,r1
21 cmp/eq r1,r5
22 bt/s 3f
23 dt r6
24 bf/s 1b
25 add #1,r4
262: mov #0,r4
273: rts
28 mov r4,r0
29END(memchr)
30libc_hidden_def (memchr)