1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_WORD_AT_A_TIME_H
3 #define _ASM_WORD_AT_A_TIME_H
5 #include <asm/compiler.h>
8 * word-at-a-time interface for Alpha.
12 * We do not use the word_at_a_time struct on Alpha, but it needs to be
13 * implemented to humour the generic code.
15 struct word_at_a_time {
16 const unsigned long unused;
19 #define WORD_AT_A_TIME_CONSTANTS { 0 }
21 /* Return nonzero if val has a zero */
22 static inline unsigned long has_zero(unsigned long val, unsigned long *bits, const struct word_at_a_time *c)
24 unsigned long zero_locations = __kernel_cmpbge(0, val);
25 *bits = zero_locations;
26 return zero_locations;
29 static inline unsigned long prep_zero_mask(unsigned long val, unsigned long bits, const struct word_at_a_time *c)
34 #define create_zero_mask(bits) (bits)
36 static inline unsigned long find_zero(unsigned long bits)
38 #if defined(CONFIG_ALPHA_EV6) && defined(CONFIG_ALPHA_EV67)
39 /* Simple if have CIX instructions */
40 return __kernel_cttz(bits);
42 unsigned long t1, t2, t3;
43 /* Retain lowest set bit only */
45 /* Binary search for lowest set bit */
56 #define zero_bytemask(mask) ((2ul << (find_zero(mask) * 8)) - 1)
58 #endif /* _ASM_WORD_AT_A_TIME_H */