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

Srinivas Vamsi Parasa sparasa at openjdk.org
Thu Apr 10 23:03:26 UTC 2025


On Wed, 9 Apr 2025 23:19:51 GMT, Sandhya Viswanathan <sviswanathan at openjdk.org> wrote:

>> Srinivas Vamsi Parasa has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Disable demotion for esetzucc and cleanup code
>
> src/hotspot/cpu/x86/assembler_x86.cpp line 13770:
> 
>> 13768:                            InstructionAttr *attributes, bool no_flags, bool use_prefixq) {
>> 13769:   // Demote RegRegReg instructions
>> 13770:   if (!no_flags && dst_enc == nds_enc) {
> 
> This could be replaced by call to is_demotable().

Please see the updated code refactored to use is_demotable().

> src/hotspot/cpu/x86/assembler_x86.cpp line 13771:
> 
>> 13769:   // Demote RegRegReg instructions
>> 13770:   if (!no_flags && dst_enc == nds_enc) {
>> 13771:     return use_prefixq? prefixq_and_encode(dst_enc, src_enc) : prefix_and_encode(dst_enc, src_enc);
> 
> Nit pick, need space before ? as below:
> use_prefixq ? prefixq_and_encode

Please see the space fixed in the updated code.

> src/hotspot/cpu/x86/assembler_x86.cpp line 13818:
> 
>> 13816: }
>> 13817: 
>> 13818: bool Assembler::is_demotable(bool no_flags, int dst_enc, int nds_enc, int src_enc) {
> 
> src_enc is not being used in this method so could be removed.

Please see the src_enc removed in the updated code.

> src/hotspot/cpu/x86/assembler_x86.cpp line 17185:
> 
>> 17183:   InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
>> 17184:   // Encoding Format : eevex_prefix (4 bytes) | opcode_cc | modrm
>> 17185:   int encode =  evex_prefix_and_encode_ndd(0, 0, dst->encoding(), VEX_SIMD_F2, /* MAP4 */VEX_OPCODE_0F_3C, &attributes); //TODO: check this
> 
> This should not be demoted.

Please see the demotion disabled for esetzucc instruction in the updated code.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24431#discussion_r2038525310
PR Review Comment: https://git.openjdk.org/jdk/pull/24431#discussion_r2038525039
PR Review Comment: https://git.openjdk.org/jdk/pull/24431#discussion_r2038524403
PR Review Comment: https://git.openjdk.org/jdk/pull/24431#discussion_r2038524767


More information about the hotspot-compiler-dev mailing list