sparc64: Remove unwind information from signal return stubs [BZ#31244]
[glibc.git] / sysdeps / alpha / string-fza.h
blob4d21cee3e23be6cf6a84eac296cf0a4b9a09d4f7
1 /* Basic zero byte detection. Generic C version.
2 Copyright (C) 2023-2024 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_FZA_H
20 #define _STRING_FZA_H 1
22 #include <string-misc.h>
23 #include <string-optype.h>
25 /* The CMPBGE instruction creates a bit mask rather than a byte mask.
26 However, if we narrow find_t to either 'int' or 'uint8_t', we get
27 unnecessary truncation instructions from the 'unsigned long' type
28 returned by __builtin_alpha_cmpbge. */
29 typedef op_t find_t;
31 static __always_inline find_t
32 find_zero_all (op_t x)
34 return __builtin_alpha_cmpbge (0, x);
37 static __always_inline find_t
38 find_eq_all (op_t x1, op_t x2)
40 return find_zero_all (x1 ^ x2);
43 static __always_inline find_t
44 find_zero_eq_all (op_t x1, op_t x2)
46 return find_zero_all (x1) | find_zero_all (x1 ^ x2);
49 static __always_inline find_t
50 find_zero_ne_all (op_t x1, op_t x2)
52 return find_zero_all (x1) | (find_zero_all (x1 ^ x2) ^ 0xff);
55 /* Define the "inexact" versions in terms of the exact versions. */
56 #define find_zero_low find_zero_all
57 #define find_eq_low find_eq_all
58 #define find_zero_eq_low find_zero_eq_all
60 #endif /* _STRING_FZA_H */