summaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-08-31 18:37:33 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2015-08-31 18:37:33 -0700
commit5757bd6157f523ff0d448a4ec93938523ca441a9 (patch)
tree713885bff513324e1935874653e546162cdbe540 /arch/x86/include/asm
parent7073bc66126e3ab742cce9416ad6b4be8b03c4f7 (diff)
parentaccd0b9ec015d611eb7783dd86f1bb31bf8d62ab (diff)
downloadop-kernel-dev-5757bd6157f523ff0d448a4ec93938523ca441a9.zip
op-kernel-dev-5757bd6157f523ff0d448a4ec93938523ca441a9.tar.gz
Merge branch 'core-types-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull inlining tuning from Ingo Molnar: "A handful of inlining optimizations inspired by x86 work but applicable in general" * 'core-types-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: jiffies: Force inlining of {m,u}msecs_to_jiffies() x86/hweight: Force inlining of __arch_hweight{32,64}() linux/bitmap: Force inlining of bitmap weight functions
Diffstat (limited to 'arch/x86/include/asm')
-rw-r--r--arch/x86/include/asm/arch_hweight.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/arch/x86/include/asm/arch_hweight.h b/arch/x86/include/asm/arch_hweight.h
index 9686c3d..259a7c1 100644
--- a/arch/x86/include/asm/arch_hweight.h
+++ b/arch/x86/include/asm/arch_hweight.h
@@ -21,7 +21,7 @@
* ARCH_HWEIGHT_CFLAGS in <arch/x86/Kconfig> for the respective
* compiler switches.
*/
-static inline unsigned int __arch_hweight32(unsigned int w)
+static __always_inline unsigned int __arch_hweight32(unsigned int w)
{
unsigned int res = 0;
@@ -42,20 +42,23 @@ static inline unsigned int __arch_hweight8(unsigned int w)
return __arch_hweight32(w & 0xff);
}
+#ifdef CONFIG_X86_32
static inline unsigned long __arch_hweight64(__u64 w)
{
- unsigned long res = 0;
-
-#ifdef CONFIG_X86_32
return __arch_hweight32((u32)w) +
__arch_hweight32((u32)(w >> 32));
+}
#else
+static __always_inline unsigned long __arch_hweight64(__u64 w)
+{
+ unsigned long res = 0;
+
asm (ALTERNATIVE("call __sw_hweight64", POPCNT64, X86_FEATURE_POPCNT)
: "="REG_OUT (res)
: REG_IN (w));
-#endif /* CONFIG_X86_32 */
return res;
}
+#endif /* CONFIG_X86_32 */
#endif
OpenPOWER on IntegriCloud