RFR: 8351994: Enable Extended EVEX to REX2/REX demotion when src and dst are the same [v34]
Jatin Bhateja
jbhateja at openjdk.org
Thu May 22 19:34:58 UTC 2025
On Wed, 21 May 2025 23:35:39 GMT, Srinivas Vamsi Parasa <sparasa at openjdk.org> wrote:
>> Intel APX NDD instructions are encoded using EVEX encoding. The goal of this PR is to enable optimized instruction encoding for Intel APX NDD instructions when the non-destructive destination is same as the first source.
>>
>> For example:
>>
>> `eaddl r18, r18, r25` can be encoded as `addl r18, r25` using APX REX2 encoding
>> `eaddl r2, r2, r7` can be encoded as `addl r2, r7` using non-APX legacy encoding
>
> Srinivas Vamsi Parasa has updated the pull request incrementally with five additional commits since the last revision:
>
> - refactor to use is_P6_or_later()
> - rename byte1 to opcode_byte
> - rename evex_opcode_prefix_and_encode as emit_eevex_or_demote
> - rename evex to eevex in method names
> - reset swap=false as default
src/hotspot/cpu/x86/assembler_x86.cpp line 12862:
> 12860: emit_prefix_and_int8(get_prefixq(src2, dst, is_map1), opcode_byte);
> 12861: }
> 12862: else {
Suggestion:
} else {
src/hotspot/cpu/x86/assembler_x86.cpp line 12968:
> 12966: encode = is_prefixq ? prefixq_and_encode(dst_enc, src_enc, is_map1) : prefix_and_encode(dst_enc, src_enc, is_map1);
> 12967: }
> 12968: else {
Suggestion:
} else {
src/hotspot/cpu/x86/assembler_x86.cpp line 12978:
> 12976: encode = vex_prefix_and_encode(nds_enc, dst_enc, src_enc, pre, opc, &attributes, /* src_is_gpr */ true, /* nds_is_ndd */ true, no_flags);
> 12977: }
> 12978: else {
Suggestion:
} else {
src/hotspot/cpu/x86/vm_version_x86.hpp line 680:
> 678: static int cpu_family() { return _cpu;}
> 679: static bool is_P6() { return cpu_family() >= 6; }
> 680: static bool is_P6_or_later() { return cpu_family() == 6 || cpu_family() == 18 || cpu_family() == 19; }
Do we need cpu_family() == 18 check ?
19 is for Diamond Rapids and 6 for all Xerons before it, including E-core variants.
src/hotspot/cpu/x86/vm_version_x86.hpp line 680:
> 678: static int cpu_family() { return _cpu;}
> 679: static bool is_P6() { return cpu_family() >= 6; }
> 680: static bool is_P6_or_later() { return cpu_family() == 6 || cpu_family() == 18 || cpu_family() == 19; }
``` suggestion
static bool is_intel_server_family() { return cpu_family() == 6 || cpu_family() == 18 || cpu_family() == 19; }
We already have is_P6(), which returns true for CPU family >=6, a minor name change suggestion.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24431#discussion_r2103266719
PR Review Comment: https://git.openjdk.org/jdk/pull/24431#discussion_r2103267701
PR Review Comment: https://git.openjdk.org/jdk/pull/24431#discussion_r2103268316
PR Review Comment: https://git.openjdk.org/jdk/pull/24431#discussion_r2103252756
PR Review Comment: https://git.openjdk.org/jdk/pull/24431#discussion_r2103260881
More information about the hotspot-compiler-dev
mailing list