emit_x64: Use xorps/xorpd when argument to TransferToFP32/TransferToFP64 is an immediate zero
This commit is contained in:
parent
e166965f3e
commit
cede5e442a
1 changed files with 18 additions and 8 deletions
|
@ -1677,17 +1677,27 @@ void EmitX64::EmitTransferFromFP64(IR::Block& block, IR::Inst* inst) {
|
|||
}
|
||||
|
||||
void EmitX64::EmitTransferToFP32(IR::Block& block, IR::Inst* inst) {
|
||||
if (inst->GetArg(0).IsImmediate() && inst->GetArg(0).GetU32() == 0) {
|
||||
Xbyak::Xmm result = reg_alloc.DefXmm(inst);
|
||||
code->xorps(result, result);
|
||||
} else {
|
||||
Xbyak::Xmm result = reg_alloc.DefXmm(inst);
|
||||
Xbyak::Reg32 source = reg_alloc.UseGpr(inst->GetArg(0)).cvt32();
|
||||
// TODO: Eliminate this.
|
||||
code->movd(result, source);
|
||||
}
|
||||
}
|
||||
|
||||
void EmitX64::EmitTransferToFP64(IR::Block& block, IR::Inst* inst) {
|
||||
if (inst->GetArg(0).IsImmediate() && inst->GetArg(0).GetU64() == 0) {
|
||||
Xbyak::Xmm result = reg_alloc.DefXmm(inst);
|
||||
code->xorpd(result, result);
|
||||
} else {
|
||||
Xbyak::Xmm result = reg_alloc.DefXmm(inst);
|
||||
Xbyak::Reg64 source = reg_alloc.UseGpr(inst->GetArg(0));
|
||||
// TODO: Eliminate this.
|
||||
code->movq(result, source);
|
||||
}
|
||||
}
|
||||
|
||||
void EmitX64::EmitFPAbs32(IR::Block&, IR::Inst* inst) {
|
||||
|
|
Loading…
Reference in a new issue