aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2010-12-07 14:58:17 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2010-12-08 23:35:30 -0500
commitb5f9b6665b70b4c844bed5452f6a14743eefa57c (patch)
tree51c632149aa23af7eaa68283416dba9d8b8ee3b8 /arch/powerpc
parentb8c49def6d73321724bab66dd30526744b482f0a (diff)
powerpc: Hardcode popcnt instructions for old assemblers
The popcnt instructions went into binutils relatively recently. As with a number of other instructions, create macros and hardcode them. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/include/asm/ppc-opcode.h8
-rw-r--r--arch/powerpc/lib/hweight_64.S14
2 files changed, 15 insertions, 7 deletions
diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
index 43adc8b819ed..1255569387b6 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -36,6 +36,8 @@
36#define PPC_INST_NOP 0x60000000 36#define PPC_INST_NOP 0x60000000
37#define PPC_INST_POPCNTB 0x7c0000f4 37#define PPC_INST_POPCNTB 0x7c0000f4
38#define PPC_INST_POPCNTB_MASK 0xfc0007fe 38#define PPC_INST_POPCNTB_MASK 0xfc0007fe
39#define PPC_INST_POPCNTD 0x7c0003f4
40#define PPC_INST_POPCNTW 0x7c0002f4
39#define PPC_INST_RFCI 0x4c000066 41#define PPC_INST_RFCI 0x4c000066
40#define PPC_INST_RFDI 0x4c00004e 42#define PPC_INST_RFDI 0x4c00004e
41#define PPC_INST_RFMCI 0x4c00004c 43#define PPC_INST_RFMCI 0x4c00004c
@@ -88,6 +90,12 @@
88 __PPC_RB(b) | __PPC_EH(eh)) 90 __PPC_RB(b) | __PPC_EH(eh))
89#define PPC_MSGSND(b) stringify_in_c(.long PPC_INST_MSGSND | \ 91#define PPC_MSGSND(b) stringify_in_c(.long PPC_INST_MSGSND | \
90 __PPC_RB(b)) 92 __PPC_RB(b))
93#define PPC_POPCNTB(a, s) stringify_in_c(.long PPC_INST_POPCNTB | \
94 __PPC_RA(a) | __PPC_RS(s))
95#define PPC_POPCNTD(a, s) stringify_in_c(.long PPC_INST_POPCNTD | \
96 __PPC_RA(a) | __PPC_RS(s))
97#define PPC_POPCNTW(a, s) stringify_in_c(.long PPC_INST_POPCNTW | \
98 __PPC_RA(a) | __PPC_RS(s))
91#define PPC_RFCI stringify_in_c(.long PPC_INST_RFCI) 99#define PPC_RFCI stringify_in_c(.long PPC_INST_RFCI)
92#define PPC_RFDI stringify_in_c(.long PPC_INST_RFDI) 100#define PPC_RFDI stringify_in_c(.long PPC_INST_RFDI)
93#define PPC_RFMCI stringify_in_c(.long PPC_INST_RFMCI) 101#define PPC_RFMCI stringify_in_c(.long PPC_INST_RFMCI)
diff --git a/arch/powerpc/lib/hweight_64.S b/arch/powerpc/lib/hweight_64.S
index ee2320bb5ddf..fda27868cf8c 100644
--- a/arch/powerpc/lib/hweight_64.S
+++ b/arch/powerpc/lib/hweight_64.S
@@ -28,7 +28,7 @@ BEGIN_FTR_SECTION
28 nop 28 nop
29 nop 29 nop
30FTR_SECTION_ELSE 30FTR_SECTION_ELSE
31 popcntb r3,r3 31 PPC_POPCNTB(r3,r3)
32 clrldi r3,r3,64-8 32 clrldi r3,r3,64-8
33 blr 33 blr
34ALT_FTR_SECTION_END_IFCLR(CPU_FTR_POPCNTB) 34ALT_FTR_SECTION_END_IFCLR(CPU_FTR_POPCNTB)
@@ -42,14 +42,14 @@ BEGIN_FTR_SECTION
42 nop 42 nop
43FTR_SECTION_ELSE 43FTR_SECTION_ELSE
44 BEGIN_FTR_SECTION_NESTED(50) 44 BEGIN_FTR_SECTION_NESTED(50)
45 popcntb r3,r3 45 PPC_POPCNTB(r3,r3)
46 srdi r4,r3,8 46 srdi r4,r3,8
47 add r3,r4,r3 47 add r3,r4,r3
48 clrldi r3,r3,64-8 48 clrldi r3,r3,64-8
49 blr 49 blr
50 FTR_SECTION_ELSE_NESTED(50) 50 FTR_SECTION_ELSE_NESTED(50)
51 clrlwi r3,r3,16 51 clrlwi r3,r3,16
52 popcntw r3,r3 52 PPC_POPCNTW(r3,r3)
53 clrldi r3,r3,64-8 53 clrldi r3,r3,64-8
54 blr 54 blr
55 ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_POPCNTD, 50) 55 ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_POPCNTD, 50)
@@ -66,7 +66,7 @@ BEGIN_FTR_SECTION
66 nop 66 nop
67FTR_SECTION_ELSE 67FTR_SECTION_ELSE
68 BEGIN_FTR_SECTION_NESTED(51) 68 BEGIN_FTR_SECTION_NESTED(51)
69 popcntb r3,r3 69 PPC_POPCNTB(r3,r3)
70 srdi r4,r3,16 70 srdi r4,r3,16
71 add r3,r4,r3 71 add r3,r4,r3
72 srdi r4,r3,8 72 srdi r4,r3,8
@@ -74,7 +74,7 @@ FTR_SECTION_ELSE
74 clrldi r3,r3,64-8 74 clrldi r3,r3,64-8
75 blr 75 blr
76 FTR_SECTION_ELSE_NESTED(51) 76 FTR_SECTION_ELSE_NESTED(51)
77 popcntw r3,r3 77 PPC_POPCNTW(r3,r3)
78 clrldi r3,r3,64-8 78 clrldi r3,r3,64-8
79 blr 79 blr
80 ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_POPCNTD, 51) 80 ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_POPCNTD, 51)
@@ -93,7 +93,7 @@ BEGIN_FTR_SECTION
93 nop 93 nop
94FTR_SECTION_ELSE 94FTR_SECTION_ELSE
95 BEGIN_FTR_SECTION_NESTED(52) 95 BEGIN_FTR_SECTION_NESTED(52)
96 popcntb r3,r3 96 PPC_POPCNTB(r3,r3)
97 srdi r4,r3,32 97 srdi r4,r3,32
98 add r3,r4,r3 98 add r3,r4,r3
99 srdi r4,r3,16 99 srdi r4,r3,16
@@ -103,7 +103,7 @@ FTR_SECTION_ELSE
103 clrldi r3,r3,64-8 103 clrldi r3,r3,64-8
104 blr 104 blr
105 FTR_SECTION_ELSE_NESTED(52) 105 FTR_SECTION_ELSE_NESTED(52)
106 popcntd r3,r3 106 PPC_POPCNTD(r3,r3)
107 clrldi r3,r3,64-8 107 clrldi r3,r3,64-8
108 blr 108 blr
109 ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_POPCNTD, 52) 109 ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_POPCNTD, 52)