[vector] rearrange with implicit wrapping

Paul Sandoz paul.sandoz at oracle.com
Mon Apr 19 23:55:57 UTC 2021


Hi,

I have started work on support rearrange with implicit wrapping, where the rearrange methods accepting a boolean parameter, which if true implicitly wraps the given shuffle:

  https://github.com/openjdk/panama-vector/compare/vectorIntrinsics...PaulSandoz:rearrange-wrap

This currently results in some test failures on x64 when it hits the intrinsics. I think there is some zeroing going in some cases.

Sandhya, I am unsure how the intrinsics behave, if they are all consistent, how they interrelate with shuffle, and how the Java implementation deviates.

The Java implementation was updated to consistently wrap: 

@ForceInline
final
<S extends VectorShuffle<Integer>>
IntVector rearrangeTemplate(Class<S> shuffletype, S shuffle, boolean wrap) {
    if (!wrap) {
        shuffle.checkIndexes();
    }
    return VectorSupport.rearrangeOp(
        getClass(), shuffletype, int.class, length(),
        this, shuffle,
        (v1, s_) -> v1.uOp((i, a) -> {
            int ei = s_.laneSource(i);
            return v1.lane(s_.wrapIndex(ei));
        }));
}

AFAICT rearrange is depending on the checks performed on the shuffle, otherwise the rearrange intrinsic fails to unbox it.

Paul.


More information about the panama-dev mailing list