i686: Do not raise exception traps on fesetexcept (BZ 30989)
[glibc.git] / sysdeps / hppa / string-fzi.h
blob08cdace41656987b4fccfafec82042a96e9da561
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/>. */
19 #ifndef _STRING_FZI_H
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)
30 unsigned int ret;
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"
35 "ldi 2,%0\n\t"
36 "extrw,u,= %1,15,8,%%r0\n\t"
37 "ldi 1,%0\n\t"
38 "extrw,u,= %1,7,8,%%r0\n\t"
39 "ldi 0,%0"
40 : "=r"(ret) : "r"(c), "0"(3));
42 return ret;
45 static __always_inline unsigned int
46 index_last (find_t c)
48 unsigned int ret;
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"
53 "ldi 1,%0\n\t"
54 "extrw,u,= %1,23,8,%%r0\n\t"
55 "ldi 2,%0\n\t"
56 "extrw,u,= %1,31,8,%%r0\n\t"
57 "ldi 3,%0"
58 : "=r"(ret) : "r"(c), "0"(0));
60 return ret;
63 #endif /* _STRING_FZI_H */