RFR: 8353600: RISC-V: compiler/vectorization/TestRotateByteAndShortVector.java is failing with Zvbb [v3]
Fei Yang
fyang at openjdk.org
Mon Apr 7 02:36:48 UTC 2025
On Thu, 3 Apr 2025 13:49:05 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!
>
> Hamlin Li has updated the pull request incrementally with one additional commit since the last revision:
>
> comment
LGTM. Thanks for fixing this!
-------------
Marked as reviewed by fyang (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/24414#pullrequestreview-2745410453
More information about the hotspot-compiler-dev
mailing list