On Wed, 24 Nov 2021 19:20:08 GMT, Paul Sandoz <[email protected]> wrote:
> Add two new cross-lane vector operations, `compress` and `expand`.
>
> An example of such usage might be code that selects elements from array `a`
> and stores those selected elements in array `z`:
>
>
> int[] a = ...;
>
> int[] z = ...;
> int ai = 0, zi = 0;
> while (ai < a.length) {
> IntVector av = IntVector.fromArray(SPECIES, a, ai);
> // query over elements of vector av
> // returning a mask marking elements of interest
> VectorMask<Integer> m = interestingBits(av, ...);
> IntVector zv = av.compress(m);
> zv.intoArray(z, zi, m.compress());
> ai += SPECIES.length();
> zi += m.trueCount();
> }
>
>
> (There's also a more sophisticated version using `unslice` to coalesce
> matching elements with non-masked stores.)
>
> Given RDP 1 for 18 is getting close, 2021/12/09, we may not get this reviewed
> in time and included in [JEP 417](https://openjdk.java.net/jeps/417). Still I
> think I think it worth starting the review now (the CSR is marked
> provisional).
keep-alive
-------------
PR: https://git.openjdk.java.net/jdk/pull/6545