reg_alloc: Handle XMM registers in LoadImmediate
This commit is contained in:
parent
993e142c6b
commit
1613846ab0
1 changed files with 20 additions and 7 deletions
|
@ -398,14 +398,27 @@ void RegAlloc::DefineValueImpl(IR::Inst* def_inst, const IR::Value& use_inst) {
|
||||||
HostLoc RegAlloc::LoadImmediate(IR::Value imm, HostLoc host_loc) {
|
HostLoc RegAlloc::LoadImmediate(IR::Value imm, HostLoc host_loc) {
|
||||||
ASSERT_MSG(imm.IsImmediate(), "imm is not an immediate");
|
ASSERT_MSG(imm.IsImmediate(), "imm is not an immediate");
|
||||||
|
|
||||||
|
if (HostLocIsGPR(host_loc)) {
|
||||||
Xbyak::Reg64 reg = HostLocToReg64(host_loc);
|
Xbyak::Reg64 reg = HostLocToReg64(host_loc);
|
||||||
|
|
||||||
u64 imm_value = ImmediateToU64(imm);
|
u64 imm_value = ImmediateToU64(imm);
|
||||||
if (imm_value == 0)
|
if (imm_value == 0)
|
||||||
code->xor_(reg.cvt32(), reg.cvt32());
|
code->xor_(reg.cvt32(), reg.cvt32());
|
||||||
else
|
else
|
||||||
code->mov(reg, imm_value);
|
code->mov(reg, imm_value);
|
||||||
return host_loc;
|
return host_loc;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (HostLocIsXMM(host_loc)) {
|
||||||
|
Xbyak::Xmm reg = HostLocToXmm(host_loc);
|
||||||
|
u64 imm_value = ImmediateToU64(imm);
|
||||||
|
if (imm_value == 0)
|
||||||
|
code->pxor(reg, reg);
|
||||||
|
else
|
||||||
|
code->movdqa(reg, code->MConst(imm_value)); // TODO: movaps/movapd more appropriate sometimes
|
||||||
|
return host_loc;
|
||||||
|
}
|
||||||
|
|
||||||
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegAlloc::Move(HostLoc to, HostLoc from) {
|
void RegAlloc::Move(HostLoc to, HostLoc from) {
|
||||||
|
|
Loading…
Reference in a new issue