/* Optimized version of the standard strchr() function.
This file is part of the GNU C Library.
- Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2000-2016 Free Software Foundation, Inc.
Contributed by Dan Pop <Dan.Pop@cern.ch>.
The GNU C Library is free software; you can redistribute it and/or
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/* Return: the address of the first occurence of chr in str or NULL
.save ar.lc, saved_lc
mov saved_lc = ar.lc // save the loop counter
.body
- mov ret0 = str
+ mov ret0 = str
and tmp = 7, str // tmp = str % 8
mux1 chrx8 = chr, @brcst
extr.u chr = chr, 0, 8 // retain only the last byte
ld8 val1 = [ret0], 8;;
nop.b 0
nop.b 0
-.l2:
+.l2:
ld8.s val2 = [ret0], 8 // don't bomb out here
- czx1.r pos0 = val1
+ czx1.r pos0 = val1
xor tmp = val1, chrx8 // if val1 contains chr, tmp will
;; // contain a zero in its position
czx1.r poschr = tmp
(p6) br.cond.spnt .notfound
chk.s val2, .recovery
.back:
- mov val1 = val2
+ mov val1 = val2
br.cond.dptk .l2
.foundit:
(p6) cmp.lt p8, p0 = pos0, poschr // we found chr and null in the word