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

Iain Buclaw ibuclaw at gdcproject.org
Sat Oct 3 21:52:10 UTC 2020


On Saturday, 3 October 2020 at 15:16:21 UTC, Ola Fosheim Grøstad 
wrote:
> On Saturday, 3 October 2020 at 14:21:25 UTC, Paulo Pinto wrote:
>> The PC / Amiga way of
> […]
>> Versus the clunky way of
>>
>> void myfunc (int data)
>> {
>>    asm("weird Assembly pseudo syntax", data);
>> }
>
> Yes, yes, I totally agree! I haven't found the desire to write 
> much assembly in many years now as intrinsics are good enough 
> for me at this point, but when I did I would rather just write 
> a function in C, disassemble it and modify the code. It was 
> more pleasant and flexible than dealing with the "clunky way". 
> (Besides the built compiler-assembler didn't support the new 
> SIMD instructions I wanted to use anyway.)
>
> What I meant was, why do they think that it difficult to 
> integrate non-AT&T syntax with the compiler? Makes no sense to 
> me.
>

-masm=intel

> Also, assembly is usually defined with the intent to be easy to 
> parse. If you don't have to support macros (or other advanced 
> features) one can write the core parts of an assembly parser in 
> a weekend and having fun while doing it.

This question of why dmd-style iasm isn't done has already been 
answered a little earlier today.  If you think you can implement 
all supported targets (that is about 50 distinct CPUs) in a 
weekend, be my guest.  You'll soon learn every reason why it is 
unfeasible, impractical, and in many cases not possible within 
the llvm and gcc compiler frameworks.


More information about the Digitalmars-d mailing list