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:14:00 UTC 2020
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
-------------
Commit messages:
- Explicitly convert intptr_t to int32_t to use movslq on 64 bit platforms if possible
Changes: https://git.openjdk.java.net/jdk/pull/1038/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1038&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8255838
Stats: 6 lines in 1 file changed: 4 ins; 0 del; 2 mod
Patch: https://git.openjdk.java.net/jdk/pull/1038.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/1038/head:pull/1038
PR: https://git.openjdk.java.net/jdk/pull/1038
More information about the hotspot-runtime-dev
mailing list