RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v6]

Quan Anh Mai qamai at openjdk.org
Fri Apr 7 17:14:14 UTC 2023


On Fri, 7 Apr 2023 13:36:22 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

>> src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractVector.java line 226:
>> 
>>> 224: 
>>> 225:         AbstractSpecies<?> species = vspecies().asIntegral();
>>> 226:         Vector iota = species.iota();
>> 
>> we can do an early exist by returning species..iota() if start = 0 and step = 1
>
> Power of two step count may be replaced by logical right shifts. But special handling may impact generic path
> , currently c2 inline expander handles these special cases.
> 
> Alternatively we can keep this implementation at its and enhance vector idealizations to handle identity scenarios, multiply by 1, addition by 0, shift replacement for power of two multiply, since their scalar counterparts do handle these cases and SLP generated code gets a benefit of that.

Thanks a lot for your review, I think that transforming a multiplication by a power of 2 into a shift can be done by the C2 compiler. I have added the special case for `start = 0 && step == 1` since it may be more common and can be optimised away when the arguments are constants.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13093#discussion_r1160841447


More information about the hotspot-compiler-dev mailing list