Update.
[glibc.git] / sysdeps / powerpc / strlen.S
blob95eaf94de13b03fa50632bdd6a474523cc8b0602
1 /* Optimized strlen implementation for PowerPC.
2    Copyright (C) 1997 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 Library General Public License as
7    published by the Free Software Foundation; either version 2 of the
8    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    Library General Public License for more details.
15    You should have received a copy of the GNU Library General Public
16    License along with the GNU C Library; see the file COPYING.LIB.  If not,
17    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18    Boston, MA 02111-1307, USA.  */
20         .section        ".text"
21         .align 2
22         .globl strlen
23         .type    strlen,@function
24 strlen:
25         rlwinm 7,3,0,0,29
26         lis 8,0x7f7f
27         lwz 11,0(7)
28         ori 8,8,32639
29         rlwinm 4,3,3,27,28
30         li 9,-1
31         or 10,11,8
32         and 0,11,8
33         srw 9,9,4
34         add 0,0,8
35         nor 0,10,0
36         and. 11,0,9
37         bc 4,2,.L2
38 .L3:
39         lwzu 11,4(7)
40         or 10,11,8
41         and 0,11,8
42         add 0,0,8
43         nor. 11,10,0
44         bc 12,2,.L3
45 .L2:
46         subf 0,3,7
47         cntlzw 3,11
48         srwi 3,3,3
49         add 3,0,3
50         blr
51 .Lfe1:
52         .size    strlen,.Lfe1-strlen