1 /* Optimized memset implementation for PowerPC476.
2 Copyright (C) 2010 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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/>. */
25 r3:destination address and return address
26 r4:source integer to copy
28 r11:sources integer to copy in all 32 bits of reg
29 r12:temp return address
31 Save return address in r12
32 If destinationn is unaligned and count is greater tha 255 bytes
33 set 0-3 bytes to make destination aligned
34 If count is greater tha 255 bytes and setting zero to memory
35 use dbcz to set memeory when we can
36 otherwsie do the follwoing
37 If 16 or more words to set we use 16 word copy loop.
38 Finaly we set 0-15 extra bytes with string store. */
40 EALIGN (BP_SYM (memset), 5, 0)
43 rlwimi r11,r11,16,0,15
46 ble L(preword8_count_loop)
51 beq L(preword8_count_loop)
56 L(unaligned_bytecopy_loop):
60 bdnz L(unaligned_bytecopy_loop)
63 L(preword8_count_loop):
65 beq L(preword2_count_loop)
72 L(word8_count_loop_no_dcbt):
78 bdnz L(word8_count_loop_no_dcbt)
81 L(preword2_count_loop):
97 beq L(skip_string_loop)
132 beq L(postword2_count_loop)
135 L(postword8_count_loop):
142 bdnz L(postword8_count_loop)
144 L(postword2_count_loop):
153 END (BP_SYM (memset))
154 libc_hidden_builtin_def (memset)