Integrated: 8353600: RISC-V: compiler/vectorization/TestRotateByteAndShortVector.java is failing with Zvbb
Hamlin Li
mli at openjdk.org
Tue Apr 8 13:03:19 UTC 2025
On Thu, 3 Apr 2025 12:27:33 GMT, Hamlin Li <mli at openjdk.org> wrote:
> Hi,
> Can you help to review this patch?
>
> Currently, the followign code is considered an RotateLeftV of byte by hotspot, but it's not a real rotate, as the `-shift` will 30, which makes `b >> -shift` zero, rather the value we expected.
>
> int shift = 2;
> byte b = 83;
> byte res = (byte) (b << shift | b >> -shift); // res = 76
> // but a real left rotate of 83 should be 77 ??
> ```
>
> So, the simple fix is to enable RotateLeftV only for int and long, disable it for other types.
>
> <del>A more rational fix should be change C2 to not convert code like ` (byte) (b << shift | b >> -shift)` to a RotateLeftV node, but it needs more investigation, and I'm not sure if it's feasible to do so, as currently no platform support RotateLeftV for non-int/long types.</del>
>
> The vector instruction behaviour is different from java language spec, so seems there is no way to do it for now.
>
> Thanks!
This pull request has now been integrated.
Changeset: cc5e9388
Author: Hamlin Li <mli at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/cc5e9388d8c55178fd32eabce0f24d5ab8e76fdd
Stats: 71 lines in 2 files changed: 25 ins; 41 del; 5 mod
8353600: RISC-V: compiler/vectorization/TestRotateByteAndShortVector.java is failing with Zvbb
Reviewed-by: fyang, luhenry
-------------
PR: https://git.openjdk.org/jdk/pull/24414
More information about the hotspot-compiler-dev
mailing list