popcnt intrinsic unused

David Nadlinger via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Tue Jan 19 12:01:31 PST 2016


Hi Stefan,

On 19 Jan 2016, at 14:18, Stefan Koch via digitalmars-d-ldc wrote:
> I just compiled a simple program calling popcnt in a loop.
> It does not generate the intrinsic even when compiled with
> -O3 -c -mcpu=amdfam10

You mean it emits a function call to libdruntime-ldc instead of just the 
intrinsic? In that case, it's probably the inlining problem that has 
been haunting us for ages (can't use the LLVM inliner because core.bitop 
doesn't actually get compiled, and we are not using DMD's front-end 
inliner either).

If that's the case, a workaround would be to either copy/paste the 
function into your source code, or add the druntime module to the build 
(making sure to use -singleobj for the ldc2 driver).

Either way, one of the next important goals for LDC should be finally 
implementing proper force-inline support (that, unlike DMD's pragma, 
also works when the inliner is not otherwise active, and across all 
module boundaries).

  — David


More information about the digitalmars-d-ldc mailing list