(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
[glibc.git] / sysdeps / arm / memset.S
blob1e2699d077eaf6e149af420a36d12eb8c2f3f69b
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, write to the Free
17    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18    02111-1307 USA.  */
20 #include <sysdep.h>
22 /* void *memset (dstpp, c, len) */
24 ENTRY(memset)
25         mov     r3, r0
26         cmp     r2, #8
27         bcc     2f              @ less than 8 bytes to move
30         tst     r3, #3          @ aligned yet?
31         strneb  r1, [r3], #1
32         subne   r2, r2, #1
33         bne     1b
35         orr     r1, r1, r1, lsl $8
36         orr     r1, r1, r1, lsl $16
39         subs    r2, r2, #8
40         strcs   r1, [r3], #4    @ store up to 32 bytes per loop iteration
41         strcs   r1, [r3], #4
42         subcss  r2, r2, #8
43         strcs   r1, [r3], #4
44         strcs   r1, [r3], #4
45         subcss  r2, r2, #8
46         strcs   r1, [r3], #4
47         strcs   r1, [r3], #4
48         subcss  r2, r2, #8
49         strcs   r1, [r3], #4
50         strcs   r1, [r3], #4
51         bcs     1b
53         and     r2, r2, #7
55         subs    r2, r2, #1      @ store up to 4 bytes per loop iteration
56         strcsb  r1, [r3], #1
57         subcss  r2, r2, #1
58         strcsb  r1, [r3], #1
59         subcss  r2, r2, #1
60         strcsb  r1, [r3], #1
61         subcss  r2, r2, #1
62         strcsb  r1, [r3], #1
63         bcs     2b
64         
65         DO_RET(lr)
66 END(memset)
67 libc_hidden_builtin_def (memset)