Update copyright dates with scripts/update-copyrights.
[glibc.git] / sysdeps / arm / memset.S
blob7c0dfc79cd234c0720f58028eb5500d7f4d90499
1 /* Copyright (C) 1998-2015 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 /* Thumb requires excessive IT insns here.  */
20 #define NO_THUMB
21 #include <sysdep.h>
23         .text
24         .syntax unified
26 /* void *memset (dstpp, c, len) */
28 ENTRY(memset)
29         mov     r3, r0
30         cmp     r2, #8
31         bcc     2f              @ less than 8 bytes to move
34         tst     r3, #3          @ aligned yet?
35         sfi_breg r3, \
36         strbne  r1, [\B], #1
37         subne   r2, r2, #1
38         bne     1b
40         and     r1, r1, #255    @ clear any sign bits
41         orr     r1, r1, r1, lsl $8
42         orr     r1, r1, r1, lsl $16
43         mov     ip, r1
46         subs    r2, r2, #8
47         sfi_breg r3, \
48         stmiacs \B!, {r1, ip}   @ store up to 32 bytes per loop iteration
49         subscs  r2, r2, #8
50         sfi_breg r3, \
51         stmiacs \B!, {r1, ip}
52         subscs  r2, r2, #8
53         sfi_breg r3, \
54         stmiacs \B!, {r1, ip}
55         subscs  r2, r2, #8
56         sfi_breg r3, \
57         stmiacs \B!, {r1, ip}
58         bcs     1b
60         and     r2, r2, #7
62         subs    r2, r2, #1      @ store up to 4 bytes per loop iteration
63         sfi_breg r3, \
64         strbcs  r1, [\B], #1
65         subscs  r2, r2, #1
66         sfi_breg r3, \
67         strbcs  r1, [\B], #1
68         subscs  r2, r2, #1
69         sfi_breg r3, \
70         strbcs  r1, [\B], #1
71         subscs  r2, r2, #1
72         sfi_breg r3, \
73         strbcs  r1, [\B], #1
74         bcs     2b
76         DO_RET(lr)
77 END(memset)
78 libc_hidden_builtin_def (memset)