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

Jasmine Karthikeyan jkarthikeyan at openjdk.org
Tue Jan 27 03:12:38 UTC 2026


On Fri, 23 Jan 2026 09:20:10 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> test/hotspot/jtreg/compiler/vectorization/TestSubwordTruncation.java line 77:
>> 
>>> 75:     @Test
>>> 76:     @IR(counts = { IRNode.LOAD_VECTOR_S, IRNode.VECTOR_SIZE + "min(max_int, max_short)", "> 0" },
>>> 77:         applyIfCPUFeatureOr = { "avx2", "true", "asimd", "true" })
>> 
>> And how about here? Could we optimize and remove the casts?
>
> Filed:
> [JDK-8376179](https://bugs.openjdk.org/browse/JDK-8376179): C2 SuperWord: improve subword vectorization, avoid cast to-and-from int

We wouldn't be able to remove the casts in this case because `CountLeadingZeros` [doesn't support truncation](https://github.com/openjdk/jdk/blob/master/src/hotspot/share/opto/superword.cpp#L2506), so the cast to and from int is required for correctness.

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

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


More information about the hotspot-compiler-dev mailing list