emit_x64_vector: Vectorize fallback path of EmitVectorMaxS8()

This commit is contained in:
Lioncash 2018-05-01 08:19:21 -04:00 committed by MerryMage
parent b194313d8c
commit c692ccdd6d

View file

@ -1001,9 +1001,19 @@ void EmitX64::EmitVectorMaxS8(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::max(x, y); }); const Xbyak::Xmm a = ctx.reg_alloc.UseScratchXmm(args[0]);
}); const Xbyak::Xmm b = ctx.reg_alloc.UseScratchXmm(args[1]);
const Xbyak::Xmm tmp_b = ctx.reg_alloc.ScratchXmm();
code.movdqa(tmp_b, b);
code.pcmpgtb(tmp_b, a);
code.pand(b, tmp_b);
code.pandn(tmp_b, a);
code.por(tmp_b, b);
ctx.reg_alloc.DefineValue(inst, tmp_b);
} }
void EmitX64::EmitVectorMaxS16(EmitContext& ctx, IR::Inst* inst) { void EmitX64::EmitVectorMaxS16(EmitContext& ctx, IR::Inst* inst) {