RFR: 8277155: Compress and expand vector operations
Paul Sandoz
psandoz at openjdk.java.net
Wed Nov 24 19:40:31 UTC 2021
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).
-------------
Commit messages:
- 8277155: Compress and expand vector operations
Changes: https://git.openjdk.java.net/jdk/pull/6545/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=6545&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8277155
Stats: 5429 lines in 105 files changed: 5315 ins; 21 del; 93 mod
Patch: https://git.openjdk.java.net/jdk/pull/6545.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/6545/head:pull/6545
PR: https://git.openjdk.java.net/jdk/pull/6545
More information about the core-libs-dev
mailing list