hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/arch/x86/include/asm/arch_hweight.h
....@@ -5,26 +5,18 @@
55 #include <asm/cpufeatures.h>
66
77 #ifdef CONFIG_64BIT
8
-/* popcnt %edi, %eax */
9
-#define POPCNT32 ".byte 0xf3,0x0f,0xb8,0xc7"
10
-/* popcnt %rdi, %rax */
11
-#define POPCNT64 ".byte 0xf3,0x48,0x0f,0xb8,0xc7"
128 #define REG_IN "D"
139 #define REG_OUT "a"
1410 #else
15
-/* popcnt %eax, %eax */
16
-#define POPCNT32 ".byte 0xf3,0x0f,0xb8,0xc0"
1711 #define REG_IN "a"
1812 #define REG_OUT "a"
1913 #endif
20
-
21
-#define __HAVE_ARCH_SW_HWEIGHT
2214
2315 static __always_inline unsigned int __arch_hweight32(unsigned int w)
2416 {
2517 unsigned int res;
2618
27
- asm (ALTERNATIVE("call __sw_hweight32", POPCNT32, X86_FEATURE_POPCNT)
19
+ asm (ALTERNATIVE("call __sw_hweight32", "popcntl %1, %0", X86_FEATURE_POPCNT)
2820 : "="REG_OUT (res)
2921 : REG_IN (w));
3022
....@@ -52,7 +44,7 @@
5244 {
5345 unsigned long res;
5446
55
- asm (ALTERNATIVE("call __sw_hweight64", POPCNT64, X86_FEATURE_POPCNT)
47
+ asm (ALTERNATIVE("call __sw_hweight64", "popcntq %1, %0", X86_FEATURE_POPCNT)
5648 : "="REG_OUT (res)
5749 : REG_IN (w));
5850