1 /* strpbrk (s, accept) -- Find the first occurrence in S of any character in
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 %o4, [%sp + STACK_OFFSET] /* Store Group */
41 stx %g0, [%sp + STACK_OFFSET + 8] /* Store Group */
43 add %sp, STACK_OFFSET, %o5 /* IEU0 */
44 stx %g0, [%sp + STACK_OFFSET + 16] /* Store Group */
45 stx %g0, [%sp + STACK_OFFSET + 24] /* Store Group */
46 1: ldub [%o1], %o2 /* Load Group */
48 brz,pn %o2, 2f /* CTI+IEU1 Group */
49 srl %o2, 3, %o3 /* IEU0 */
50 and %o3, 0x18, %o3 /* IEU0 Group */
51 and %o2, 0x3f, %o2 /* IEU1 */
53 ldx [%o5 + %o3], %g2 /* Load Group */
54 sllx %o4, %o2, %g1 /* IEU0 */
55 add %o1, 1, %o1 /* IEU1 */
56 or %g2, %g1, %g2 /* IEU0 Group */
58 ba,pt %xcc, 1b /* CTI */
59 stx %g2, [%o5 + %o3] /* Store */
60 2: andcc %o0, 7, %g0 /* IEU1 Group */
61 be,a,pt %xcc, 4f /* CTI */
63 ldx [%o0], %o2 /* Load */
64 ldub [%o0], %o2 /* Load Group */
65 3: srl %o2, 3, %o3 /* IEU0 Group */
66 and %o2, 0x3f, %o2 /* IEU1 */
68 and %o3, 0x18, %o3 /* IEU0 Group */
69 ldx [%o5 + %o3], %g2 /* Load Group */
70 sllx %o4, %o2, %g1 /* IEU0 */
71 add %o0, 1, %o0 /* IEU1 */
73 andcc %g2, %g1, %g0 /* IEU1 Group */
74 bne,pn %xcc, 12f /* CTI */
75 andcc %o0, 7, %g0 /* IEU1 Group */
76 bne,a,pt %icc, 3b /* CTI */
78 ldub [%o0], %o2 /* Load */
79 ldx [%o0], %o2 /* Load Group */
80 4: srlx %o2, 59, %o3 /* IEU0 Group */
81 srlx %o2, 56, %g4 /* IEU0 Group */
83 5: and %o3, 0x18, %o3 /* IEU1 */
84 andcc %g4, 0x3f, %g4 /* IEU1 Group */
85 ldx [%o5 + %o3], %g2 /* Load */
86 srlx %o2, 51, %o3 /* IEU0 */
88 sllx %o4, %g4, %g1 /* IEU0 Group */
89 srlx %o2, 48, %g4 /* IEU0 Group */
90 andcc %g2, %g1, %g2 /* IEU1 */
91 bne,pn %xcc, 13f /* CTI */
93 and %o3, 0x18, %o3 /* IEU0 Group */
94 and %g4, 0x3f, %g4 /* IEU1 */
95 ldx [%o5 + %o3], %g2 /* Load Group */
96 srlx %o2, 43, %o3 /* IEU0 */
98 sllx %o4, %g4, %g1 /* IEU0 Group */
99 srlx %o2, 40, %g4 /* IEU0 Group */
100 andcc %g2, %g1, %g2 /* IEU1 */
101 bne,pn %xcc, 14f /* CTI */
103 and %o3, 0x18, %o3 /* IEU0 Group */
104 and %g4, 0x3f, %g4 /* IEU1 */
105 ldx [%o5 + %o3], %g2 /* Load Group */
106 srlx %o2, 35, %o3 /* IEU0 */
108 sllx %o4, %g4, %g1 /* IEU0 Group */
109 srlx %o2, 32, %g4 /* IEU0 Group */
110 andcc %g2, %g1, %g2 /* IEU1 */
111 bne,pn %xcc, 15f /* CTI */
113 and %o3, 0x18, %o3 /* IEU0 Group */
114 and %g4, 0x3f, %g4 /* IEU1 */
115 ldx [%o5 + %o3], %g2 /* Load Group */
116 srlx %o2, 27, %o3 /* IEU0 */
118 sllx %o4, %g4, %g1 /* IEU0 Group */
119 srlx %o2, 24, %g4 /* IEU0 Group */
120 andcc %g2, %g1, %g2 /* IEU1 */
121 bne,pn %xcc, 16f /* CTI */
123 and %o3, 0x18, %o3 /* IEU0 Group */
124 and %g4, 0x3f, %g4 /* IEU1 */
125 ldx [%o5 + %o3], %g2 /* Load Group */
126 srlx %o2, 19, %o3 /* IEU0 */
128 sllx %o4, %g4, %g1 /* IEU0 Group */
129 srlx %o2, 16, %g4 /* IEU0 Group */
130 andcc %g2, %g1, %g2 /* IEU1 */
131 bne,pn %xcc, 17f /* CTI */
133 and %o3, 0x18, %o3 /* IEU0 Group */
134 and %g4, 0x3f, %g4 /* IEU1 */
135 ldx [%o5 + %o3], %g2 /* Load Group */
136 srlx %o2, 11, %o3 /* IEU0 */
138 sllx %o4, %g4, %g1 /* IEU0 Group */
139 add %o0, 8, %o0 /* IEU1 */
140 srlx %o2, 8, %g4 /* IEU0 Group */
141 andcc %g2, %g1, %g2 /* IEU1 */
143 bne,pn %xcc, 18f /* CTI */
144 and %o3, 0x18, %o3 /* IEU0 Group */
145 and %g4, 0x3f, %g4 /* IEU1 */
146 ldx [%o5 + %o3], %g2 /* Load Group */
148 sllx %o4, %g4, %g1 /* IEU0 */
149 mov %o2, %g5 /* IEU1 */
150 srlx %o2, 3, %o3 /* IEU0 Group */
151 ldxa [%o0] ASI_PNF, %o2 /* Load */
153 andcc %g2, %g1, %g2 /* IEU1 Group */
154 bne,pn %xcc, 19f /* CTI */
155 and %o3, 0x18, %o3 /* IEU0 Group */
156 and %g5, 0x3f, %g4 /* IEU1 */
158 ldx [%o5 + %o3], %g2 /* Load Group */
159 sllx %o4, %g4, %g1 /* IEU0 */
160 srlx %o2, 59, %o3 /* IEU0 Group */
161 andcc %g2, %g1, %g2 /* IEU1 Group */
163 be,pt %xcc, 5b /* CTI */
164 srlx %o2, 56, %g4 /* IEU0 Group */
165 sub %o0, 1, %o0 /* IEU1 */
166 add %sp, STACK_SIZE+32, %sp /* IEU0 Group */
168 andcc %g5, 0xff, %g0 /* IEU1 */
169 retl /* CTI+IEU1 Group */
170 move %icc, 0, %o0 /* Single Group */
173 19: sub %o0, 2, %o0 /* IEU1 */
174 srl %g5, 8, %g1 /* IEU0 Group */
175 add %sp, STACK_SIZE+32, %sp /* IEU1 */
176 andcc %g1, 0xff, %g0 /* IEU1 Group */
178 retl /* CTI+IEU1 Group */
179 move %icc, 0, %o0 /* Single Group */
180 18: sub %o0, 3, %o0 /* IEU1 */
181 srl %o2, 16, %g1 /* IEU0 Group */
183 add %sp, STACK_SIZE+32, %sp /* IEU1 */
184 andcc %g1, 0xff, %g0 /* IEU1 Group */
185 retl /* CTI+IEU1 Group */
186 move %icc, 0, %o0 /* Single Group */
188 17: add %o0, 4, %o0 /* IEU1 */
189 srl %o2, 24, %g1 /* IEU0 Group */
190 add %sp, STACK_SIZE+32, %sp /* IEU1 */
191 retl /* CTI+IEU1 Group */
193 movrz %g1, 0, %o0 /* Single Group */
194 16: add %o0, 3, %o0 /* IEU1 */
195 srlx %o2, 32, %g1 /* IEU0 Group */
196 add %sp, STACK_SIZE+32, %sp /* IEU1 */
198 andcc %g1, 0xff, %g0 /* IEU1 Group */
199 retl /* CTI+IEU1 Group */
200 move %icc, 0, %o0 /* Single Group */
203 15: add %o0, 2, %o0 /* IEU1 */
204 srlx %o2, 40, %g1 /* IEU0 Group */
205 add %sp, STACK_SIZE+32, %sp /* IEU1 */
206 andcc %g1, 0xff, %g0 /* IEU1 Group */
208 retl /* CTI+IEU1 Group */
209 move %icc, 0, %o0 /* Single Group */
210 14: add %o0, 1, %o0 /* IEU1 */
211 srlx %o2, 48, %g1 /* IEU0 Group */
213 add %sp, STACK_SIZE+32, %sp /* IEU1 */
214 andcc %g1, 0xff, %g0 /* IEU1 Group */
215 retl /* CTI+IEU1 Group */
216 move %icc, 0, %o0 /* Single Group */
218 13: add %sp, STACK_SIZE+32, %sp /* IEU1 */
219 srlx %o2, 56, %g1 /* IEU0 Group */
220 retl /* CTI+IEU1 Group */
221 movrz %g1, 0, %o0 /* Single Group */
224 12: sub %o0, 1, %o0 /* IEU0 Group */
225 or %o3, %o2, %g1 /* IEU1 */
226 add %sp, STACK_SIZE+32, %sp /* IEU0 Group */
227 retl /* CTI+IEU1 Group */
229 movrz %g1, 0, %o0 /* Single Group */
231 libc_hidden_builtin_def (strpbrk)