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

Reviewed-by: stuefe, kvn, eastigeevich
This commit is contained in:
Aleksey Shipilev 2024-01-29 20:25:32 +00:00
parent 84deeb6cd5
commit e999dfcb40
2 changed files with 4 additions and 1 deletions

View File

@ -2568,7 +2568,9 @@ 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) {
#ifdef _LP64
if (is_simm32(src)) {
if (is_uimm32(src)) {
movl(dst, checked_cast<uint32_t>(src));
} else if (is_simm32(src)) {
movq(dst, checked_cast<int32_t>(src));
} else {
mov64(dst, src);

View File

@ -359,6 +359,7 @@ class AbstractAssembler : public ResourceObj {
}
static bool is_uimm12(uint64_t x) { return is_uimm(x, 12); }
static bool is_uimm32(uint64_t x) { return is_uimm(x, 32); }
// Accessors
CodeSection* code_section() const { return _code_section; }