diff --git a/src/backend_x64/emit_x64_vector.cpp b/src/backend_x64/emit_x64_vector.cpp index 8e6b0034..23780db7 100644 --- a/src/backend_x64/emit_x64_vector.cpp +++ b/src/backend_x64/emit_x64_vector.cpp @@ -1613,6 +1613,16 @@ void EmitX64::EmitVectorPairedAdd64(EmitContext& ctx, IR::Inst* inst) { } void EmitX64::EmitVectorPopulationCount(EmitContext& ctx, IR::Inst* inst) { + if (code.DoesCpuSupport(Xbyak::util::Cpu::tAVX512_BITALG)) { + auto args = ctx.reg_alloc.GetArgumentInfo(inst); + const Xbyak::Xmm data = ctx.reg_alloc.UseScratchXmm(args[0]); + + code.vpopcntb(data, data); + + ctx.reg_alloc.DefineValue(inst, data); + return; + } + if (code.DoesCpuSupport(Xbyak::util::Cpu::tSSSE3)) { auto args = ctx.reg_alloc.GetArgumentInfo(inst);