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

Hamlin Li mli at openjdk.org
Thu Apr 3 13:41:20 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!

Hamlin Li has updated the pull request incrementally with one additional commit since the last revision:

  fix tests

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/24414/files
  - new: https://git.openjdk.org/jdk/pull/24414/files/ca44d6b8..fa5e7375

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=24414&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=24414&range=00-01

  Stats: 41 lines in 1 file changed: 17 ins; 20 del; 4 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