Skip to content

Centralize a couple JIT arithmetic helpers#127781

Draft
tannergooding wants to merge 2 commits intodotnet:mainfrom
tannergooding:popcnt
Draft

Centralize a couple JIT arithmetic helpers#127781
tannergooding wants to merge 2 commits intodotnet:mainfrom
tannergooding:popcnt

Conversation

@tannergooding
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings May 5, 2026 00:35
@github-actions github-actions Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label May 5, 2026
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors a few low-level JIT bit-manipulation helpers to use the shared BitOperations implementation instead of maintaining local counting/log2 helpers. It keeps the change scoped to internal helper code used by JIT bitsets and hash bit-vectors.

Changes:

  • Replaced hashbv’s local nearest_pow2 and word-popcount helpers with BitOperations::Log2/PopCount.
  • Replaced BitSetSupport::CountBitsInIntegral call sites in the UINT64 and ShortLong bitset implementations with BitOperations::PopCount.
  • Removed the now-unused BitSetSupport nibble-count table and integral bit-count helper implementation.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/coreclr/jit/hashbv.h Swaps nearest_pow2 over to BitOperations::Log2.
src/coreclr/jit/hashbv.cpp Replaces local hashbv popcount helpers with shared BitOperations::PopCount.
src/coreclr/jit/bitsetasuint64.h Uses shared popcount for the UINT64 bitset representation.
src/coreclr/jit/bitsetasshortlong.h Uses shared popcount for both short and long BSShortLong counting paths.
src/coreclr/jit/bitset.h Removes obsolete integral bit-count helper declarations.
src/coreclr/jit/bitset.cpp Removes obsolete nibble-count lookup table definition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants