mbox series

[v2,00/11] xen/bitops: hweight() cleanup/improvements

Message ID 20240828220351.2686408-1-andrew.cooper3@citrix.com (mailing list archive)
Headers show
Series xen/bitops: hweight() cleanup/improvements | expand

Message

Andrew Cooper Aug. 28, 2024, 10:03 p.m. UTC
The next phase of bitops cleanup.  This series:

 1) Untangles the mess around hweight()
 2) Removes some unwise uses of hweight()
 3) Makes it work transparently for RISC-V
 4) Use the POPCNT instruction on x86 when available

See individual patches for v2 changes.

https://gitlab.com/xen-project/people/andyhhp/xen/-/pipelines/1431232348
https://cirrus-ci.com/build/6014616877137920

Andrew Cooper (11):
  xen/compiler: Rename __attribute_const__ to attr_const
  xen/bitops: Switch from __pure to attr_const
  xen/bitops: Reinstate the please tidy message
  xen/bitops: Introduce a multiple_bits_set() helper
  xen/bitops: Convert 'hweight(x) > 1' to new multiple_bits_set()
  xen/bitops: Drop the remnants of hweight{8,16}()
  xen/bitops: Introduce generic_hweightl() and hweightl()
  xen/bitops: Drop hweight_long() and use hweightl()
  xen/bitops: Implement hweight32() in terms of hweightl()
  xen/bitops: Implement hweight64() in terms of hweight{l,32}()
  x86/bitops: Use the POPCNT instruction when available

 xen/arch/arm/include/asm/arm64/cpufeature.h |  12 +-
 xen/arch/arm/include/asm/bitops.h           |  11 --
 xen/arch/ppc/include/asm/bitops.h           |  11 +-
 xen/arch/x86/cpu/vpmu.c                     |   2 +-
 xen/arch/x86/hvm/vlapic.c                   |  10 +-
 xen/arch/x86/include/asm/bitops.h           |  32 ++++--
 xen/arch/x86/include/asm/byteorder.h        |   4 +-
 xen/arch/x86/include/asm/endbr.h            |   4 +-
 xen/common/bitmap.c                         |   4 +-
 xen/common/bitops.c                         |  40 +++++++
 xen/common/numa.c                           |   2 +-
 xen/include/xen/bitops.h                    | 118 +++++++++-----------
 xen/include/xen/byteorder/swab.h            |   6 +-
 xen/include/xen/compiler.h                  |   2 +-
 xen/include/xen/self-tests.h                |  10 +-
 xen/lib/Makefile                            |   2 +
 xen/lib/generic-hweightl.c                  |  49 ++++++++
 xen/lib/x86-generic-hweightl.c              |  69 ++++++++++++
 18 files changed, 266 insertions(+), 122 deletions(-)
 create mode 100644 xen/lib/generic-hweightl.c
 create mode 100644 xen/lib/x86-generic-hweightl.c