How to deal with inline asm functions in Phobos/druntime?
Kai Nacke via digitalmars-d-ldc
digitalmars-d-ldc at puremagic.com
Tue Apr 7 23:31:10 PDT 2015
On Tuesday, 7 April 2015 at 18:15:58 UTC, Johan Engelen wrote:
> It is fun to write these small asm blobs, but I am not sure how
> maintainable all this will be.
>
> Confused :S
Hi Johan!
The functions in Druntime/Phobos exists because the MSVC runtime
does not support 80bit reals which is a must-have for DMD.
If you are going to rewrite assembly snippets then please use
ldc.llvmasm because of all the advantages you have listed. Plus,
ldc.llvmasm do not disable function inlining which is also a big
win.
Regarding std.math, there are already lot of places with versions
for LDC. One reason is that LLVM intrinsics exists. Another
reason is that LDC supports PPC, ARM and MIPS, too. At last, a
reason is that the DMD ASM does not work. I prefer having
rewritten assembly functions. But please note that there must
always be a fallback to the core.stdc function because of the
many supported architectures.
BTW: Many users of LDC want fast math functions. Having a better
implementation of math functions is therefore desirable.
Regards,
Kai
More information about the digitalmars-d-ldc
mailing list