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

Eric Liu eliu at openjdk.java.net
Tue Mar 29 04:46:04 UTC 2022


On Mon, 28 Mar 2022 23:36:47 GMT, Smita Kamath <svkamath at openjdk.org> wrote:

>> Just talked with @sviswa7. I will update the JEP. Also, i will follow up on scalar integral implementations for compress/expand bits, where the `Byte`/`Short` implementations defer to that on `Integer`. Intrinsic scalar implementations can be implemented afterwards.
>
> Hi @PaulSandoz, do you think this implementation of compress bits is fine? I can plan to create a separate PR for expand bits operation. Do let me know. Thanks.

> I think i mistook the intended implementation when writing the JEP.
> 
> Since there is no scalar equivalent the operation is currently under specified, and in this case I think the expand operation also makes sense so `compress(expand(x, m), m) = x`

If the true count of `m` is less than the significant bits of `x` , I think `x` will lost bits so that this equation doesn't work. E.g., m = 0b00000001, x = 0b11111111. It's 0b00000001 after expand(x, m) , and if compressed it back with the same bitmask `m`, it will get 0b00000001.

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

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


More information about the panama-dev mailing list