emit_x64_vector: Vectorize fallback path in EmitVectorMinS8()

This commit is contained in:
Lioncash 2018-04-28 20:11:43 -04:00 committed by MerryMage
parent 0fb6dce689
commit 6e08eed210

View file

@ -1070,9 +1070,19 @@ void EmitX64::EmitVectorMinS8(EmitContext& ctx, IR::Inst* inst) {
return; return;
} }
EmitTwoArgumentFallback(code, ctx, inst, [](std::array<s8, 16>& result, const std::array<s8, 16>& a, const std::array<s8, 16>& b){ auto args = ctx.reg_alloc.GetArgumentInfo(inst);
std::transform(a.begin(), a.end(), b.begin(), result.begin(), [](auto x, auto y) { return std::min(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_b = ctx.reg_alloc.ScratchXmm();
code.movdqa(tmp_b, b);
code.pcmpgtb(tmp_b, a);
code.pand(a, tmp_b);
code.pandn(tmp_b, b);
code.por(a, tmp_b);
ctx.reg_alloc.DefineValue(inst, a);
} }
void EmitX64::EmitVectorMinS16(EmitContext& ctx, IR::Inst* inst) { void EmitX64::EmitVectorMinS16(EmitContext& ctx, IR::Inst* inst) {