fabs not being inlined?
kinke
noone at nowhere.com
Sat Feb 9 15:38:55 UTC 2019
On Saturday, 9 February 2019 at 15:08:22 UTC, NaN wrote:
> On Friday, 8 February 2019 at 14:47:20 UTC, Guillaume Piolat
> wrote:
>> Alternative: inline by hand
>>
>> https://godbolt.org/z/DS0XIb
>
> This might not be pretty but it coaxes LDC to do abs with a
> single instruction...
>
> https://godbolt.org/z/0aVvSR
Both manual versions are ugly and IMO should be avoided at all
costs. ;) If LTO/cross-module-inlining is not an option but fabs
performance is critical, then use the intrinsic directly:
import ldc.intrinsics;
alias fabs = llvm_fabs;
The reason std.math doesn't just alias (I had a go at this once)
is that there are some tests checking that the std.math functions
are real functions (and that their address can be taken).
> lld-link.exe: error: undefined symbol: __chkstk
Looks like some linker tricks required for the MinGW-based libs
don't work with LTO; I guess it works with the MS toolchain,
e.g., when run inside in a Visual Studio command prompt. I'll
spare you the dirty details.
More information about the digitalmars-d-ldc
mailing list