RFR: 8342095: Add autovectorizer support for subword vector casts [v14]
Jasmine Karthikeyan
jkarthikeyan at openjdk.org
Fri Jan 23 06:28:19 UTC 2026
On Wed, 27 Aug 2025 10:16:23 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
>> Jasmine Karthikeyan has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 16 commits:
>>
>> - Update tests, cleanup logic
>> - Merge branch 'master' into vectorize-subword
>> - Check for AVX2 for byte/long conversions
>> - Whitespace and benchmark tweak
>> - Address more comments, make test and benchmark more exhaustive
>> - Merge from master
>> - Fix copyright after merge
>> - Fix copyright
>> - Merge
>> - Implement patch with VectorCastNode::implemented
>> - ... and 6 more: https://git.openjdk.org/jdk/compare/8fcbb110...aabaafba
>
> src/hotspot/share/opto/superword.cpp line 2422:
>
>> 2420: // Opcode is only required to disambiguate half float, so we pass -1 as it can't be encountered here.
>> 2421: return (is_subword_type(def_bt) || is_subword_type(use_bt)) && VectorCastNode::implemented(-1, pack_size, def_bt, use_bt);
>> 2422: }
>
> Not sure if we discussed this before: should we not move this to `VectorCastNode`, rather than having it in `SuperWord`?
I've moved the function to `VectorCastNode`, I think it's a better fit there because the other cast functions are located there as well.
> src/hotspot/share/opto/superwordVTransformBuilder.cpp line 197:
>
>> 195:
>> 196: // If the use and def types are different, emit a cast node
>> 197: if (use_bt != def_bt && !p0->is_Convert() && SuperWord::is_supported_subword_cast(def_bt, use_bt, pack->size())) {
>
> Is `SuperWord::is_supported_subword_cast(def_bt, use_bt, pack->size())` really a true condition that you need to check here (and if false we can continue in the "else"), or should it be rather an assert?
I believe this condition is indeed needed, since for example `& 1` produces a TypeInt with a basic type of boolean, which would be otherwise harmless with the current logic but would trip the assert.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23413#discussion_r2719777514
PR Review Comment: https://git.openjdk.org/jdk/pull/23413#discussion_r2719780695
More information about the hotspot-compiler-dev
mailing list