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,8 +398,8 @@ void RegAlloc::DefineValueImpl(IR::Inst* def_inst, const IR::Value& use_inst) {
|
|||
HostLoc RegAlloc::LoadImmediate(IR::Value imm, HostLoc host_loc) {
|
||||
ASSERT_MSG(imm.IsImmediate(), "imm is not an immediate");
|
||||
|
||||
if (HostLocIsGPR(host_loc)) {
|
||||
Xbyak::Reg64 reg = HostLocToReg64(host_loc);
|
||||
|
||||
u64 imm_value = ImmediateToU64(imm);
|
||||
if (imm_value == 0)
|
||||
code->xor_(reg.cvt32(), reg.cvt32());
|
||||
|
@ -408,6 +408,19 @@ HostLoc RegAlloc::LoadImmediate(IR::Value imm, HostLoc 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) {
|
||||
ASSERT(LocInfo(to).IsEmpty() && !LocInfo(from).IsLocked());
|
||||
|
||||
|
|
Loading…
Reference in a new issue