popcnt instruction

Archibald via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 24 12:44:52 PDT 2014


On Tuesday, 24 June 2014 at 17:27:09 UTC, Rene Zwanenburg wrote:
> On Tuesday, 24 June 2014 at 17:05:24 UTC, Justin Whear wrote:
>> On Tue, 24 Jun 2014 16:34:42 +0000, Archibald wrote:
>>
>>> Hello,
>>> I need to use the "popcnt" processor instruction in a 
>>> performance
>>> critical section.
>>> Is there a way to do this in D?
>>
>> D's inline assembler is described here: 
>> http://dlang.org/iasm.html
>
> There's also an intrinsic in core.bitop:
> http://dlang.org/library/core/bitop/popcnt.html


Thanks for the answers.
Unfortunately it seems like popcnt isn't supported by D's inline
assembler.
What if I import it as an external C function, will I get optimal
performance?


More information about the Digitalmars-d-learn mailing list