Simplify fallback case for EmitVectorSetElement64()

This commit is contained in:
Lioncash 2018-07-22 17:20:11 -04:00 committed by MerryMage
parent 6087c2af6f
commit d65b056eba

View file

@ -250,15 +250,16 @@ void EmitX64::EmitVectorSetElement64(EmitContext& ctx, IR::Inst* inst) {
ctx.reg_alloc.DefineValue(inst, source_vector); ctx.reg_alloc.DefineValue(inst, source_vector);
} else { } else {
const Xbyak::Reg64 source_elem = ctx.reg_alloc.UseScratchGpr(args[2]); const Xbyak::Reg64 source_elem = ctx.reg_alloc.UseGpr(args[2]);
const Xbyak::Xmm tmp = ctx.reg_alloc.ScratchXmm();
code.pinsrw(source_vector, source_elem.cvt32(), index * 4); code.movq(tmp, source_elem);
code.shr(source_elem, 16);
code.pinsrw(source_vector, source_elem.cvt32(), index * 4 + 1); if (index == 0) {
code.shr(source_elem, 16); code.movsd(source_vector, tmp);
code.pinsrw(source_vector, source_elem.cvt32(), index * 4 + 2); } else {
code.shr(source_elem, 16); code.punpcklqdq(source_vector, tmp);
code.pinsrw(source_vector, source_elem.cvt32(), index * 4 + 3); }
ctx.reg_alloc.DefineValue(inst, source_vector); ctx.reg_alloc.DefineValue(inst, source_vector);
} }