RFR: 8255838: Use 32-bit immediate movslq in macro assembler if 64-bit value fits in 32 bits on x86_64

Jorn Vernee jvernee at openjdk.java.net
Tue Nov 3 17:40:54 UTC 2020


On Tue, 3 Nov 2020 17:14:38 GMT, Azeem Jiva <azeemj at openjdk.org> wrote:

>> Currently, Macro::Assembler(Address dst, intprt_t src) on x64 uses an intermediate scratch register to store the 64-bit immediate.
>> 
>> void MacroAssembler::movptr(Address dst, intptr_t src) {
>>   mov64(rscratch1, src);
>>   movq(dst, rscratch1);
>> }
>> 
>> But, if the value fits into 32-bits, we can also explicitly use the 32-bit immediate overload, which saves an instruction and a register use, by using movslq/movabs instead (sig extended move).
>> 
>> This ends up saving about 90k instructions on hello world. It also reduces the size of the interpreter by about 4k.
>> 
>> Special thanks to Claes for prior discussion and help with testing.
>> 
>> Testing: tier1-3, local startup profiling
>
> This looks good to me, but this is probably compiler.

@AzeemJiva Thanks for the review. Ok, will CC compiler as well

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

PR: https://git.openjdk.java.net/jdk/pull/1038


More information about the hotspot-runtime-dev mailing list