x86/oprofile: Fix bogus GCC-8 warning in nmi_setup()
[cris-mirror.git] / arch / tile / include / asm / word-at-a-time.h
blob2f2515867760f2ddf35761c25ac8d895a974c7f2
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/byteorder.h>
7 struct word_at_a_time { /* unused */ };
8 #define WORD_AT_A_TIME_CONSTANTS {}
10 /* Generate 0x01 byte values for zero bytes using a SIMD instruction. */
11 static inline unsigned long has_zero(unsigned long val, unsigned long *data,
12 const struct word_at_a_time *c)
14 #ifdef __tilegx__
15 unsigned long mask = __insn_v1cmpeqi(val, 0);
16 #else /* tilepro */
17 unsigned long mask = __insn_seqib(val, 0);
18 #endif
19 *data = mask;
20 return mask;
23 /* These operations are both nops. */
24 #define prep_zero_mask(val, data, c) (data)
25 #define create_zero_mask(data) (data)
27 /* And this operation just depends on endianness. */
28 static inline long find_zero(unsigned long mask)
30 #ifdef __BIG_ENDIAN
31 return __builtin_clzl(mask) >> 3;
32 #else
33 return __builtin_ctzl(mask) >> 3;
34 #endif
37 #ifdef __BIG_ENDIAN
38 #define zero_bytemask(mask) (~1ul << (63 - __builtin_clzl(mask)))
39 #else
40 #define zero_bytemask(mask) ((2ul << __builtin_ctzl(mask)) - 1)
41 #endif
43 #endif /* _ASM_WORD_AT_A_TIME_H */