1 /* string-fzi.h -- zero byte indexes. HPPA version.
2 Copyright (C) 2023 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 Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the 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 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
20 #define _STRING_FZI_H 1
22 #include <string-optype.h>
23 #include <string-fza.h>
25 _Static_assert (sizeof (op_t
) == 4, "64-bit not supported");
27 static __always_inline
unsigned int
28 index_first (find_t c
)
32 /* Since we have no clz insn, direct tests of the bytes is faster
33 than loading up the constants to do the masking. */
34 asm ("extrw,u,= %1,23,8,%%r0\n\t"
36 "extrw,u,= %1,15,8,%%r0\n\t"
38 "extrw,u,= %1,7,8,%%r0\n\t"
40 : "=r"(ret
) : "r"(c
), "0"(3));
45 static __always_inline
unsigned int
50 /* Since we have no ctz insn, direct tests of the bytes is faster
51 than loading up the constants to do the masking. */
52 asm ("extrw,u,= %1,15,8,%%r0\n\t"
54 "extrw,u,= %1,23,8,%%r0\n\t"
56 "extrw,u,= %1,31,8,%%r0\n\t"
58 : "=r"(ret
) : "r"(c
), "0"(0));
63 #endif /* _STRING_FZI_H */