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

Quan Anh Mai duke at openjdk.java.net
Mon Apr 18 04:28:41 UTC 2022


On Mon, 18 Apr 2022 04:14:39 GMT, Jie Fu <jiefu at openjdk.org> wrote:

> However, just image that someone would like to optimize some code segments of bytes/shorts `>>>`

Then that person can just use signed shift (`VectorOperators.ASHR`), right? Shifting on masked shift counts means that the shift count cannot be greater than 8 for bytes and 16 for shorts, which means that `(byte)(src[i] >>> 3)` is exactly the same as `(byte)(src[i] >> 3)`. Please correct me if I misunderstood something here.

Your proposed changes make unsigned shifts for subwords behave exactly the same as signed shifts, which is both redundant (we have 2 operations doing exactly the same thing) and inadequate (we lack the operation to do the proper unsigned shifts)

Thank you very much.

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

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


More information about the core-libs-dev mailing list