Boost logo

Boost :

Subject: Re: [boost] [dynamic_bitset] Using of GCC built-in functions may increase performance of some methods
From: degski (degski_at_[hidden])
Date: 2018-08-23 04:39:10


On Thu, 23 Aug 2018 at 00:17, Andrey Semashev via Boost <
boost_at_[hidden]> wrote:

> I think such an optimization would be useful. Note that MSVC also has
> intrinsics for popcount[1], although I don't think those are supported
> when the target CPU doesn't implement the corresponding instructions.
>

This instruction is supported on Intel Penryn (x86, 2007) and AMD 3rd Gen.
and onward from there.

You would have to check at compile time whether the target CPU
> supports it (e.g. by checking if __AVX__ is defined).
>

On a Penryn, __AVX__ will give a false negative. Checking __cpuid as Gavin
writes should also work on that processor.

On ARM, which appears to have become an important cpu-type, there is the
corresponding VCNT instruction:
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0489c/CIHCFDBJ.html
, but this instruction does not seem to be provided as an intrinsic by
Microsoft.

degski

-- 
*“If something cannot go on forever, it will stop" - Herbert Stein*
*“No, it isn’t truth. Truth isn’t truth" - Rudolph W. L. Giuliani*

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk