On Tue, 19 Apr 2022 17:40:07 GMT, Paul Sandoz <psan...@openjdk.org> wrote:

> Not yet talked with John, but i investigated further. The implementation of 
> the `LSHR` operation is behaving as intended, but is under specified with 
> regards to `byte` and `short` as you noted in #8291.
> 
> This is a subtle area, but i am wondering if the user really means to use 
> arithmetic shift in this case? Since is not the following true for all values 
> of `e` and `c`, where `e` is a `byte` and `c` is the right shift count 
> ranging from 0 to 7:
> 
> ```
> (byte) (e >>> c) == (byte) (e >> c)
> ```
> 
> ?
> 
> Then the user can use `VectorOperators.ASHR`.

Yes, in theory, the user can use `ASHR`.

But people have to be very careful about when to use `AHSR` and when to use 
`LSHR`, which is really inconvenient and easy to make a mistake.
And not all the people are smart enough to know this skill for bytes/shorts.

So to make it to be programmed more easily and also reduce the possibility to 
make mistakes, a new operator for scalar `>>>` would be helpful when 
vectorizing with Vector API.
Thanks.

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

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

Reply via email to