RFR: 8365205: C2: Optimize popcount value computation using knownbits [v3]
Jatin Bhateja
jbhateja at openjdk.org
Wed Sep 10 14:24:28 UTC 2025
On Wed, 10 Sep 2025 12:47:42 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
>>> Thanks for the tests!
>>>
>>> I think it would be quite valuable to have some tests that do not just clamp the range, but also create random `KnownBits`, i.e. with random and/or masks.
>>>
>>> For example: `num = (num | ONES) & ZEROS;`
>>>
>>> And then you generate `ONES` and `ZEROS` randomly, maybe even using `Generators`? Then round it off with some random range comparisons at the end: ` if (Integer.bitCount(num) >= CON1 && Integer.bitCount(num) <= CON2) {`
>>
>> With Random Ranges, we will not be able to ascertain the count of PopCountI IR node, which is why I created different tests for complete logic sweeping, and the one which retains PopCountIR.
>
> Oh, maybe I missed those "complete logic sweeping tests". Can you please point me to them?
testPopCountElisionInt1 and testPopCountElisionLong1 check for absence of PopCount IR nodes.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27075#discussion_r2336945012
More information about the hotspot-compiler-dev
mailing list