RFR: 8342095: Add autovectorizer support for subword vector casts [v16]

Quan Anh Mai qamai at openjdk.org
Wed Jan 28 04:54:14 UTC 2026


On Wed, 28 Jan 2026 04:28:52 GMT, Jasmine Karthikeyan <jkarthikeyan at openjdk.org> wrote:

>> src/hotspot/share/opto/vectornode.cpp line 1540:
>> 
>>> 1538: 
>>> 1539:   // Opcode is only required to disambiguate half float, so we pass -1 as it can't be encountered here.
>>> 1540:   return (is_subword_type(def_bt) || is_subword_type(use_bt)) && VectorCastNode::implemented(-1, pack_size, def_bt, use_bt);
>> 
>> Why do we specifically require it to be a subword. If you mean this is only called with one of the two being a subword then can we use an assert instead?
>
> @merykitty Since this function is called from places that may not always have a subword type, changing it to an assert causes spurious assertion failures.
> 
> @iwanowww Scalar int<->long conversions are modeled with `ConvI2L` and `ConvL2I`, the existing superword mechanism is able to vectorize the conversion without needing to dynamically add new nodes.

Can you give me an example where this is the case? And in that case, can we remove the `is_subword_type` condition and check the availability of a cast regardless?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23413#discussion_r2734846588


More information about the hotspot-compiler-dev mailing list