]>
Commit | Line | Data |
---|---|---|
79b7c863 | 1 | /* Copyright (C) 1998, 2003 Free Software Foundation, Inc. |
d024bf59 UD |
2 | This file is part of the GNU C Library. |
3 | Contributed by Philip Blundell <philb@gnu.org> | |
4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | |
3214b89b 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. | |
d024bf59 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 | |
3214b89b | 13 | Lesser General Public License for more details. |
d024bf59 | 14 | |
3214b89b | 15 | You should have received a copy of the GNU Lesser General Public |
ab84e3ff PE |
16 | License along with the GNU C Library. If not, see |
17 | <http://www.gnu.org/licenses/>. */ | |
d024bf59 UD |
18 | |
19 | #include <sysdep.h> | |
20 | ||
21 | /* void *memset (dstpp, c, len) */ | |
22 | ||
23 | ENTRY(memset) | |
7e7d3348 UD |
24 | mov r3, r0 |
25 | cmp r2, #8 | |
26 | bcc 2f @ less than 8 bytes to move | |
27 | ||
d024bf59 | 28 | 1: |
7e7d3348 UD |
29 | tst r3, #3 @ aligned yet? |
30 | strneb r1, [r3], #1 | |
31 | subne r2, r2, #1 | |
d024bf59 | 32 | bne 1b |
7e7d3348 | 33 | |
a7ed1adb | 34 | and r1, r1, #255 @ clear any sign bits |
7e7d3348 UD |
35 | orr r1, r1, r1, lsl $8 |
36 | orr r1, r1, r1, lsl $16 | |
f2c9d882 | 37 | mov ip, r1 |
7e7d3348 | 38 | |
d024bf59 | 39 | 1: |
7e7d3348 | 40 | subs r2, r2, #8 |
f2c9d882 | 41 | stmcsia r3!, {r1, ip} @ store up to 32 bytes per loop iteration |
7e7d3348 | 42 | subcss r2, r2, #8 |
f2c9d882 | 43 | stmcsia r3!, {r1, ip} |
7e7d3348 | 44 | subcss r2, r2, #8 |
f2c9d882 | 45 | stmcsia r3!, {r1, ip} |
7e7d3348 | 46 | subcss r2, r2, #8 |
f2c9d882 | 47 | stmcsia r3!, {r1, ip} |
7e7d3348 UD |
48 | bcs 1b |
49 | ||
50 | and r2, r2, #7 | |
d024bf59 | 51 | 2: |
7e7d3348 UD |
52 | subs r2, r2, #1 @ store up to 4 bytes per loop iteration |
53 | strcsb r1, [r3], #1 | |
54 | subcss r2, r2, #1 | |
55 | strcsb r1, [r3], #1 | |
56 | subcss r2, r2, #1 | |
57 | strcsb r1, [r3], #1 | |
58 | subcss r2, r2, #1 | |
59 | strcsb r1, [r3], #1 | |
60 | bcs 2b | |
61 | ||
62 | DO_RET(lr) | |
d024bf59 | 63 | END(memset) |
79b7c863 | 64 | libc_hidden_builtin_def (memset) |