[vectorIntrinsics] RFR: 8284459: Add x86 back-end implementation for LEADING and TRAILING ZEROS COUNT operations [v4]

Sandhya Viswanathan sviswanathan at openjdk.java.net
Thu Apr 21 00:44:51 UTC 2022


On Wed, 20 Apr 2022 21:27:37 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

>> Summary of changes:
>> - Patch extends auto-vectorize to vectorize following Java SE APIs.
>>      1) Integer.numberOfLeadingZeros()
>>      2) Long.numberOfLeadingZeros()
>>      3) Integer.numberOfTrailingZeros()
>>      4) Long.numberOfTrailingZeros()
>> 
>> - Adds optimized X86 backend implementation for VectorOperations.LEADING_ZERO_COUNT and VectorOperations.TRAILING_ZEROS_COUNT for AVX512 and legacy targets.
>> 
>> Kindly review and share your feedback.
>> 
>> Best Regards,
>> Jatin
>
> Jatin Bhateja has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains six commits:
> 
>  - 8284459: Review comments resolution.
>  - Merge branch 'vectorIntrinsics' of http://github.com/openjdk/panama-vector into JDK-8284459
>  - 8284459: Adding auto-vectorizer and x86 backend support for TRAILING_ZERO_COUNT, also some code re-organization.
>  - 8284459: Adding an exponent based leading zero count algorithm for integer vectors, its showing around 10-15% gain.
>  - Merge branch 'vectorIntrinsics' of http://github.com/openjdk/panama-vector into JDK-8284459
>  - 8284459: Add x86 back-end implementation for LEADING_ZERO_COUNT operation

src/hotspot/cpu/x86/x86.ad line 9251:

> 9249:     __ evmovdquq($dst$$XMMRegister, $src$$XMMRegister, vlen_enc);
> 9250:     __ vector_count_leading_zeros_evex(bt, $dst$$XMMRegister, $src$$XMMRegister, xnoreg, xnoreg,
> 9251:                                        xnoreg, $mask$$KRegister, noreg, true, vlen_enc);

For the PopCountVL and CountLeadingZerosV for long, if the result type is T_INT the evpmovqd instruction needs to be generated.

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

PR: https://git.openjdk.java.net/panama-vector/pull/189


More information about the panama-dev mailing list