From 596a8dd1ddae803aabc63d6eb203efa35a8b228a Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 20 Apr 2018 13:44:38 -0400 Subject: [PATCH] emit_x64_vector: Emit PMINSD in EmitVectorMinS32 on SSE4.1-capable CPUs Provides a better alternative to a fallback operation. --- src/backend_x64/emit_x64_vector.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/backend_x64/emit_x64_vector.cpp b/src/backend_x64/emit_x64_vector.cpp index 0d326c3b..21661060 100644 --- a/src/backend_x64/emit_x64_vector.cpp +++ b/src/backend_x64/emit_x64_vector.cpp @@ -906,6 +906,11 @@ void EmitX64::EmitVectorMinS16(EmitContext& ctx, IR::Inst* inst) { } void EmitX64::EmitVectorMinS32(EmitContext& ctx, IR::Inst* inst) { + if (code.DoesCpuSupport(Xbyak::util::Cpu::tSSE41)) { + EmitVectorOperation(code, ctx, inst, &Xbyak::CodeGenerator::pminsd); + return; + } + EmitTwoArgumentFallback(code, ctx, inst, [](std::array& result, const std::array& a, const std::array& b){ std::transform(a.begin(), a.end(), b.begin(), result.begin(), [](auto x, auto y) { return std::min(x, y); }); });