Centralize a couple JIT arithmetic helpers#127781
Conversation
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
There was a problem hiding this comment.
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 localnearest_pow2and word-popcount helpers withBitOperations::Log2/PopCount. - Replaced
BitSetSupport::CountBitsInIntegralcall sites in theUINT64andShortLongbitset implementations withBitOperations::PopCount. - Removed the now-unused
BitSetSupportnibble-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. |
|
CC. @dotnet/jit-contrib, small cleanup as I noticed we had a couple remaining custom There is a small annoying bit where |
No description provided.