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

Hannes Greule hgreule at openjdk.org
Fri Sep 19 11:19:13 UTC 2025


On Fri, 19 Sep 2025 09:49:16 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:
> 
>   Update TestPopCountValueTransforms.java

src/hotspot/share/opto/countbitsnode.cpp line 123:

> 121: // we have at least and at most.
> 122: // From the definition of KnownBits, we know:
> 123: //   zeros: Indicates which bits must be 0: ones[i] =1 -> t[i]=0

I'm a bit confused by this, is ones[i] mixed up with zeros[i]? I.e., t[i]=0 if zeros[i]=1

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

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


More information about the hotspot-compiler-dev mailing list