RFR: 8365205: C2: Optimize popcount value computation using knownbits [v7]

Emanuel Peter epeter at openjdk.org
Fri Sep 12 12:37:27 UTC 2025


On Thu, 11 Sep 2025 12:16:47 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

>> This patch optimizes PopCount value transforms using KnownBits information.
>> Following are the results of the micro-benchmark included with the patch
>> 
>> 
>> 
>> System: 13th Gen Intel(R) Core(TM) i3-1315U
>> 
>> Baseline:
>> Benchmark                                      Mode  Cnt       Score   Error  Units
>> PopCountValueTransform.LogicFoldingKerenLong  thrpt    2  215460.670          ops/s
>> PopCountValueTransform.LogicFoldingKerenlInt  thrpt    2  294014.826          ops/s
>> 
>> Withopt:
>> Benchmark                                      Mode  Cnt       Score   Error  Units
>> PopCountValueTransform.LogicFoldingKerenLong  thrpt    2  389978.082          ops/s
>> PopCountValueTransform.LogicFoldingKerenlInt  thrpt    2  417261.583          ops/s
>> 
>> 
>> Kindly review and share your feedback.
>> 
>> Best Regards,
>> Jatin
>
> Jatin Bhateja has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Adding random bound test point

test/hotspot/jtreg/compiler/intrinsics/TestPopCountValueTransforms.java line 56:

> 54:     static final long rand_bndL2 = G.uniformLongs(0xFFL, Long.MAX_VALUE).next();
> 55:     static final long rand_popcL1 = G.uniformLongs(0, 3).next();
> 56:     static final long rand_popcL2 = G.uniformLongs(20, 40).next();

What is the reason for limiting the range on all these values?
For example, we now never generate negative values, i.e. the msb is never set.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27075#discussion_r2344107725


More information about the hotspot-compiler-dev mailing list