0001
0002
0003
0004
0005
0006
0007
0008 #include <asm/processor.h>
0009 #include <asm/ppc_asm.h>
0010 #include <asm/export.h>
0011 #include <asm/feature-fixups.h>
0012
0013
0014
0015 _GLOBAL(__arch_hweight8)
0016 BEGIN_FTR_SECTION
0017 b __sw_hweight8
0018 nop
0019 nop
0020 FTR_SECTION_ELSE
0021 PPC_POPCNTB(R3,R3)
0022 clrldi r3,r3,64-8
0023 blr
0024 ALT_FTR_SECTION_END_IFCLR(CPU_FTR_POPCNTB)
0025 EXPORT_SYMBOL(__arch_hweight8)
0026
0027 _GLOBAL(__arch_hweight16)
0028 BEGIN_FTR_SECTION
0029 b __sw_hweight16
0030 nop
0031 nop
0032 nop
0033 nop
0034 FTR_SECTION_ELSE
0035 BEGIN_FTR_SECTION_NESTED(50)
0036 PPC_POPCNTB(R3,R3)
0037 srdi r4,r3,8
0038 add r3,r4,r3
0039 clrldi r3,r3,64-8
0040 blr
0041 FTR_SECTION_ELSE_NESTED(50)
0042 clrlwi r3,r3,16
0043 PPC_POPCNTW(R3,R3)
0044 clrldi r3,r3,64-8
0045 blr
0046 ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_POPCNTD, 50)
0047 ALT_FTR_SECTION_END_IFCLR(CPU_FTR_POPCNTB)
0048 EXPORT_SYMBOL(__arch_hweight16)
0049
0050 _GLOBAL(__arch_hweight32)
0051 BEGIN_FTR_SECTION
0052 b __sw_hweight32
0053 nop
0054 nop
0055 nop
0056 nop
0057 nop
0058 nop
0059 FTR_SECTION_ELSE
0060 BEGIN_FTR_SECTION_NESTED(51)
0061 PPC_POPCNTB(R3,R3)
0062 srdi r4,r3,16
0063 add r3,r4,r3
0064 srdi r4,r3,8
0065 add r3,r4,r3
0066 clrldi r3,r3,64-8
0067 blr
0068 FTR_SECTION_ELSE_NESTED(51)
0069 PPC_POPCNTW(R3,R3)
0070 clrldi r3,r3,64-8
0071 blr
0072 ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_POPCNTD, 51)
0073 ALT_FTR_SECTION_END_IFCLR(CPU_FTR_POPCNTB)
0074 EXPORT_SYMBOL(__arch_hweight32)
0075
0076 _GLOBAL(__arch_hweight64)
0077 BEGIN_FTR_SECTION
0078 b __sw_hweight64
0079 nop
0080 nop
0081 nop
0082 nop
0083 nop
0084 nop
0085 nop
0086 nop
0087 FTR_SECTION_ELSE
0088 BEGIN_FTR_SECTION_NESTED(52)
0089 PPC_POPCNTB(R3,R3)
0090 srdi r4,r3,32
0091 add r3,r4,r3
0092 srdi r4,r3,16
0093 add r3,r4,r3
0094 srdi r4,r3,8
0095 add r3,r4,r3
0096 clrldi r3,r3,64-8
0097 blr
0098 FTR_SECTION_ELSE_NESTED(52)
0099 PPC_POPCNTD(R3,R3)
0100 clrldi r3,r3,64-8
0101 blr
0102 ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_POPCNTD, 52)
0103 ALT_FTR_SECTION_END_IFCLR(CPU_FTR_POPCNTB)
0104 EXPORT_SYMBOL(__arch_hweight64)