]>
Commit | Line | Data |
---|---|---|
3846ef75 UD |
1 | /* Copyright (C) 1999, 2000 Free Software Foundation, Inc. |
2 | This file is part of the GNU C Library. | |
3 | Contributed by Kazumoto Kojima <kkojima@rr.iij4u.or.jp> | |
4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | |
41bdb6e2 AJ |
6 | modify it under the terms of the GNU Lesser General Public |
7 | License as published by the Free Software Foundation; either | |
8 | version 2.1 of the License, or (at your option) any later version. | |
3846ef75 UD |
9 | |
10 | The GNU C Library is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
41bdb6e2 | 13 | Lesser General Public License for more details. |
3846ef75 | 14 | |
41bdb6e2 AJ |
15 | You should have received a copy of the GNU Lesser General Public |
16 | License along with the GNU C Library; if not, write to the Free | |
17 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
18 | 02111-1307 USA. */ | |
3846ef75 UD |
19 | |
20 | #include <sysdep.h> | |
21 | ||
22 | /* void *memset (t, c, len) */ | |
23 | ||
24 | ENTRY(memset) | |
25 | tst r6, r6 | |
26 | bt/s end | |
27 | mov r4, r3 | |
28 | mov #3, r0 | |
29 | cmp/hs r6, r0 | |
30 | bt/s 2f | |
31 | and r4, r0 | |
32 | tst r0, r0 | |
33 | bt/s 1f | |
34 | add r0, r6 | |
35 | add #-1, r0 | |
36 | shll2 r0 | |
37 | braf r0 | |
38 | add #-4, r6 | |
39 | ||
40 | mov.b r5, @r4 | |
41 | add #1, r4 | |
42 | mov.b r5, @r4 | |
43 | add #1, r4 | |
44 | mov.b r5, @r4 | |
45 | add #1, r4 | |
46 | 1: | |
47 | extu.b r5, r0 | |
48 | shll8 r5 | |
49 | or r5, r0 | |
50 | extu.w r0, r0 | |
51 | mov r0, r5 | |
52 | swap.w r5, r5 | |
53 | or r0, r5 | |
54 | ||
55 | 2: | |
56 | add #-4, r6 | |
57 | cmp/pz r6 | |
58 | bf afew | |
59 | mov.l r5, @r4 | |
60 | bra 2b | |
61 | add #4, r4 | |
62 | ||
63 | afew: | |
64 | mov #-1, r0 | |
65 | sub r6, r0 | |
66 | shll2 r0 | |
67 | braf r0 | |
68 | nop | |
69 | ||
70 | mov.b r5, @r4 | |
71 | add #1, r4 | |
72 | mov.b r5, @r4 | |
73 | add #1, r4 | |
74 | mov.b r5, @r4 | |
75 | add #1, r4 | |
76 | end: | |
77 | rts | |
78 | mov r3, r0 | |
79 | END(memset) |