!!!Please add intrinsics module for DMD DRuntime!!!

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Tue Nov 22 16:52:15 PST 2016


On 11/22/2016 9:07 AM, Ilya Yaroshenko wrote:
> No, LDC and GDC cannot detect it. Proof - https://godbolt.org/g/bsAFU8 . Current
> LDC DRuntime uses intrinsics instead of software implementation.

Consider the code:

   import core.bitop;

   int foo(int v) {
     return core.bitop.bsf(v);
   }

Compiling:

   dmd foo.d -c
   obj2asm foo.obj

yields:

   _D5bug113fooFiZi        comdat
                 bsf     EAX,AL
                 ret

Meaning the bsf() intrinsic is properly detected and used.


More information about the Digitalmars-d mailing list