1/* strpbrk (s, accept) -- Find the first occurrence in S of any character in 2 ACCEPT. 3 For SPARC v9. 4 Copyright (C) 1999-2022 Free Software Foundation, Inc. 5 This file is part of the GNU C Library. 6 7 The GNU C Library is free software; you can redistribute it and/or 8 modify it under the terms of the GNU Lesser General Public 9 License as published by the Free Software Foundation; either 10 version 2.1 of the License, or (at your option) any later version. 11 12 The GNU C Library is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 Lesser General Public License for more details. 16 17 You should have received a copy of the GNU Lesser General Public 18 License along with the GNU C Library; if not, see 19 <https://www.gnu.org/licenses/>. */ 20 21#include <sysdep.h> 22#include <asm/asi.h> 23#ifndef XCC 24#define XCC xcc 25#define STACK_SIZE 128 26#define STACK_OFFSET 128+0x7ff 27 .register %g2, #scratch 28#else 29#define STACK_SIZE 64 30#define STACK_OFFSET 64 31#endif 32 33 .text 34 .align 32 35ENTRY(strpbrk) 36 sub %sp, STACK_SIZE+32, %sp /* IEU0 Group */ 37 mov 1, %o4 /* IEU1 */ 38 stx %o4, [%sp + STACK_OFFSET] /* Store Group */ 39 stx %g0, [%sp + STACK_OFFSET + 8] /* Store Group */ 40 41 add %sp, STACK_OFFSET, %o5 /* IEU0 */ 42 stx %g0, [%sp + STACK_OFFSET + 16] /* Store Group */ 43 stx %g0, [%sp + STACK_OFFSET + 24] /* Store Group */ 441: ldub [%o1], %o2 /* Load Group */ 45 46 brz,pn %o2, 2f /* CTI+IEU1 Group */ 47 srl %o2, 3, %o3 /* IEU0 */ 48 and %o3, 0x18, %o3 /* IEU0 Group */ 49 and %o2, 0x3f, %o2 /* IEU1 */ 50 51 ldx [%o5 + %o3], %g2 /* Load Group */ 52 sllx %o4, %o2, %g1 /* IEU0 */ 53 add %o1, 1, %o1 /* IEU1 */ 54 or %g2, %g1, %g2 /* IEU0 Group */ 55 56 ba,pt %xcc, 1b /* CTI */ 57 stx %g2, [%o5 + %o3] /* Store */ 582: andcc %o0, 7, %g0 /* IEU1 Group */ 59 be,a,pt %xcc, 4f /* CTI */ 60 61 ldx [%o0], %o2 /* Load */ 62 ldub [%o0], %o2 /* Load Group */ 633: srl %o2, 3, %o3 /* IEU0 Group */ 64 and %o2, 0x3f, %o2 /* IEU1 */ 65 66 and %o3, 0x18, %o3 /* IEU0 Group */ 67 ldx [%o5 + %o3], %g2 /* Load Group */ 68 sllx %o4, %o2, %g1 /* IEU0 */ 69 add %o0, 1, %o0 /* IEU1 */ 70 71 andcc %g2, %g1, %g0 /* IEU1 Group */ 72 bne,pn %xcc, 12f /* CTI */ 73 andcc %o0, 7, %g0 /* IEU1 Group */ 74 bne,a,pt %icc, 3b /* CTI */ 75 76 ldub [%o0], %o2 /* Load */ 77 ldx [%o0], %o2 /* Load Group */ 784: srlx %o2, 59, %o3 /* IEU0 Group */ 79 srlx %o2, 56, %g4 /* IEU0 Group */ 80 815: and %o3, 0x18, %o3 /* IEU1 */ 82 andcc %g4, 0x3f, %g4 /* IEU1 Group */ 83 ldx [%o5 + %o3], %g2 /* Load */ 84 srlx %o2, 51, %o3 /* IEU0 */ 85 86 sllx %o4, %g4, %g1 /* IEU0 Group */ 87 srlx %o2, 48, %g4 /* IEU0 Group */ 88 andcc %g2, %g1, %g2 /* IEU1 */ 89 bne,pn %xcc, 13f /* CTI */ 90 91 and %o3, 0x18, %o3 /* IEU0 Group */ 92 and %g4, 0x3f, %g4 /* IEU1 */ 93 ldx [%o5 + %o3], %g2 /* Load Group */ 94 srlx %o2, 43, %o3 /* IEU0 */ 95 96 sllx %o4, %g4, %g1 /* IEU0 Group */ 97 srlx %o2, 40, %g4 /* IEU0 Group */ 98 andcc %g2, %g1, %g2 /* IEU1 */ 99 bne,pn %xcc, 14f /* CTI */ 100 101 and %o3, 0x18, %o3 /* IEU0 Group */ 102 and %g4, 0x3f, %g4 /* IEU1 */ 103 ldx [%o5 + %o3], %g2 /* Load Group */ 104 srlx %o2, 35, %o3 /* IEU0 */ 105 106 sllx %o4, %g4, %g1 /* IEU0 Group */ 107 srlx %o2, 32, %g4 /* IEU0 Group */ 108 andcc %g2, %g1, %g2 /* IEU1 */ 109 bne,pn %xcc, 15f /* CTI */ 110 111 and %o3, 0x18, %o3 /* IEU0 Group */ 112 and %g4, 0x3f, %g4 /* IEU1 */ 113 ldx [%o5 + %o3], %g2 /* Load Group */ 114 srlx %o2, 27, %o3 /* IEU0 */ 115 116 sllx %o4, %g4, %g1 /* IEU0 Group */ 117 srlx %o2, 24, %g4 /* IEU0 Group */ 118 andcc %g2, %g1, %g2 /* IEU1 */ 119 bne,pn %xcc, 16f /* CTI */ 120 121 and %o3, 0x18, %o3 /* IEU0 Group */ 122 and %g4, 0x3f, %g4 /* IEU1 */ 123 ldx [%o5 + %o3], %g2 /* Load Group */ 124 srlx %o2, 19, %o3 /* IEU0 */ 125 126 sllx %o4, %g4, %g1 /* IEU0 Group */ 127 srlx %o2, 16, %g4 /* IEU0 Group */ 128 andcc %g2, %g1, %g2 /* IEU1 */ 129 bne,pn %xcc, 17f /* CTI */ 130 131 and %o3, 0x18, %o3 /* IEU0 Group */ 132 and %g4, 0x3f, %g4 /* IEU1 */ 133 ldx [%o5 + %o3], %g2 /* Load Group */ 134 srlx %o2, 11, %o3 /* IEU0 */ 135 136 sllx %o4, %g4, %g1 /* IEU0 Group */ 137 add %o0, 8, %o0 /* IEU1 */ 138 srlx %o2, 8, %g4 /* IEU0 Group */ 139 andcc %g2, %g1, %g2 /* IEU1 */ 140 141 bne,pn %xcc, 18f /* CTI */ 142 and %o3, 0x18, %o3 /* IEU0 Group */ 143 and %g4, 0x3f, %g4 /* IEU1 */ 144 ldx [%o5 + %o3], %g2 /* Load Group */ 145 146 sllx %o4, %g4, %g1 /* IEU0 */ 147 mov %o2, %g5 /* IEU1 */ 148 srlx %o2, 3, %o3 /* IEU0 Group */ 149 ldxa [%o0] ASI_PNF, %o2 /* Load */ 150 151 andcc %g2, %g1, %g2 /* IEU1 Group */ 152 bne,pn %xcc, 19f /* CTI */ 153 and %o3, 0x18, %o3 /* IEU0 Group */ 154 and %g5, 0x3f, %g4 /* IEU1 */ 155 156 ldx [%o5 + %o3], %g2 /* Load Group */ 157 sllx %o4, %g4, %g1 /* IEU0 */ 158 srlx %o2, 59, %o3 /* IEU0 Group */ 159 andcc %g2, %g1, %g2 /* IEU1 Group */ 160 161 be,pt %xcc, 5b /* CTI */ 162 srlx %o2, 56, %g4 /* IEU0 Group */ 163 sub %o0, 1, %o0 /* IEU1 */ 164 add %sp, STACK_SIZE+32, %sp /* IEU0 Group */ 165 166 andcc %g5, 0xff, %g0 /* IEU1 */ 167 retl /* CTI+IEU1 Group */ 168 move %icc, 0, %o0 /* Single Group */ 169 170 .align 16 17119: sub %o0, 2, %o0 /* IEU1 */ 172 srl %g5, 8, %g1 /* IEU0 Group */ 173 add %sp, STACK_SIZE+32, %sp /* IEU1 */ 174 andcc %g1, 0xff, %g0 /* IEU1 Group */ 175 176 retl /* CTI+IEU1 Group */ 177 move %icc, 0, %o0 /* Single Group */ 17818: sub %o0, 3, %o0 /* IEU1 */ 179 srl %o2, 16, %g1 /* IEU0 Group */ 180 181 add %sp, STACK_SIZE+32, %sp /* IEU1 */ 182 andcc %g1, 0xff, %g0 /* IEU1 Group */ 183 retl /* CTI+IEU1 Group */ 184 move %icc, 0, %o0 /* Single Group */ 185 18617: add %o0, 4, %o0 /* IEU1 */ 187 srl %o2, 24, %g1 /* IEU0 Group */ 188 add %sp, STACK_SIZE+32, %sp /* IEU1 */ 189 retl /* CTI+IEU1 Group */ 190 191 movrz %g1, 0, %o0 /* Single Group */ 19216: add %o0, 3, %o0 /* IEU1 */ 193 srlx %o2, 32, %g1 /* IEU0 Group */ 194 add %sp, STACK_SIZE+32, %sp /* IEU1 */ 195 196 andcc %g1, 0xff, %g0 /* IEU1 Group */ 197 retl /* CTI+IEU1 Group */ 198 move %icc, 0, %o0 /* Single Group */ 199 200 .align 16 20115: add %o0, 2, %o0 /* IEU1 */ 202 srlx %o2, 40, %g1 /* IEU0 Group */ 203 add %sp, STACK_SIZE+32, %sp /* IEU1 */ 204 andcc %g1, 0xff, %g0 /* IEU1 Group */ 205 206 retl /* CTI+IEU1 Group */ 207 move %icc, 0, %o0 /* Single Group */ 20814: add %o0, 1, %o0 /* IEU1 */ 209 srlx %o2, 48, %g1 /* IEU0 Group */ 210 211 add %sp, STACK_SIZE+32, %sp /* IEU1 */ 212 andcc %g1, 0xff, %g0 /* IEU1 Group */ 213 retl /* CTI+IEU1 Group */ 214 move %icc, 0, %o0 /* Single Group */ 215 21613: add %sp, STACK_SIZE+32, %sp /* IEU1 */ 217 srlx %o2, 56, %g1 /* IEU0 Group */ 218 retl /* CTI+IEU1 Group */ 219 movrz %g1, 0, %o0 /* Single Group */ 220 221 .align 16 22212: sub %o0, 1, %o0 /* IEU0 Group */ 223 or %o3, %o2, %g1 /* IEU1 */ 224 add %sp, STACK_SIZE+32, %sp /* IEU0 Group */ 225 retl /* CTI+IEU1 Group */ 226 227 movrz %g1, 0, %o0 /* Single Group */ 228END(strpbrk) 229libc_hidden_builtin_def (strpbrk) 230