www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - bitmanip.FloatRep functions not inlined?

reply Guillaume Chatelet <chatelet.guillaume gmail.com> writes:
Please have a look at the following (incorrect) code:

struct half {
   import std.bitmanip;
     enum uint bias = 15, fractionBits = 10, exponentBits = 5, 
signBits = 1;

     this(float value) {
         const f_rep = FloatRep(value);
         sign = f_rep.sign;
         exponent = cast(ubyte)(f_rep.exponent - FloatRep.bias + 
bias);
         fraction = f_rep.fraction;
     }

private:
     mixin(bitfields!(
               uint,  "fraction", fractionBits,
               ubyte, "exponent", exponentBits,
               bool,  "sign",     signBits));
}

Any idea why LDC wouldn't inline the FloatRep's functions ?
https://godbolt.org/g/Pzoebd
Jul 07 2017
parent reply kinke <noone nowhere.com> writes:
On Friday, 7 July 2017 at 18:34:50 UTC, Guillaume Chatelet wrote:
 Any idea why LDC wouldn't inline the FloatRep's functions ?
Phobos isn't compiled with LTO support. See what huge potential that has here: https://github.com/ldc-developers/ldc/issues/2168#issuecomment-313634616
Jul 07 2017
parent Guillaume Chatelet <chatelet.guillaume gmail.com> writes:
On Friday, 7 July 2017 at 20:54:27 UTC, kinke wrote:
 On Friday, 7 July 2017 at 18:34:50 UTC, Guillaume Chatelet 
 wrote:
 Any idea why LDC wouldn't inline the FloatRep's functions ?
Phobos isn't compiled with LTO support. See what huge potential that has here: https://github.com/ldc-developers/ldc/issues/2168#issuecomment-313634616
Very interesting read. Thx a lot for the explanation.
Jul 07 2017