RFR: 8365205: C2: Optimize popcount value computation using knownbits [v3]
Emanuel Peter
epeter at openjdk.org
Wed Sep 10 12:50:00 UTC 2025
On Wed, 10 Sep 2025 12:27:51 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:
>> Also: how many popcount instructions are left? Should it not at most be 1?
>
>> 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?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27075#discussion_r2336651060
More information about the hotspot-compiler-dev
mailing list