Both alpha and tile needed implementations of zero_bytemask. The alpha version is untested.
Unified · Split
| @@ -52,4 +52,6 @@ static inline unsigned long find_zero(unsigned long bits) · 51 unmodified lines | |||
| 52 | #endif | 52 | #endif |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | #define zero_bytemask(mask) ((2ul << (find_zero(mask) * 8)) - 1) | ||
| 56 | |||
| 55 | #endif /* _ASM_WORD_AT_A_TIME_H */ | 57 | #endif /* _ASM_WORD_AT_A_TIME_H */ |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | |||
| 6 | struct word_at_a_time { /* unused */ }; | 6 | struct word_at_a_time { /* unused */ }; |
| 7 | #define WORD_AT_A_TIME_CONSTANTS {} | 7 | #define WORD_AT_A_TIME_CONSTANTS {} |
| 8 | 8 | ||
| 9 | /* Generate 0x01 byte values for non-zero bytes using a SIMD instruction. */ | 9 | /* Generate 0x01 byte values for zero bytes using a SIMD instruction. */ |
| 10 | static inline unsigned long has_zero(unsigned long val, unsigned long *data, | 10 | static inline unsigned long has_zero(unsigned long val, unsigned long *data, |
| 11 | const struct word_at_a_time *c) | 11 | const struct word_at_a_time *c) |
| 12 | { | 12 | { |
| @@ -33,4 +33,10 @@ static inline long find_zero(unsigned long mask) · 20 unmodified lines | |||
| 33 | #endif | 33 | #endif |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | #ifdef __BIG_ENDIAN | ||
| 37 | #define zero_bytemask(mask) (~1ul << (63 - __builtin_clzl(mask))) | ||
| 38 | #else | ||
| 39 | #define zero_bytemask(mask) ((2ul << __builtin_ctzl(mask)) - 1) | ||
| 40 | #endif | ||
| 41 | |||
| 36 | #endif /* _ASM_WORD_AT_A_TIME_H */ | 42 | #endif /* _ASM_WORD_AT_A_TIME_H */ |