RFR: 8284932: [Vector API] Incorrect implementation of LSHR operator for negative byte/short elements

Jie Fu jiefu at openjdk.java.net
Mon Apr 18 02:50:37 UTC 2022


On Mon, 18 Apr 2022 02:32:39 GMT, Quan Anh Mai <duke at openjdk.java.net> wrote:

> What I try to convey here is that `src[i] >>> 3` is not a byte unsigned shift, it is an int unsigned shift following a byte-to-int promotion. This is different from the Vector API that has definition for the shift operations of subword types.

The vector api docs says it would compute `a>>>(n&(ESIZE*8-1))`.
<img width="647" alt="image" src="https://user-images.githubusercontent.com/19923746/163746064-b1c1ae37-245e-4a92-9020-99b13195193d.png">

> Also you can see the reasons in these lines of comments:
> 
> https://github.com/openjdk/jdk/blob/e5041ae3d45b43be10d5da747d773882ebf0482b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java#L944
> 
> Thanks.

The patch wouldn't change the masked shift count of vector api.
Thanks.

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

PR: https://git.openjdk.java.net/jdk/pull/8276


More information about the core-libs-dev mailing list