.. | .. |
---|
5 | 5 | #include <asm/cpufeatures.h> |
---|
6 | 6 | |
---|
7 | 7 | #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" |
---|
12 | 8 | #define REG_IN "D" |
---|
13 | 9 | #define REG_OUT "a" |
---|
14 | 10 | #else |
---|
15 | | -/* popcnt %eax, %eax */ |
---|
16 | | -#define POPCNT32 ".byte 0xf3,0x0f,0xb8,0xc0" |
---|
17 | 11 | #define REG_IN "a" |
---|
18 | 12 | #define REG_OUT "a" |
---|
19 | 13 | #endif |
---|
20 | | - |
---|
21 | | -#define __HAVE_ARCH_SW_HWEIGHT |
---|
22 | 14 | |
---|
23 | 15 | static __always_inline unsigned int __arch_hweight32(unsigned int w) |
---|
24 | 16 | { |
---|
25 | 17 | unsigned int res; |
---|
26 | 18 | |
---|
27 | | - asm (ALTERNATIVE("call __sw_hweight32", POPCNT32, X86_FEATURE_POPCNT) |
---|
| 19 | + asm (ALTERNATIVE("call __sw_hweight32", "popcntl %1, %0", X86_FEATURE_POPCNT) |
---|
28 | 20 | : "="REG_OUT (res) |
---|
29 | 21 | : REG_IN (w)); |
---|
30 | 22 | |
---|
.. | .. |
---|
52 | 44 | { |
---|
53 | 45 | unsigned long res; |
---|
54 | 46 | |
---|
55 | | - asm (ALTERNATIVE("call __sw_hweight64", POPCNT64, X86_FEATURE_POPCNT) |
---|
| 47 | + asm (ALTERNATIVE("call __sw_hweight64", "popcntq %1, %0", X86_FEATURE_POPCNT) |
---|
56 | 48 | : "="REG_OUT (res) |
---|
57 | 49 | : REG_IN (w)); |
---|
58 | 50 | |
---|