1 /* strspn (str, ss) -- Return the length of the maximum initial segment
2 of S which contains only characters in ACCEPT.
4 Copyright (C) 1999, 2003 Free Software Foundation, Inc.
5 This file is part of the GNU C Library.
6 Contributed by Jakub Jelinek <jj@ultra.linux.cz>
8 The GNU C Library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
13 The GNU C Library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public
19 License along with the GNU C Library; if not, write to the Free
20 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
27 #define STACK_SIZE 128
28 #define STACK_OFFSET 128+0x7ff
29 .register %g2, #scratch
32 #define STACK_OFFSET 64
38 sub %sp, STACK_SIZE+32, %sp /* IEU0 Group */
40 stx %g0, [%sp + STACK_OFFSET] /* Store Group */
41 mov %o0, %g4 /* IEU0 */
43 stx %g0, [%sp + STACK_OFFSET + 8] /* Store Group */
44 add %sp, STACK_OFFSET, %o5 /* IEU0 */
45 stx %g0, [%sp + STACK_OFFSET + 16] /* Store Group */
46 stx %g0, [%sp + STACK_OFFSET + 24] /* Store Group */
48 1: ldub [%o1], %o2 /* Load Group */
49 brz,pn %o2, 2f /* CTI+IEU1 Group */
50 srl %o2, 3, %o3 /* IEU0 */
51 and %o3, 0x18, %o3 /* IEU0 Group */
53 and %o2, 0x3f, %o2 /* IEU1 */
54 ldx [%o5 + %o3], %g2 /* Load Group */
55 sllx %o4, %o2, %g1 /* IEU0 */
56 add %o1, 1, %o1 /* IEU1 */
58 or %g2, %g1, %g2 /* IEU0 Group */
59 ba,pt %xcc, 1b /* CTI */
60 stx %g2, [%o5 + %o3] /* Store */
61 2: andcc %o0, 7, %g0 /* IEU1 Group */
63 be,a,pt %xcc, 4f /* CTI */
64 ldx [%o0], %o2 /* Load */
65 ldub [%o0], %o2 /* Load Group */
66 3: srl %o2, 3, %o3 /* IEU0 Group */
68 and %o2, 0x3f, %o2 /* IEU1 */
69 and %o3, 0x18, %o3 /* IEU0 Group */
70 ldx [%o5 + %o3], %g2 /* Load Group */
71 sllx %o4, %o2, %g1 /* IEU0 */
73 add %o0, 1, %o0 /* IEU1 */
74 andcc %g2, %g1, %g0 /* IEU1 Group */
75 be,pn %xcc, 12f /* CTI */
76 andcc %o0, 7, %g0 /* IEU1 Group */
78 bne,a,pt %icc, 3b /* CTI */
79 ldub [%o0], %o2 /* Load */
80 ldx [%o0], %o2 /* Load Group */
81 4: srlx %o2, 59, %o3 /* IEU0 Group */
83 srlx %o2, 56, %g5 /* IEU0 Group */
84 5: and %o3, 0x18, %o3 /* IEU1 */
85 andcc %g5, 0x3f, %g5 /* IEU1 Group */
86 ldx [%o5 + %o3], %g2 /* Load */
88 srlx %o2, 51, %o3 /* IEU0 */
89 sllx %o4, %g5, %g1 /* IEU0 Group */
90 srlx %o2, 48, %g5 /* IEU0 Group */
91 andcc %g2, %g1, %g2 /* IEU1 */
93 be,pn %xcc, 13f /* CTI */
94 and %o3, 0x18, %o3 /* IEU0 Group */
95 and %g5, 0x3f, %g5 /* IEU1 */
96 ldx [%o5 + %o3], %g2 /* Load Group */
98 srlx %o2, 43, %o3 /* IEU0 */
99 sllx %o4, %g5, %g1 /* IEU0 Group */
100 srlx %o2, 40, %g5 /* IEU0 Group */
101 andcc %g2, %g1, %g2 /* IEU1 */
103 be,pn %xcc, 14f /* CTI */
104 and %o3, 0x18, %o3 /* IEU0 Group */
105 and %g5, 0x3f, %g5 /* IEU1 */
106 ldx [%o5 + %o3], %g2 /* Load Group */
108 srlx %o2, 35, %o3 /* IEU0 */
109 sllx %o4, %g5, %g1 /* IEU0 Group */
110 srlx %o2, 32, %g5 /* IEU0 Group */
111 andcc %g2, %g1, %g2 /* IEU1 */
113 be,pn %xcc, 15f /* CTI */
114 and %o3, 0x18, %o3 /* IEU0 Group */
115 and %g5, 0x3f, %g5 /* IEU1 */
116 ldx [%o5 + %o3], %g2 /* Load Group */
118 srlx %o2, 27, %o3 /* IEU0 */
119 sllx %o4, %g5, %g1 /* IEU0 Group */
120 srlx %o2, 24, %g5 /* IEU0 Group */
121 andcc %g2, %g1, %g2 /* IEU1 */
123 be,pn %xcc, 16f /* CTI */
124 and %o3, 0x18, %o3 /* IEU0 Group */
125 and %g5, 0x3f, %g5 /* IEU1 */
126 ldx [%o5 + %o3], %g2 /* Load Group */
128 srlx %o2, 19, %o3 /* IEU0 */
129 sllx %o4, %g5, %g1 /* IEU0 Group */
130 srlx %o2, 16, %g5 /* IEU0 Group */
131 andcc %g2, %g1, %g2 /* IEU1 */
133 be,pn %xcc, 17f /* CTI */
134 and %o3, 0x18, %o3 /* IEU0 Group */
135 and %g5, 0x3f, %g5 /* IEU1 */
136 ldx [%o5 + %o3], %g2 /* Load Group */
138 srlx %o2, 11, %o3 /* IEU0 */
139 sllx %o4, %g5, %g1 /* IEU0 Group */
140 add %o0, 8, %o0 /* IEU1 */
141 srlx %o2, 8, %g5 /* IEU0 Group */
143 andcc %g2, %g1, %g2 /* IEU1 */
144 be,pn %xcc, 18f /* CTI */
145 and %o3, 0x18, %o3 /* IEU0 Group */
146 and %g5, 0x3f, %g5 /* IEU1 */
148 ldx [%o5 + %o3], %g2 /* Load Group */
149 sllx %o4, %g5, %g1 /* IEU0 */
150 mov %o2, %g5 /* IEU1 */
151 srlx %o2, 3, %o3 /* IEU0 Group */
153 ldxa [%o0] ASI_PNF, %o2 /* Load */
154 andcc %g2, %g1, %g2 /* IEU1 Group */
155 be,pn %xcc, 19f /* CTI */
156 and %o3, 0x18, %o3 /* IEU0 Group */
158 and %g5, 0x3f, %g5 /* IEU1 */
159 ldx [%o5 + %o3], %g2 /* Load Group */
160 sllx %o4, %g5, %g1 /* IEU0 */
161 srlx %o2, 59, %o3 /* IEU0 Group */
163 andcc %g2, %g1, %g2 /* IEU1 Group */
164 bne,pt %xcc, 5b /* CTI */
165 srlx %o2, 56, %g5 /* IEU0 Group */
166 sub %o0, 1, %o0 /* IEU1 */
168 add %sp, STACK_SIZE+32, %sp /* IEU0 Group */
169 retl /* CTI+IEU1 Group */
170 sub %o0, %g4, %o0 /* IEU0 */
173 19: sub %o0, 2, %o0 /* IEU1 */
174 add %sp, STACK_SIZE+32, %sp /* IEU0 Group */
175 retl /* CTI+IEU1 Group */
176 sub %o0, %g4, %o0 /* IEU0 */
178 18: sub %o0, 3, %o0 /* IEU1 */
179 add %sp, STACK_SIZE+32, %sp /* IEU0 Group */
180 retl /* CTI+IEU1 Group */
181 sub %o0, %g4, %o0 /* IEU0 */
183 17: add %o0, 4, %o0 /* IEU1 */
184 add %sp, STACK_SIZE+32, %sp /* IEU0 Group */
185 retl /* CTI+IEU1 Group */
186 sub %o0, %g4, %o0 /* IEU0 */
188 16: add %o0, 3, %o0 /* IEU1 */
189 add %sp, STACK_SIZE+32, %sp /* IEU0 Group */
190 retl /* CTI+IEU1 Group */
191 sub %o0, %g4, %o0 /* IEU0 */
193 15: add %o0, 2, %o0 /* IEU1 */
194 add %sp, STACK_SIZE+32, %sp /* IEU0 Group */
195 retl /* CTI+IEU1 Group */
196 sub %o0, %g4, %o0 /* IEU0 */
198 14: add %o0, 1, %o0 /* IEU1 */
199 add %sp, STACK_SIZE+32, %sp /* IEU0 Group */
200 retl /* CTI+IEU1 Group */
201 sub %o0, %g4, %o0 /* IEU0 */
203 13: add %sp, STACK_SIZE+32, %sp /* IEU1 */
204 retl /* CTI+IEU1 Group */
205 sub %o0, %g4, %o0 /* IEU0 */
208 12: sub %o0, 1, %o0 /* IEU0 Group */
209 add %sp, STACK_SIZE+32, %sp /* IEU1 */
210 retl /* CTI+IEU1 Group */
211 sub %o0, %g4, %o0 /* IEU0 */
213 libc_hidden_builtin_def (strspn)