Move all files into ports/ subdirectory in preparation for merge with glibc
[glibc.git] / ports / sysdeps / arm / memset.S
bloba29031c2668ecfa13f0656edc7f8f6e2a790c8ed
1 /* Copyright (C) 1998, 2003 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3    Contributed by Philip Blundell <philb@gnu.org>
5    The GNU C Library is free software; you can redistribute it and/or
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.
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
13    Lesser General Public License for more details.
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library.  If not, see
17    <http://www.gnu.org/licenses/>.  */
19 #include <sysdep.h>
21 /* void *memset (dstpp, c, len) */
23 ENTRY(memset)
24         mov     r3, r0
25         cmp     r2, #8
26         bcc     2f              @ less than 8 bytes to move
29         tst     r3, #3          @ aligned yet?
30         strneb  r1, [r3], #1
31         subne   r2, r2, #1
32         bne     1b
34         and     r1, r1, #255    @ clear any sign bits
35         orr     r1, r1, r1, lsl $8
36         orr     r1, r1, r1, lsl $16
37         mov     ip, r1
40         subs    r2, r2, #8
41         stmcsia r3!, {r1, ip}   @ store up to 32 bytes per loop iteration
42         subcss  r2, r2, #8
43         stmcsia r3!, {r1, ip}
44         subcss  r2, r2, #8
45         stmcsia r3!, {r1, ip}
46         subcss  r2, r2, #8
47         stmcsia r3!, {r1, ip}
48         bcs     1b
50         and     r2, r2, #7
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)
63 END(memset)
64 libc_hidden_builtin_def (memset)