RFR: 8284932: [Vector API] Incorrect implementation of LSHR operator for negative byte/short elements
Jie Fu
jiefu at openjdk.java.net
Wed Apr 20 03:33:24 UTC 2022
On Wed, 20 Apr 2022 00:25:26 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:
> I am yet to be convinced we a 3rd vector right shift operator. We are talking about narrow cases of correct use which i believe can be supported with the existing operators. The user needs to think very careful when deviating from common right shift patterns on sub-words, which when deviated from can often imply misunderstanding and incorrect use, or an obtuse use. I would prefer to stick the existing operators and clarify their use.
As we can see, `VectorOperators` has directly supported all the unary/binary scalar operators in the Java language except for `>>>`.
So it seems strange not to support `>>>` directly.
Since you are a Vector API expert, you know the semantics of `LSHR` precisely.
But for many Java developers, things are different.
I'm afraid most of them don't know Vector API actually has extended semantics of `>>>` upon bytes/shorts with `LSHR`.
To be honest, I didn't know it before my customer's bug even though I had spent enough time reading the Vector API doc.
This is because for ordinary developers, they are only familiar with the common scalar `>>>`.
So it seems easy to write bugs with the only `LSHR`, which is different with `>>>`.
>From the developer's point of view, I strongly suggest providing the `>>>` operator in Vector API.
Not only because `>>>` is one of the basic operators in Java language, but also we can make it to be more friendly to so many ordinary developers.
Thanks.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8276
More information about the core-libs-dev
mailing list