Hi All,
On x86 targets with AVX-512 feature, C2 lowers **VectorMask.eq(m)** to a
sequence of KNOT followed by KXOR, even though the architecture provides a
single KXNOR instruction that computes ~(src1 ^ src2).
This patch optimizes the instruction sequence for following patterns to
directly emit KXNOR instruction
XorVMask(m1, XorVMask(m2, MaskAll(-1)))
Following are the performance numbers of an existing benchmark
(test/micro/org/openjdk/bench/jdk/incubator/vector/MaskLogicOperationsBenchmark.java)
with and without optimization.
System: AMD EPYC 9755 128-Core Processor (Turin) - fixed frequency 2.5GHz
Baseline:-
Benchmark (size) Mode
Cnt Score Error Units
MaskLogicOperationsBenchmark.byteMaskEq 256 thrpt
2 159974.636 ops/ms
MaskLogicOperationsBenchmark.intMaskEq 256 thrpt
2 53170.370 ops/ms
MaskLogicOperationsBenchmark.longMaskEq 256 thrpt
2 32048.635 ops/ms
MaskLogicOperationsBenchmark.shortMaskEq 256 thrpt
2 106759.600 ops/ms
Withopt:-
Benchmark (size) Mode
Cnt Score Error Units
MaskLogicOperationsBenchmark.byteMaskEq 256 thrpt
2 182394.071 ops/ms
MaskLogicOperationsBenchmark.intMaskEq 256 thrpt
2 89680.615 ops/ms
MaskLogicOperationsBenchmark.longMaskEq 256 thrpt
2 47342.562 ops/ms
MaskLogicOperationsBenchmark.shortMaskEq 256 thrpt
2 126642.157 ops/ms
Kindly review and share your feedback.
Best Regards,
Jatin
---------
- [x] I confirm that I make this contribution in accordance with the [OpenJDK
Interim AI Policy](https://openjdk.org/legal/ai).
-------------
Commit messages:
- Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8390751
- 8390751: [VectorAPI] Optimize VectorMask.eq operation for AVX512 targets
Changes: https://git.openjdk.org/jdk/pull/32622/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=32622&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8390751
Stats: 349 lines in 7 files changed: 349 ins; 0 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/32622.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/32622/head:pull/32622
PR: https://git.openjdk.org/jdk/pull/32622