Hi All,

Currently, 
[ReplHF_reg](https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/x86.ad#L18646)
 selection pattern
which accepts regF src operand, first copies it to a GPR using _evmovw_ 
instruction (which has 3 cycles latency on x86 targets supporting AVX512-FP16 
feature) and then broadcast it using _vpbroadcastw_ instruction.

On targets supporting AVX512BW feature this sequence can be replaced by a 
single _vpbroadcastw_ instruction which can directly broadcast XMM source thus 
saving costly XMM to GPR move.

This shows 2-3% performance improvement on AVX512-FP16 systems for benchmark 
included with the patch.


Baseline:-
Benchmark                           Mode  Cnt   Score   Error   Units
ReplHFRegBenchmark.manyBroadcasts  thrpt    5  16.587 ± 0.041  ops/ms
Withchange:-
Benchmark                           Mode  Cnt   Score   Error   Units
ReplHFRegBenchmark.manyBroadcasts  thrpt    5  16.978 ± 0.033  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:
 - 8392548: Optimize instruction sequence for x86 ReplHF_reg instruction 
selection pattern

Changes: https://git.openjdk.org/jdk/pull/32938/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=32938&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8392548
  Stats: 97 lines in 3 files changed: 90 ins; 2 del; 5 mod
  Patch: https://git.openjdk.org/jdk/pull/32938.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/32938/head:pull/32938

PR: https://git.openjdk.org/jdk/pull/32938

Reply via email to