1 #ifndef _ASM_WORD_AT_A_TIME_H 2 #define _ASM_WORD_AT_A_TIME_H 3 4 #include <asm/compiler.h> 5 6 /* 7 * word-at-a-time interface for Alpha. 8 */ 9 10 /* 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. 13 */ 14 struct word_at_a_time { 15 const unsigned long unused; 16 }; 17 18 #define WORD_AT_A_TIME_CONSTANTS { 0 } 19 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) 22 { 23 unsigned long zero_locations = __kernel_cmpbge(0, val); 24 *bits = zero_locations; 25 return zero_locations; 26 } 27 28 static inline unsigned long prep_zero_mask(unsigned long val, unsigned long bits, const struct word_at_a_time *c) 29 { 30 return bits; 31 } 32 33 #define create_zero_mask(bits) (bits) 34 35 static inline unsigned long find_zero(unsigned long bits) 36 { 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 53 } 54 55 #endif /* _ASM_WORD_AT_A_TIME_H */ 56