Inlining problem of core.bitops

jkrempus at gmail.com jkrempus at gmail.com
Sat Dec 28 02:53:02 PST 2013


In LDC, core.bitop.bsf is just an ordinary function compiled in 
libdruntime-ldc.a. Since bitop.d isn't on the command line, LDC uses the 
precompiled code in the library, which can't be inlined. You can get it 
to inline bsf by putting bitop.d on the command line:

ldmd2 -O -release -inline -output-s test.d /opt/ldc/include/d/core/bitop.d

_D4test4foo1FNaNbxkZk:
    .cfi_startproc
    movl	%edi, %eax
    bsfq	%rax, %rax
    ret

It inlines llvm_cttz because that is an llvm intrinsic.


More information about the digitalmars-d-ldc mailing list