Inter-compiler portability of asm between gdc and ldc2 (and dmd)

Guillaume Piolat first.name at gmail.com
Sat Oct 3 22:37:05 UTC 2020


On Saturday, 3 October 2020 at 14:21:25 UTC, Paulo Pinto wrote:
> The PC / Amiga way of
>
> void myfunc (int data)
> {
>    asm {
>      mov bx, data
>      int 21h
>    }
> }
>
> Versus the clunky way of
>
> void myfunc (int data)
> {
>    asm("weird Assembly pseudo syntax", data);
> }

Yes, but...
Assembly use case is just very low now.

I wrote a lot of assembly and since the modern backends like in 
ICC, LLVM or GCC since v4 it doesn't make a lot of sense to have 
code that doesn't perform better, is much harder to maintain, 
read and write.

If anything, optimising a bottleneck with intrinsics takes 3x 
more time, translating it back once the truth unfold is 
error-prone too.

The **inlinable** GCC-style assembly is actually more suitable to 
create the low-level abstracted things that can be used instead 
of assembly. That is, if you manage to write it ^^


More information about the Digitalmars-d mailing list