Linux 4.1.18
[linux/fpc-iii.git] / arch / alpha / include / asm / word-at-a-time.h
blob6b340d0f1521c3ad9c4edf984abe60982ae24c04
1 #ifndef _ASM_WORD_AT_A_TIME_H
2 #define _ASM_WORD_AT_A_TIME_H
4 #include <asm/compiler.h>
6 /*
7 * word-at-a-time interface for Alpha.
8 */
11 * We do not use the word_at_a_time struct on Alpha, but it needs to be
12 * implemented to humour the generic code.
14 struct word_at_a_time {
15 const unsigned long unused;
18 #define WORD_AT_A_TIME_CONSTANTS { 0 }
20 /* Return nonzero if val has a zero */
21 static inline unsigned long has_zero(unsigned long val, unsigned long *bits, const struct word_at_a_time *c)
23 unsigned long zero_locations = __kernel_cmpbge(0, val);
24 *bits = zero_locations;
25 return zero_locations;
28 static inline unsigned long prep_zero_mask(unsigned long val, unsigned long bits, const struct word_at_a_time *c)
30 return bits;
33 #define create_zero_mask(bits) (bits)
35 static inline unsigned long find_zero(unsigned long bits)
37 #if defined(CONFIG_ALPHA_EV6) && defined(CONFIG_ALPHA_EV67)
38 /* Simple if have CIX instructions */
39 return __kernel_cttz(bits);
40 #else
41 unsigned long t1, t2, t3;
42 /* Retain lowest set bit only */
43 bits &= -bits;
44 /* Binary search for lowest set bit */
45 t1 = bits & 0xf0;
46 t2 = bits & 0xcc;
47 t3 = bits & 0xaa;
48 if (t1) t1 = 4;
49 if (t2) t2 = 2;
50 if (t3) t3 = 1;
51 return t1 + t2 + t3;
52 #endif
55 #endif /* _ASM_WORD_AT_A_TIME_H */