RFR: 8264109: Add vectorized implementation for VectorMask.andNot()
Xiaohong Gong
xgong at openjdk.java.net
Fri Mar 26 01:57:33 UTC 2021
Currently "VectorMask.andNot()" is not vectorized:
public VectorMask<E> andNot(VectorMask<E> m) {
// FIXME: Generate good code here.
return bOp(m, (i, a, b) -> a && !b);
}
This can be implemented with` "and(m.not())" `directly. Since `"VectorMask.and()/not()" `have been vectorized in hotspot, `"andNot"`
can be vectorized as well by calling them.
The performance gain is >100% for such a simple JMH:
@Benchmark
public Object andNot(Blackhole bh) {
boolean[] mask = fm.apply(SPECIES.length());
boolean[] r = fmt.apply(SPECIES.length());
VectorMask<Byte> rm = VectorMask.fromArray(SPECIES, r, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < mask.length; i += SPECIES.length()) {
VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, i);
rm = rm.andNot(vmask);
}
}
return rm;
}
-------------
Commit messages:
- 8264109: Add vectorized implementation for VectorMask.andNot()
Changes: https://git.openjdk.java.net/jdk/pull/3211/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3211&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8264109
Stats: 11 lines in 2 files changed: 2 ins; 6 del; 3 mod
Patch: https://git.openjdk.java.net/jdk/pull/3211.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/3211/head:pull/3211
PR: https://git.openjdk.java.net/jdk/pull/3211
More information about the hotspot-compiler-dev
mailing list