~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/powerpc/lib/hweight_64.S

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-or-later */
  2 /*
  3  *
  4  * Copyright (C) IBM Corporation, 2010
  5  *
  6  * Author: Anton Blanchard <anton@au.ibm.com>
  7  */
  8 #include <linux/export.h>
  9 #include <asm/processor.h>
 10 #include <asm/ppc_asm.h>
 11 #include <asm/feature-fixups.h>
 12 
 13 /* Note: This code relies on -mminimal-toc */
 14 
 15 _GLOBAL(__arch_hweight8)
 16 BEGIN_FTR_SECTION
 17         b CFUNC(__sw_hweight8)
 18         nop
 19         nop
 20 FTR_SECTION_ELSE
 21         PPC_POPCNTB(R3,R3)
 22         clrldi  r3,r3,64-8
 23         blr
 24 ALT_FTR_SECTION_END_IFCLR(CPU_FTR_POPCNTB)
 25 EXPORT_SYMBOL(__arch_hweight8)
 26 
 27 _GLOBAL(__arch_hweight16)
 28 BEGIN_FTR_SECTION
 29         b CFUNC(__sw_hweight16)
 30         nop
 31         nop
 32         nop
 33         nop
 34 FTR_SECTION_ELSE
 35   BEGIN_FTR_SECTION_NESTED(50)
 36         PPC_POPCNTB(R3,R3)
 37         srdi    r4,r3,8
 38         add     r3,r4,r3
 39         clrldi  r3,r3,64-8
 40         blr
 41   FTR_SECTION_ELSE_NESTED(50)
 42         clrlwi  r3,r3,16
 43         PPC_POPCNTW(R3,R3)
 44         clrldi  r3,r3,64-8
 45         blr
 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)
 49 
 50 _GLOBAL(__arch_hweight32)
 51 BEGIN_FTR_SECTION
 52         b CFUNC(__sw_hweight32)
 53         nop
 54         nop
 55         nop
 56         nop
 57         nop
 58         nop
 59 FTR_SECTION_ELSE
 60   BEGIN_FTR_SECTION_NESTED(51)
 61         PPC_POPCNTB(R3,R3)
 62         srdi    r4,r3,16
 63         add     r3,r4,r3
 64         srdi    r4,r3,8
 65         add     r3,r4,r3
 66         clrldi  r3,r3,64-8
 67         blr
 68   FTR_SECTION_ELSE_NESTED(51)
 69         PPC_POPCNTW(R3,R3)
 70         clrldi  r3,r3,64-8
 71         blr
 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)
 75 
 76 _GLOBAL(__arch_hweight64)
 77 BEGIN_FTR_SECTION
 78         b CFUNC(__sw_hweight64)
 79         nop
 80         nop
 81         nop
 82         nop
 83         nop
 84         nop
 85         nop
 86         nop
 87 FTR_SECTION_ELSE
 88   BEGIN_FTR_SECTION_NESTED(52)
 89         PPC_POPCNTB(R3,R3)
 90         srdi    r4,r3,32
 91         add     r3,r4,r3
 92         srdi    r4,r3,16
 93         add     r3,r4,r3
 94         srdi    r4,r3,8
 95         add     r3,r4,r3
 96         clrldi  r3,r3,64-8
 97         blr
 98   FTR_SECTION_ELSE_NESTED(52)
 99         PPC_POPCNTD(R3,R3)
100         clrldi  r3,r3,64-8
101         blr
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)

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php