hweight.S 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #include <linux/linkage.h>
  3. #include <asm/export.h>
  4. .text
  5. .align 32
  6. ENTRY(__arch_hweight8)
  7. sethi %hi(__sw_hweight8), %g1
  8. jmpl %g1 + %lo(__sw_hweight8), %g0
  9. nop
  10. ENDPROC(__arch_hweight8)
  11. EXPORT_SYMBOL(__arch_hweight8)
  12. .section .popc_3insn_patch, "ax"
  13. .word __arch_hweight8
  14. sllx %o0, 64-8, %g1
  15. retl
  16. popc %g1, %o0
  17. .previous
  18. ENTRY(__arch_hweight16)
  19. sethi %hi(__sw_hweight16), %g1
  20. jmpl %g1 + %lo(__sw_hweight16), %g0
  21. nop
  22. ENDPROC(__arch_hweight16)
  23. EXPORT_SYMBOL(__arch_hweight16)
  24. .section .popc_3insn_patch, "ax"
  25. .word __arch_hweight16
  26. sllx %o0, 64-16, %g1
  27. retl
  28. popc %g1, %o0
  29. .previous
  30. ENTRY(__arch_hweight32)
  31. sethi %hi(__sw_hweight32), %g1
  32. jmpl %g1 + %lo(__sw_hweight32), %g0
  33. nop
  34. ENDPROC(__arch_hweight32)
  35. EXPORT_SYMBOL(__arch_hweight32)
  36. .section .popc_3insn_patch, "ax"
  37. .word __arch_hweight32
  38. sllx %o0, 64-32, %g1
  39. retl
  40. popc %g1, %o0
  41. .previous
  42. ENTRY(__arch_hweight64)
  43. sethi %hi(__sw_hweight64), %g1
  44. jmpl %g1 + %lo(__sw_hweight64), %g0
  45. nop
  46. ENDPROC(__arch_hweight64)
  47. EXPORT_SYMBOL(__arch_hweight64)
  48. .section .popc_3insn_patch, "ax"
  49. .word __arch_hweight64
  50. retl
  51. popc %o0, %o0
  52. nop
  53. .previous