On Sun, 17 Apr 2022 17:25:57 GMT, Quan Anh Mai <d...@openjdk.java.net> wrote:
> Hi, > > The `>>>` operator is not defined for subword types, what the code in line 28 > does vs what it is supposed to do are different, which is more likely the bug > here. An unsigned shift should operate on subword types the same as it does > on word and double-word types, which is to zero extend the value before > shifting it rightwards. > > Another argument would be that an unsigned shift operates on the unsigned > types, and the signed cast exposes this misunderstanding regarding the > operation. > > Thanks. Thanks @merykitty for your comments. What I show in this PR is the typical translation of a Java scalar program to Vector API code. Obviously, the implementation is wrong for negative bytes/shorts according to the description of the Vecotor API doc. As a general programming language, Java does support the usage of `>>>` for negative bytes/shorts. Will you use this Vector API to optimize a Java lib which doesn't know the actual input at all? For a given shift_cnt, why not produce the same result for Vector API just as what is done for scalar `>>>`? ------------- PR: https://git.openjdk.java.net/jdk/pull/8276