1 /* SPDX-License-Identifier: GPL-2.0-or-later */
4 * Copyright (C) IBM Corporation, 2010
6 * Author: Anton Blanchard <anton@au.ibm.com>
8 #include <asm/processor.h>
9 #include <asm/ppc_asm.h>
10 #include <asm/export.h>
11 #include <asm/feature-fixups.h>
13 /* Note: This code relies on -mminimal-toc */
15 _GLOBAL(__arch_hweight8)
24 ALT_FTR_SECTION_END_IFCLR(CPU_FTR_POPCNTB)
25 EXPORT_SYMBOL(__arch_hweight8)
27 _GLOBAL(__arch_hweight16)
35 BEGIN_FTR_SECTION_NESTED(50)
41 FTR_SECTION_ELSE_NESTED(50)
46 ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_POPCNTD, 50)
47 ALT_FTR_SECTION_END_IFCLR(CPU_FTR_POPCNTB)
48 EXPORT_SYMBOL(__arch_hweight16)
50 _GLOBAL(__arch_hweight32)
60 BEGIN_FTR_SECTION_NESTED(51)
68 FTR_SECTION_ELSE_NESTED(51)
72 ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_POPCNTD, 51)
73 ALT_FTR_SECTION_END_IFCLR(CPU_FTR_POPCNTB)
74 EXPORT_SYMBOL(__arch_hweight32)
76 _GLOBAL(__arch_hweight64)
88 BEGIN_FTR_SECTION_NESTED(52)
98 FTR_SECTION_ELSE_NESTED(52)
102 ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_POPCNTD, 52)
103 ALT_FTR_SECTION_END_IFCLR(CPU_FTR_POPCNTB)
104 EXPORT_SYMBOL(__arch_hweight64)