RFR: 8350177: C2 SuperWord: Integer.numberOfLeadingZeros, numberOfTrailingZeros, reverse and bitCount have input types wrongly turncated for byte and short [v2]

Jasmine Karthikeyan jkarthikeyan at openjdk.org
Wed Jun 4 04:28:39 UTC 2025


On Mon, 26 May 2025 07:56:17 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> Jasmine Karthikeyan has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Reformat, add comments and char tests
>
> src/hotspot/share/opto/superword.cpp line 2496:
> 
>> 2494:   int opc = in->Opcode();
>> 2495:   return opc == Op_AddI || opc == Op_SubI || opc == Op_MulI || opc == Op_AndI || opc == Op_OrI || opc == Op_XorI
>> 2496:     || opc == Op_ReverseBytesS || opc == Op_ReverseBytesUS;
> 
> Are you sure? I don't think you can truncate a `ReverseByteS` to a `byte`.

This is a good observation, thank you! I've fixed it so that it checks for short/char in this case.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25440#discussion_r2125605047


More information about the hotspot-compiler-dev mailing list