From 87ca63699f26147f6e4c4fa879c97e69414cc844 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 20 Apr 2018 13:54:40 -0400 Subject: [PATCH] emit_x64_vector: Emit PMAXUD in EmitVectorMaxU32 on SSE4.1-capable CPUs --- 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 8f360bfa..455f1f96 100644 --- a/src/backend_x64/emit_x64_vector.cpp +++ b/src/backend_x64/emit_x64_vector.cpp @@ -879,6 +879,11 @@ void EmitX64::EmitVectorMaxU16(EmitContext& ctx, IR::Inst* inst) { } void EmitX64::EmitVectorMaxU32(EmitContext& ctx, IR::Inst* inst) { + if (code.DoesCpuSupport(Xbyak::util::Cpu::tSSE41)) { + EmitVectorOperation(code, ctx, inst, &Xbyak::CodeGenerator::pmaxud); + 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::max(x, y); }); });