[vectorIntrinsics] RFR: 8283598: [vectorapi] Add new vector operation for compress and expand bits [v2]

Paul Sandoz psandoz at openjdk.java.net
Tue Apr 12 19:38:08 UTC 2022


On Thu, 7 Apr 2022 06:27:35 GMT, Smita Kamath <svkamath at openjdk.org> wrote:

>> Hi,
>> 
>> I've added support for new vector operations for compressing bits of integral vector types(Byte/Short/Integer/Long).
>> The implementation is based on Compress or Generalized Extract mentioned in Hackers Delight by Henry S. Warren, Jr.
>> The implementation does the following: given a mask and the number to be compressed, the bits of the number corresponding to the set mask bit are selected and compressed. 
>> 
>> Currently, this PR addresses only Java changes for compress bits operation. I've also updated the test framework.
>> Do review and share feedback.
>
> Smita Kamath has updated the pull request incrementally with one additional commit since the last revision:
> 
>   1) Removed compress bits implementation for byte and short
>   2) Added expand bits operation for int and long 3) Addressed review comments about code style 4) updated tests

src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template line 465:

> 463:      * Henry S. Warren, Jr's Hackers Delight, Addison Wesley, 2002.
> 464:      */
> 465:     static $type$ compressBits($type$ a, $type$ mask) {

No need to make these part of the template. Copy from https://github.com/openjdk/jdk/pull/8115 as Sandhya indicated and place them in a package private separate class, such as `CompressExpand`. Do the same for the tests and use directly. Then the code will be easier to replace.

test/jdk/jdk/incubator/vector/unit_tests.template line 1:

> 1: /*

This file should not be part of the commit, nor should `perf_scalar_tests.template` and `perf_tests.template`

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

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


More information about the panama-dev mailing list