RFR: 8350468: x86: Improve implementation of vectorized numberOfLeadingZeros for int and long [v2]

Jasmine Karthikeyan jkarthikeyan at openjdk.org
Wed Nov 5 01:28:35 UTC 2025


On Tue, 23 Sep 2025 23:20:46 GMT, Sandhya Viswanathan <sviswanathan at openjdk.org> wrote:

>> Jasmine Karthikeyan has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
>> 
>>  - Fix typo in comment
>>  - Merge branch 'master' into optimize-leading-zero
>>  - Optimize numberOfLeadingZeros
>
> src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp line 6289:
> 
>> 6287:   // Move the top half result to the bottom half of xtmp1, setting the top half to 0.
>> 6288:   vpsrlq(xtmp1, dst, 32, vec_enc);
>> 6289:   // By moving the top half result to the right by 6 bytes, if the top half was empty (i.e. 32 is returned) the result bit will
> 
> I think you mean 6 bits here and not 6 bytes.

This is a good catch, I did mean bits here. I've fixed this in the latest commit.

> test/hotspot/jtreg/compiler/vectorization/TestNumberOfContinuousZeros.java line 49:
> 
>> 47: 
>> 48: public class TestNumberOfContinuousZeros {
>> 49:     private static final int[] SPECIAL_INT = { 0, 0x01FFFFFF, 0x03FFFFFE, 0x07FFFFFC, 0x0FFFFFF8, 0x1FFFFFF0, 0x3FFFFFE0, 0xFFFFFFFF };
> 
> Please also update the copyright year for the file to 2025.

I think this file already has a 2025 copyright, since I'm an individual contributor I'd be covered by the Oracle one.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26610#discussion_r2492497362
PR Review Comment: https://git.openjdk.org/jdk/pull/26610#discussion_r2492498871


More information about the hotspot-compiler-dev mailing list