On Fri, 7 Apr 2023 13:36:22 GMT, Jatin Bhateja <jbhat...@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