RFR: 8350177: C2 SuperWord: Integer.numberOfLeadingZeros, numberOfTrailingZeros, reverse and bitCount have input types wrongly turncated for byte and short [v2]
Emanuel Peter
epeter at openjdk.org
Wed Jun 4 05:46:23 UTC 2025
On Wed, 4 Jun 2025 05:37:09 GMT, Emanuel Peter <epeter 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 2519:
>
>> 2517:
>> 2518: // Default to disallowing vector truncation
>> 2519: return false;
>
> I was wondering:
> We could have an assert here that lists all operations that cannot be truncated?
> So if a new operation is added, then we will catch that it is not handled here yet, and we can add tests, and either allow it to truncate, or add it to the list of non-truncatable operations.
> Earlier in the function, this logic is guarded with vtn->basic_type() == T_INT so I think only integer nodes need to be added to the list. Let me know what you think!
That sounds reasonable. And that would mean we only have to add `int` operation to that assert. And if anybody ever relaxes that `vtn->basic_type() == T_INT` check, then they would immediately run into that assert. Would be nice.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25440#discussion_r2125696763
More information about the hotspot-compiler-dev
mailing list