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

Tobias Hartmann thartmann at openjdk.java.net
Wed Nov 4 07:20:56 UTC 2020


On Tue, 3 Nov 2020 15:12:50 GMT, Jorn Vernee <jvernee 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

Marked as reviewed by thartmann (Reviewer).

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

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


More information about the hotspot-compiler-dev mailing list