emit_x64_vector: Vectorize fallback path for EmitVectorMaxU32()

This commit is contained in:
Lioncash 2018-07-13 20:20:17 -04:00 committed by MerryMage
parent 245c903129
commit 35026a6ce3

View file

@ -1270,9 +1270,25 @@ void EmitX64::EmitVectorMaxU32(EmitContext& ctx, IR::Inst* inst) {
return; return;
} }
EmitTwoArgumentFallback(code, ctx, inst, [](std::array<u32, 4>& result, const std::array<u32, 4>& a, const std::array<u32, 4>& b){ auto args = ctx.reg_alloc.GetArgumentInfo(inst);
std::transform(a.begin(), a.end(), b.begin(), result.begin(), [](auto x, auto y) { return std::max(x, y); }); const Xbyak::Xmm a = ctx.reg_alloc.UseScratchXmm(args[0]);
}); const Xbyak::Xmm b = ctx.reg_alloc.UseXmm(args[1]);
const Xbyak::Xmm tmp = ctx.reg_alloc.ScratchXmm();
code.movdqa(tmp, code.MConst(xword, 0x8000000080000000, 0x8000000080000000));
const Xbyak::Xmm tmp_b = ctx.reg_alloc.ScratchXmm();
code.movdqa(tmp_b, b);
code.pxor(tmp_b, tmp);
code.pxor(tmp, a);
code.pcmpgtd(tmp, tmp_b);
code.pand(a, tmp);
code.pandn(tmp, b);
code.por(a, tmp);
ctx.reg_alloc.DefineValue(inst, a);
} }
void EmitX64::EmitVectorMaxU64(EmitContext& ctx, IR::Inst* inst) { void EmitX64::EmitVectorMaxU64(EmitContext& ctx, IR::Inst* inst) {