]>
Commit | Line | Data |
---|---|---|
d4697bc9 | 1 | /* Copyright (C) 1999-2014 Free Software Foundation, Inc. |
3846ef75 UD |
2 | This file is part of the GNU C Library. |
3 | Contributed by Kazumoto Kojima <kkojima@rr.iij4u.or.jp> | |
8439150e | 4 | Optimized by Toshiyasu Morita <toshiyasu.morita@hsa.hitachi.com> |
3846ef75 UD |
5 | |
6 | The GNU C Library is free software; you can redistribute it and/or | |
41bdb6e2 AJ |
7 | modify it under the terms of the GNU Lesser General Public |
8 | License as published by the Free Software Foundation; either | |
9 | version 2.1 of the License, or (at your option) any later version. | |
3846ef75 UD |
10 | |
11 | The GNU C Library is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
41bdb6e2 | 14 | Lesser General Public License for more details. |
3846ef75 | 15 | |
41bdb6e2 | 16 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 PE |
17 | License along with the GNU C Library; if not, see |
18 | <http://www.gnu.org/licenses/>. */ | |
3846ef75 UD |
19 | |
20 | #include <sysdep.h> | |
21 | ||
8439150e | 22 | /* void *memset (t, c, len); */ |
3846ef75 UD |
23 | |
24 | ENTRY(memset) | |
8439150e UD |
25 | mov #12,r0 |
26 | cmp/gt r6,r0 | |
27 | bt.s L_byte_loop_init | |
28 | mov r4,r7 | |
29 | ||
95029045 | 30 | extu.b r5,r5 |
8439150e UD |
31 | swap.b r5,r1 |
32 | or r1,r5 | |
33 | swap.w r5,r1 | |
34 | or r1,r5 | |
35 | ||
36 | mov r4,r0 | |
37 | tst #1,r0 | |
38 | bt L_wordalign | |
39 | ||
40 | mov.b r5,@r4 | |
9c84384c | 41 | add #-1,r6 |
8439150e UD |
42 | add #1,r4 |
43 | mov r4,r0 | |
44 | ||
45 | .balignw 4,0x0009 | |
46 | L_wordalign: | |
47 | tst #2,r0 | |
48 | bt L_word_loop_init | |
49 | ||
50 | mov.w r5,@r4 | |
51 | add #-2,r6 | |
52 | add #2,r4 | |
53 | mov r4,r0 | |
54 | ||
55 | .balignw 4,0x0009 | |
56 | L_word_loop_init: | |
57 | mov r6,r3 | |
58 | shlr2 r3 | |
59 | mov #7,r0 | |
60 | shlr r3 | |
61 | and r0,r6 | |
62 | ||
63 | .balignw 4,0x0009 | |
64 | L_2word_loop: | |
65 | mov.l r5,@r4 | |
66 | dt r3 | |
67 | mov.l r5,@(4,r4) | |
68 | bf.s L_2word_loop | |
69 | add #8,r4 | |
70 | ||
71 | .balignw 4,0x0009 | |
72 | L_byte_loop_init: | |
73 | tst r6,r6 | |
74 | bt L_byte_exit | |
75 | ||
76 | .balignw 4,0x0009 | |
77 | L_byte_loop: | |
78 | mov.b r5,@r4 | |
79 | dt r6 | |
80 | bf.s L_byte_loop | |
81 | add #1,r4 | |
82 | ||
83 | .balignw 4,0x0009 | |
84 | L_byte_exit: | |
3846ef75 | 85 | rts |
8439150e | 86 | mov r7,r0 |
3846ef75 | 87 | END(memset) |
85dd1003 | 88 | libc_hidden_builtin_def (memset) |