GCC builtins in LDC - compiler interoperability

kinke noone at nowhere.com
Wed Jul 15 08:20:48 UTC 2020


On Tuesday, 14 July 2020 at 23:37:13 UTC, Cecil Ward wrote:
> I currently have a fair amount of code that will only run under 
> GDC because of reliance on GDC-specific library routines. I’d 
> like to ask whether I can find or implement equivalents in LDC2 
> to the GDC routines
>         __builtin_expect()
> and
>         __builtin_unreachable() ?

As Ilya already posted in another thread of yours, 
__builtin_expect is ldc.intrinsics.llvm_expect. Many other gcc 
builtins are available in ldc.gccbuiltins_<arch>. I don't think 
we expose `unreachable` though.


More information about the digitalmars-d-ldc mailing list