1 /* Optimized memset for PowerPC476 (128-byte cacheline).
2 Copyright (C) 2010-2015 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/>. */
23 r3:destination address and return address
24 r4:source integer to copy
26 r11:sources integer to copy in all 32 bits of reg
27 r12:temp return address
29 Save return address in r12
30 If destinationn is unaligned and count is greater tha 255 bytes
31 set 0-3 bytes to make destination aligned
32 If count is greater tha 255 bytes and setting zero to memory
33 use dbcz to set memeory when we can
34 otherwsie do the follwoing
35 If 16 or more words to set we use 16 word copy loop.
36 Finaly we set 0-15 extra bytes with string store. */
41 rlwimi r11,r11,16,0,15
44 ble L(preword8_count_loop)
49 beq L(preword8_count_loop)
54 L(unaligned_bytecopy_loop):
58 bdnz L(unaligned_bytecopy_loop)
61 L(preword8_count_loop):
63 beq L(preword2_count_loop)
70 L(word8_count_loop_no_dcbt):
76 bdnz L(word8_count_loop_no_dcbt)
79 L(preword2_count_loop):
95 beq L(skip_string_loop)
130 beq L(postword2_count_loop)
133 L(postword8_count_loop):
140 bdnz L(postword8_count_loop)
142 L(postword2_count_loop):
152 libc_hidden_builtin_def (memset)