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

Jatin Bhateja jbhateja at openjdk.java.net
Tue Apr 26 17:35:56 UTC 2022


On Sun, 17 Apr 2022 14:35:14 GMT, Jie Fu <jiefu at openjdk.org> wrote:

>> According to the Vector API doc, the LSHR operator computes a>>>(n&(ESIZE*8-1))

Documentation is correct if viewed strictly in context of subword vector lane, JVM internally promotes/sign extends subword type scalar variables into int type, but vectors are loaded from continuous memory holding subwords, it will not be correct for developer to imagine that individual subword type lanes will be upcasted into int lanes before being operated upon.

Thus both java implementation and compiler handling looks correct.

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

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


More information about the core-libs-dev mailing list