1 /* SPDX-License-Identifier: GPL-2.0 */
3 * "memset" implementation for SH4
5 * Copyright (C) 1999 Niibe Yutaka
6 * Copyright (c) 2009 STMicroelectronics Limited
7 * Author: Stuart Menefy <stuart.menefy:st.com>
11 * void *memset(void *s, int c, size_t n);
14 #include <linux/linkage.h>
20 bt/s 40f ! if it's too small, set a byte at once
24 bt/s 2f ! It's aligned
37 ! Check if enough bytes need to be copied to be worth the big loop
39 cmp/gt r6,r0 ! (MT) 64 > len => slow loop
44 ! align the dst to the cache block size if necessary
51 bt/s 11f ! dst is already aligned
52 sub r1, r3 ! r3-r1 -> r3
53 shlr2 r3 ! number of loops
60 11: ! dst is 32byte aligned
63 shld r0,r2 ! number of loops
89 shlr r0 ! r0 = r6 >> 3
92 mov.l r5,@-r4 ! set 8-byte at once
99 ! fill bytes (length may be zero)