Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
June 24, 2014 popcnt instruction | ||||
---|---|---|---|---|
| ||||
Hello, I need to use the "popcnt" processor instruction in a performance critical section. Is there a way to do this in D? |
June 24, 2014 Re: popcnt instruction | ||||
---|---|---|---|---|
| ||||
Posted in reply to Archibald | 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 |
June 24, 2014 Re: popcnt instruction | ||||
---|---|---|---|---|
| ||||
Posted in reply to Justin Whear | 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 |
June 24, 2014 Re: popcnt instruction | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rene Zwanenburg | 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?
|
June 24, 2014 Re: popcnt instruction | ||||
---|---|---|---|---|
| ||||
Posted in reply to Archibald | On Tue, 24 Jun 2014 19:44:52 +0000, Archibald wrote:
> 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?
DMD 2.065 seems to support it. What compiler are you using and what errors are you getting?
|
June 24, 2014 Re: popcnt instruction | ||||
---|---|---|---|---|
| ||||
Posted in reply to Justin Whear | Also, see: http://forum.dlang.org/thread/alirjgygnwpifkijxtjo@forum.dlang.org |
June 24, 2014 Re: popcnt instruction | ||||
---|---|---|---|---|
| ||||
Posted in reply to Justin Whear | On Tuesday, 24 June 2014 at 19:56:29 UTC, Justin Whear wrote:
> Also, see:
> http://forum.dlang.org/thread/alirjgygnwpifkijxtjo@forum.dlang.org
"its not documented on the inline assembler page."
That's why I thought it wasn't supported, it's not in the list of supported opcodes.
Thanks for the help!
|
Copyright © 1999-2021 by the D Language Foundation