Recently the core hweight implementation was reworked to make it easier for an architecture to implement optimized hweight() operations. For MIPS, I get lazy and fall back to letting GCC emit the optimized code if it can. If ARCH_HAS_USABLE_BUILTIN_POPCOUNT is defined, we let GCC do it, otherwise, the fallback library call is used. The second patch turns this on for OCTEON as it has POP and DPOP instructions that GCC knows about. David Daney (2): MIPS: Create and use asm/arch_hweight.h MIPS: Octeon: Define ARCH_HAS_USABLE_BUILTIN_POPCOUNT for OCTEON. arch/mips/include/asm/arch_hweight.h | 38 ++++++++++++++++++++ arch/mips/include/asm/bitops.h | 5 ++- .../asm/mach-cavium-octeon/cpu-feature-overrides.h | 8 ++++ 3 files changed, 50 insertions(+), 1 deletions(-) create mode 100644 arch/mips/include/asm/arch_hweight.h