diff options
author | David S. Miller <davem@davemloft.net> | 2011-07-29 12:42:07 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-08-03 00:28:50 -0400 |
commit | ef7c4d4675d2a9206f913f26ca1a5cd41bff9d41 (patch) | |
tree | 88839b80e603ba395882df98b8a8c8f8385337b1 /arch/sparc/lib | |
parent | e95ade083939dcb4b0c51c1a2c8504ea9ef3d6ef (diff) |
sparc: Use popc if possible for hweight routines.
Just like powerpc, we code patch at boot time.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/lib')
-rw-r--r-- | arch/sparc/lib/Makefile | 2 | ||||
-rw-r--r-- | arch/sparc/lib/hweight.S | 51 |
2 files changed, 52 insertions, 1 deletions
diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile index c25f94d28df8..11c850a9b66f 100644 --- a/arch/sparc/lib/Makefile +++ b/arch/sparc/lib/Makefile | |||
@@ -37,7 +37,7 @@ lib-$(CONFIG_SPARC64) += GENmemcpy.o GENcopy_from_user.o GENcopy_to_user.o | |||
37 | lib-$(CONFIG_SPARC64) += GENpatch.o GENpage.o GENbzero.o | 37 | lib-$(CONFIG_SPARC64) += GENpatch.o GENpage.o GENbzero.o |
38 | 38 | ||
39 | lib-$(CONFIG_SPARC64) += copy_in_user.o user_fixup.o memmove.o | 39 | lib-$(CONFIG_SPARC64) += copy_in_user.o user_fixup.o memmove.o |
40 | lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o | 40 | lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o hweight.o |
41 | 41 | ||
42 | obj-y += iomap.o | 42 | obj-y += iomap.o |
43 | obj-$(CONFIG_SPARC32) += atomic32.o | 43 | obj-$(CONFIG_SPARC32) += atomic32.o |
diff --git a/arch/sparc/lib/hweight.S b/arch/sparc/lib/hweight.S new file mode 100644 index 000000000000..95414e0a6808 --- /dev/null +++ b/arch/sparc/lib/hweight.S | |||
@@ -0,0 +1,51 @@ | |||
1 | #include <linux/linkage.h> | ||
2 | |||
3 | .text | ||
4 | .align 32 | ||
5 | ENTRY(__arch_hweight8) | ||
6 | ba,pt %xcc, __sw_hweight8 | ||
7 | nop | ||
8 | nop | ||
9 | ENDPROC(__arch_hweight8) | ||
10 | .section .popc_3insn_patch, "ax" | ||
11 | .word __arch_hweight8 | ||
12 | sllx %o0, 64-8, %g1 | ||
13 | retl | ||
14 | popc %g1, %o0 | ||
15 | .previous | ||
16 | |||
17 | ENTRY(__arch_hweight16) | ||
18 | ba,pt %xcc, __sw_hweight16 | ||
19 | nop | ||
20 | nop | ||
21 | ENDPROC(__arch_hweight16) | ||
22 | .section .popc_3insn_patch, "ax" | ||
23 | .word __arch_hweight16 | ||
24 | sllx %o0, 64-16, %g1 | ||
25 | retl | ||
26 | popc %g1, %o0 | ||
27 | .previous | ||
28 | |||
29 | ENTRY(__arch_hweight32) | ||
30 | ba,pt %xcc, __sw_hweight32 | ||
31 | nop | ||
32 | nop | ||
33 | ENDPROC(__arch_hweight32) | ||
34 | .section .popc_3insn_patch, "ax" | ||
35 | .word __arch_hweight32 | ||
36 | sllx %o0, 64-32, %g1 | ||
37 | retl | ||
38 | popc %g1, %o0 | ||
39 | .previous | ||
40 | |||
41 | ENTRY(__arch_hweight64) | ||
42 | ba,pt %xcc, __sw_hweight64 | ||
43 | nop | ||
44 | nop | ||
45 | ENDPROC(__arch_hweight64) | ||
46 | .section .popc_3insn_patch, "ax" | ||
47 | .word __arch_hweight64 | ||
48 | retl | ||
49 | popc %o0, %o0 | ||
50 | nop | ||
51 | .previous | ||