RFR: 8365205: C2: Optimize popcount value computation using knownbits [v11]
Quan Anh Mai
qamai at openjdk.org
Fri Oct 3 12:17:51 UTC 2025
On Fri, 19 Sep 2025 20:44:54 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 countbitsnode.cpp
src/hotspot/share/opto/countbitsnode.cpp line 145:
> 143: }
> 144: KnownBits<juint> bits = t->isa_int()->_bits;
> 145: return TypeInt::make(population_count(bits._ones), population_count(~bits._zeros), Type::WidenMax);
The `widen` of the output should be the same as the `widen` of the input, not `WidenMax` here.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27075#discussion_r2401703583
More information about the core-libs-dev
mailing list