How to deal with inline asm functions in Phobos/druntime?

Johan Engelen via digitalmars-d-ldc digitalmars-d-ldc at
Wed Apr 8 05:36:22 PDT 2015

Thanks Kai!

Well, first we should get LDC fully functional on Win64, no? :P
That was my main goal, really.

About SSE: I can't vectorize the code for this one function with 
one real as argument! I had done a brief search for what 
instructions are available on xmm regs (argument is passed 
through xmm0), but it is mostly simple arithmetic I think, not 
the kind of stuff that is used in the original druntime asm code.
(Btw, the pro-epilogues also consist of pushing/popping all XMM 
regs, quite a bit of data, but indeed no clue how slow/fast that 
is. Didn't measure a thing, but it just looked kind of wasteful :)

But thinking about David's comment a bit more, if I understand 
ilogb correctly, all it needs to do is output the exponent of the 
real as an int. For that, one doesn't need floating point 
operations at all. Just a bit of bit shifting and masking, and 
subtracting the floating point format's exponent bias value. I 
think we can just express that as normal D code, which can then 
be optimized / vectorized by LLVM ? That code could go upstream, 
with a few static ifs for all floating point formats supported.

Again, I want to get LDC fully functional foremost, so all this 
is fun but distracting ;)

More information about the digitalmars-d-ldc mailing list