Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Make ARCH_HAS_FAST_MULTIPLIER a real config variable

It used to be an ad-hoc hack defined by the x86 version of
<asm/bitops.h> that enabled a couple of library routines to know whether
an integer multiply is faster than repeated shifts and additions.

This just makes it use the real Kconfig system instead, and makes x86
(which was the only architecture that did this) select the option.

NOTE! Even for x86, this really is kind of wrong. If we cared, we would
probably not enable this for builds optimized for netburst (P4), where
shifts-and-adds are generally faster than multiplies. This patch does
*not* change that kind of logic, though, it is purely a syntactic change
with no code changes.

This was triggered by the fact that we have other places that really
want to know "do I want to expand multiples by constants by hand or
not", particularly the hash generation code.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+8 -6
+1
arch/x86/Kconfig
··· 23 23 def_bool y 24 24 select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI 25 25 select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS 26 + select ARCH_HAS_FAST_MULTIPLIER 26 27 select ARCH_MIGHT_HAVE_PC_PARPORT 27 28 select ARCH_MIGHT_HAVE_PC_SERIO 28 29 select HAVE_AOUT if X86_32
-2
arch/x86/include/asm/bitops.h
··· 497 497 498 498 #include <asm-generic/bitops/sched.h> 499 499 500 - #define ARCH_HAS_FAST_MULTIPLIER 1 501 - 502 500 #include <asm/arch_hweight.h> 503 501 504 502 #include <asm-generic/bitops/const_hweight.h>
+3
lib/Kconfig
··· 51 51 config ARCH_USE_CMPXCHG_LOCKREF 52 52 bool 53 53 54 + config ARCH_HAS_FAST_MULTIPLIER 55 + bool 56 + 54 57 config CRC_CCITT 55 58 tristate "CRC-CCITT functions" 56 59 help
+2 -2
lib/hweight.c
··· 11 11 12 12 unsigned int __sw_hweight32(unsigned int w) 13 13 { 14 - #ifdef ARCH_HAS_FAST_MULTIPLIER 14 + #ifdef CONFIG_ARCH_HAS_FAST_MULTIPLIER 15 15 w -= (w >> 1) & 0x55555555; 16 16 w = (w & 0x33333333) + ((w >> 2) & 0x33333333); 17 17 w = (w + (w >> 4)) & 0x0f0f0f0f; ··· 49 49 return __sw_hweight32((unsigned int)(w >> 32)) + 50 50 __sw_hweight32((unsigned int)w); 51 51 #elif BITS_PER_LONG == 64 52 - #ifdef ARCH_HAS_FAST_MULTIPLIER 52 + #ifdef CONFIG_ARCH_HAS_FAST_MULTIPLIER 53 53 w -= (w >> 1) & 0x5555555555555555ul; 54 54 w = (w & 0x3333333333333333ul) + ((w >> 2) & 0x3333333333333333ul); 55 55 w = (w + (w >> 4)) & 0x0f0f0f0f0f0f0f0ful;
+2 -2
lib/string.c
··· 807 807 return check_bytes8(start, value, bytes); 808 808 809 809 value64 = value; 810 - #if defined(ARCH_HAS_FAST_MULTIPLIER) && BITS_PER_LONG == 64 810 + #if defined(CONFIG_ARCH_HAS_FAST_MULTIPLIER) && BITS_PER_LONG == 64 811 811 value64 *= 0x0101010101010101; 812 - #elif defined(ARCH_HAS_FAST_MULTIPLIER) 812 + #elif defined(CONFIG_ARCH_HAS_FAST_MULTIPLIER) 813 813 value64 *= 0x01010101; 814 814 value64 |= value64 << 32; 815 815 #else