RFR: 8353600: RISC-V: compiler/vectorization/TestRotateByteAndShortVector.java is failing with Zvbb

Hamlin Li mli at openjdk.org
Thu Apr 3 12:50:13 UTC 2025


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.

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.

Thanks!

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

Commit messages:
 - merge master
 - initial commit

Changes: https://git.openjdk.org/jdk/pull/24414/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24414&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8353600
  Stats: 25 lines in 1 file changed: 4 ins; 21 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/24414.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24414/head:pull/24414

PR: https://git.openjdk.org/jdk/pull/24414


More information about the hotspot-compiler-dev mailing list