RFR: 8351994: Enable Extended EVEX to REX2/REX demotion when src and dst are the same [v27]

Srinivas Vamsi Parasa sparasa at openjdk.org
Tue May 20 16:28:01 UTC 2025


On Fri, 16 May 2025 18:18:01 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

>> Srinivas Vamsi Parasa has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update x86-asmtest.py to enable demotion by default and make test generation optional
>
> src/hotspot/cpu/x86/assembler_x86.cpp line 12948:
> 
>> 12946:     int encode = is_prefixq ? prefixq_and_encode(src_enc, dst_enc, is_map1) : prefix_and_encode(src_enc, dst_enc, is_map1);
>> 12947:     emit_opcode_prefix_and_encoding((unsigned char)byte1, 0xC0, encode, imm8);
>> 12948:   } else {
> 
> FTR, existing demotion w.r.t to first operand is safe for all kinds to instructions, for commutative instructions, add, mul, xor, and, or, max , min etc, we can check against the second operand by passing is_commutative flags from top level assembler instruction. I am ok to handle this as part of https://bugs.openjdk.org/browse/JDK-8354348

As suggested, the demotion for commutative operations will be addressed in JDK-8354348.

> src/hotspot/cpu/x86/assembler_x86.cpp line 12958:
> 
>> 12956: void Assembler::evex_opcode_prefix_and_encode(int dst_enc, int nds_enc, int src_enc, VexSimdPrefix pre, VexOpcode opc,
>> 12957:                                               int size, int byte1, bool no_flags, bool is_map1) {
>> 12958:   bool is_prefixq = (size == EVEX_64bit);
> 
> Nit pick, on line https://github.com/openjdk/jdk/pull/24431/files#diff-e3576e9c22db89236cdb906f032ff00748ff6d1c21b05277d991d80af75daf3aR12944 
> you are using a conditional operator to select b/w true and false., Lets follow one convention.

Please see this fixed in the updated code.

> src/hotspot/cpu/x86/assembler_x86.cpp line 12962:
> 
>> 12960:     if (size == EVEX_16bit) {
>> 12961:       emit_int8(0x66);
>> 12962:     }
> 
> I cannot find a caller that passes EVEX_16bit for the size argument.

Please see the code block removed in the updated code.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/24431#discussion_r2098396495
PR Review Comment: https://git.openjdk.org/jdk/pull/24431#discussion_r2098392314
PR Review Comment: https://git.openjdk.org/jdk/pull/24431#discussion_r2098393013


More information about the hotspot-compiler-dev mailing list