History

word-at-a-time.h: support zero_bytemask() on alpha and tile

Both alpha and tile needed implementations of zero_bytemask. The alpha version is untested.

Chris Metcalf committed 11 years ago

Commit c753bf31 parent 19c22f32 files · +9 −1Browse files

Unified · Split

2 files
  1. arch/alpha/include/asm/word-at-a-time.h +2 −0
  2. arch/tile/include/asm/word-at-a-time.h +7 −1
arch/alpha/include/asm/word-at-a-time.h+2−0
@@ -52,4 +52,6 @@ static inline unsigned long find_zero(unsigned long bits) · 51 unmodified lines
52#endif52#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 */
arch/tile/include/asm/word-at-a-time.h+7−1
@@ -6,7 +6,7 @@ · 5 unmodified lines
6struct word_at_a_time { /* unused */ };6struct 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. */
10static inline unsigned long has_zero(unsigned long val, unsigned long *data,10static 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#endif33#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 */