[vectorIntrinsics+compress] RFR: 8274664: Add support for compress/expand api methods
Paul Sandoz
psandoz at openjdk.java.net
Mon Oct 4 22:37:18 UTC 2021
On Fri, 1 Oct 2021 22:33:43 GMT, Sandhya Viswanathan <sviswanathan at openjdk.org> wrote:
> Add support for the cross lane operations to compress/expand the lane elements of a vector selecting lanes under the control of a mask. The remaining lanes of the destination vector could be either set to zero or get the value from corresponding elements of the background vector.
> The following methods are added:
> public abstract Vector<E> compress(VectorMask<E> m);
> public abstract Vector<E> compress(VectorMask<E> m, Vector<E> v);
> public abstract Vector<E> expand(VectorMask<E> m);
> public abstract Vector<E> expand(VectorMask<E> m, Vector<E> v);
This is an great start. I think it best to get the code in and iterate.
It should be possible to reduce some code by composition e..g. compress(m) === compress(m. zeroVector), at least from a test assertion perspective. Unsure from an intrinsic perspective.
Also i wonder for `compress(m, v)` whether values from `v` should drawn starting from zero rather than popcount of `m`, thus allowing easier partitioning:
pFalse = v.compress(m.not());
p = v.compress(m, pFalse);
Again, i am unsure from an intrinsic perspective.
-------------
Marked as reviewed by psandoz (Committer).
PR: https://git.openjdk.java.net/panama-vector/pull/143
More information about the panama-dev
mailing list