8319406: x86: Shorter movptr(reg, imm) for 32-bit immediates

Reviewed-by: qamai, kvn
This commit is contained in:
Aleksey Shipilev 2023-11-14 08:59:15 +00:00
parent 7df73a23d3
commit b120a05b22
3 changed files with 14 additions and 13 deletions

View File

@ -13450,17 +13450,6 @@ void Assembler::movsbq(Register dst, Register src) {
emit_int24(0x0F, (unsigned char)0xBE, (0xC0 | encode));
}
void Assembler::movslq(Register dst, int32_t imm32) {
// dbx shows movslq(rcx, 3) as movq $0x0000000049000000,(%rbx)
// and movslq(r8, 3); as movl $0x0000000048000000,(%rbx)
// as a result we shouldn't use until tested at runtime...
ShouldNotReachHere();
InstructionMark im(this);
int encode = prefixq_and_encode(dst->encoding());
emit_int8(0xC7 | encode);
emit_int32(imm32);
}
void Assembler::movslq(Address dst, int32_t imm32) {
assert(is_simm32(imm32), "lost bits");
InstructionMark im(this);

View File

@ -1656,7 +1656,6 @@ private:
// Move signed 32bit immediate to 64bit extending sign
void movslq(Address dst, int32_t imm64);
void movslq(Register dst, int32_t imm64);
void movslq(Register dst, Address src);
void movslq(Register dst, Register src);

View File

@ -1339,7 +1339,12 @@ void MacroAssembler::call(AddressLiteral entry, Register rscratch) {
void MacroAssembler::ic_call(address entry, jint method_index) {
RelocationHolder rh = virtual_call_Relocation::spec(pc(), method_index);
#ifdef _LP64
// Needs full 64-bit immediate for later patching.
mov64(rax, (intptr_t)Universe::non_oop_word());
#else
movptr(rax, (intptr_t)Universe::non_oop_word());
#endif
call(AddressLiteral(entry, rh));
}
@ -2562,7 +2567,15 @@ void MacroAssembler::movptr(Register dst, Address src) {
// src should NEVER be a real pointer. Use AddressLiteral for true pointers
void MacroAssembler::movptr(Register dst, intptr_t src) {
LP64_ONLY(mov64(dst, src)) NOT_LP64(movl(dst, src));
#ifdef _LP64
if (is_simm32(src)) {
movq(dst, checked_cast<int32_t>(src));
} else {
mov64(dst, src);
}
#else
movl(dst, src);
#endif
}
void MacroAssembler::movptr(Address dst, Register src) {