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

kinke kinke at gmx.net
Wed Jul 15 16:16:59 UTC 2020


On Wednesday, 15 July 2020 at 13:02:40 UTC, Cecil Ward wrote:
> On Wednesday, 15 July 2020 at 09:10:10 UTC, rikki cattermole 
> wrote:
>> On 15/07/2020 8:17 PM, kinke wrote:
>>> You're not up-to-date, LDC supports gdc/gcc-style inline asm 
>>> since version 1.21.
>>
>> D's wiki needs updating then. I searched for this information 
>> there and it wasn't there.
>
> I am struggling to find documentation regarding LDC. The 
> runtime library for instance. Do please forgive me if it’s just 
> me being useless. I’m on powerful drugs for pain which make me 
> very woozy. A poor excuse :-)
>
> Could someone hit me with some good urls for relevant 
> LDC-specifics.

I don't think there are any docs about druntime LDC-specifics - 
the only thing which should be of relevance for the user are some 
extra LDC modules in the `ldc` top-level 'package', in particular 
ldc.intrinsics for LLVM intrinsics, ldc.attributes for UDAs, 
ldc.llvmasm for LDC-specific __asm and __ir (inline asm and LLVM 
IR), ldc.dcompute for dcompute, and (auto-generated, depending on 
LLVM version) gccbuiltins_<arch> for GCC builtins compatibility.

https://wiki.dlang.org/LDC-specific_language_changes contains 
some infos, but the more interesting files (ldc.intrinsics, 
ldc.attributes) should be mostly self-explanatory.

We obviously try to employ any LLVM intrinsics wherever we can in 
regular druntime and Phobos (e.g., core.bitop and std.math), so 
that the user doesn't have to use them manually.


More information about the Digitalmars-d mailing list