Skip to content

Commit ad42474

Browse files
author
Ingo Molnar
committed
x86/bitops: Remove unused __sw_hweight64() assembly implementation on x86-32
Header cleanups in the fast-headers tree highlighted that we have an unused assembly implementation for __sw_hweight64(): WARNING: modpost: EXPORT symbol "__sw_hweight64" [vmlinux] version ... __arch_hweight64() on x86-32 is defined in the arch/x86/include/asm/arch_hweight.h header as an inline, using __arch_hweight32(): #ifdef CONFIG_X86_32 static inline unsigned long __arch_hweight64(__u64 w) { return __arch_hweight32((u32)w) + __arch_hweight32((u32)(w >> 32)); } *But* there's also a __sw_hweight64() assembly implementation: arch/x86/lib/hweight.S SYM_FUNC_START(__sw_hweight64) #ifdef CONFIG_X86_64 ... #else /* CONFIG_X86_32 */ /* We're getting an u64 arg in (%eax,%edx): unsigned long hweight64(__u64 w) */ pushl %ecx call __sw_hweight32 movl %eax, %ecx # stash away result movl %edx, %eax # second part of input call __sw_hweight32 addl %ecx, %eax # result popl %ecx ret #endif But this __sw_hweight64 assembly implementation is unused - and it's essentially doing the same thing that the inline wrapper does. Remove the assembly version and add a comment about it. Reported-by: Nathan Chancellor <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: [email protected]
1 parent 7c097ca commit ad42474

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

arch/x86/lib/hweight.S

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,12 @@ SYM_FUNC_START(__sw_hweight32)
3636
SYM_FUNC_END(__sw_hweight32)
3737
EXPORT_SYMBOL(__sw_hweight32)
3838

39-
SYM_FUNC_START(__sw_hweight64)
39+
/*
40+
* No 32-bit variant, because it's implemented as an inline wrapper
41+
* on top of __arch_hweight32():
42+
*/
4043
#ifdef CONFIG_X86_64
44+
SYM_FUNC_START(__sw_hweight64)
4145
pushq %rdi
4246
pushq %rdx
4347

@@ -66,18 +70,6 @@ SYM_FUNC_START(__sw_hweight64)
6670
popq %rdx
6771
popq %rdi
6872
RET
69-
#else /* CONFIG_X86_32 */
70-
/* We're getting an u64 arg in (%eax,%edx): unsigned long hweight64(__u64 w) */
71-
pushl %ecx
72-
73-
call __sw_hweight32
74-
movl %eax, %ecx # stash away result
75-
movl %edx, %eax # second part of input
76-
call __sw_hweight32
77-
addl %ecx, %eax # result
78-
79-
popl %ecx
80-
RET
81-
#endif
8273
SYM_FUNC_END(__sw_hweight64)
8374
EXPORT_SYMBOL(__sw_hweight64)
75+
#endif

0 commit comments

Comments
 (0)