1 /* Optimized version of the standard bzero() function.
2 This file is part of the GNU C Library.
3 Copyright (C) 2000, 2001 Free Software Foundation, Inc.
4 Contributed by Dan Pop <Dan.Pop@cern.ch>.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public License as
8 published by the Free Software Foundation; either version 2 of the
9 License, or (at your option) any later version.
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
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public
17 License along with the GNU C Library; see the file COPYING.LIB. If not,
18 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
27 The algorithm is fairly straightforward: set byte by byte until we
28 we get to a word aligned address, then set word by word as much as
29 possible; the remaining few bytes are set one by one. */
46 alloc save_pfs = ar.pfs, 2, 6, 0, 0
52 cmp.eq p6, p0 = cnt, r0
53 (p6) br.cond.spnt .restore_and_exit ;;
56 cmp.gt p6, p0 = 16, cnt
57 (p6) br.cond.spnt .set_few;;
58 cmp.eq p6, p0 = tmp, r0
59 (p6) br.cond.sptk .dest_aligned
60 sub cnt = cnt, loopcnt
61 adds loopcnt = -1, loopcnt;;
68 shr.u loopcnt = cnt, 4 ;; // loopcnt = cnt / 16
69 cmp.eq p6, p0 = loopcnt, r0
70 (p6) br.cond.spnt .one_more
71 and cnt = 0xf, cnt // compute the remaining cnt
72 adds loopcnt = -1, loopcnt;;
78 cmp.le p6, p0 = 8, cnt ;;
80 (p6) st8 [ptr1] = r0, 8
81 (p6) adds cnt = -8, cnt ;;
82 cmp.eq p6, p0 = cnt, r0
83 (p6) br.cond.spnt .restore_and_exit
85 adds loopcnt = -1, cnt;;