[GSoC] 'Independency of D from the C Standard Library' progress and update thread

Stefanos Baziotis sdi1600105 at di.uoa.gr
Fri Jun 28 13:26:27 UTC 2019


On Friday, 28 June 2019 at 12:33:16 UTC, Nicholas Wilson wrote:
> inline asm is generally very bad for the optimiser because is 
> can have any side-effects and is completely opaque.

Exactly, that's the primary reason I mentioned that inline asm 
can't
be interleaved with D. For performance reasons. The compiler has
to be very conservative (more than one would expect). Which means
that the only way to go is either pure D or full ASM and in fact, 
`_naked`
ASM.

> It is possible to generate the asm with string mixins, see e.g. 
> the BigInt routines in phobos.
>

I suppose you mean this: 
https://github.com/dlang/phobos/blob/master/std/bigint.d
With a quick look I'm not sure I understand the reason to do 
string mixins.
I understand that it is for convenience (i.e. construct the ASM 
appropriately and not write a million different versions) and not 
performance reasons.

> You should test your work with LDC at some point which has an 
> optimiser worth using, but note the bit about opaque inline ASM 
> hurting performance.
>

It is tested with LDC but LDC was not a target for this project. 
Yes, inline ASM
is risky as is pure D for the reasons I said above. Maybe I 
should note explicitly
the risk of using only ASM as well, since I did for pure D.
It's a matter of compromise.

>
> You should be able to get the offset of the first member with
>
> int foo()
> {
>     static class A { int a; }
>     return A.init.a.offsetof;
> }
>
> which will apply to any other non-nested class.
>

Thanks, I had not considered that. I think I should do an 
explicit post
where I ask the opinion of the community about whether they would 
like
the support of classes and how so.


>
> Take a look at https://github.com/AuburnSounds/intel-intrinsics
>

Just a little bit more detail, from my research, it is supposed 
that these two instructions should correspond somehow to these 2 
instructions:
     simd_stof!(XMM.LODD, void16)(v, XMM0);
     simd!(XMM.PSHUFD, 0, void16, void16)(XMM0, XMM0);

But I could not get them work for my life.

I had not considered the intel intrinsics which is dumb if you 
consider
that there is a whole talk I watched on this topic.
It is this: https://www.youtube.com/watch?v=cmswsx1_BUQ
for anyone interested.

> Keep up the good work!

Thank you!

- Stefanos




More information about the Digitalmars-d mailing list