On 22 November 2016 at 18:07, Ilya Yaroshenko via Digitalmars-d <digitalmars-d@puremagic.com> wrote: > On Tuesday, 22 November 2016 at 16:52:40 UTC, Johan Engelen wrote: >> >> On Tuesday, 22 November 2016 at 16:36:13 UTC, Andrei Alexandrescu wrote: >>> >>> On 11/22/2016 11:28 AM, Ilya Yaroshenko wrote: >>>> >>>> They are always software >>>> https://github.com/dlang/druntime/blob/master/src/core/bitop.d --Ilya >>> >>> >>> The intent is to have the compiler detect the pattern and insert the >>> code. dmd does that IIRC (why is asm.dlang.org not working again?) and so >>> does gdc: https://godbolt.org/g/WspkIX. >> >> >> LDC too. https://godbolt.org/g/S83b30 >> (note that cross-module inlining is off by default, something to work on >> for 1.2.0!) > > > No, LDC and GDC cannot detect it. Proof - https://godbolt.org/g/bsAFU8 . > Current LDC DRuntime uses intrinsics instead of software implementation. > > Ilya
Fixed that for you. Unfortunately it seems LDC just isn't clever enough. https://godbolt.org/g/quBpEq Iain