RFR: 8267969: Add vectorized implementation for VectorMask.eq()
Xiaohong Gong
xgong at openjdk.java.net
Mon May 31 10:32:35 UTC 2021
Currently `"VectorMask.eq()" `is not vectorized:
public VectorMask<E> eq(VectorMask<E> m) {
// FIXME: Generate good code here.
return bOp(m, (i, a, b) -> a == b);
}
This can be implemented by calling `"xor(m.not())"` directly.
The performance improved about 1.4x ~ 1.9x for the following benchmark with different basic types:
@Benchmark
public Object eq() {
boolean[] ma = fm.apply(size);
boolean[] mb = fmb.apply(size);
boolean[] mt = fmt.apply(size);
VectorMask<Byte> m = VectorMask.fromArray(SPECIES, mt, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < ma.length; i += SPECIES.length()) {
var av = SPECIES.loadMask(ma, i);
var bv = SPECIES.loadMask(mb, i);
// accumulate results, so JIT can't eliminate relevant computations
m = m.and(av.eq(bv));
}
}
return m;
}
-------------
Commit messages:
- 8267969: Add vectorized implementation for VectorMask.eq()
Changes: https://git.openjdk.java.net/jdk/pull/4272/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=4272&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8267969
Stats: 254 lines in 32 files changed: 248 ins; 6 del; 0 mod
Patch: https://git.openjdk.java.net/jdk/pull/4272.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/4272/head:pull/4272
PR: https://git.openjdk.java.net/jdk/pull/4272
More information about the hotspot-compiler-dev
mailing list