On Friday, 7 April 2017 at 22:57:39 UTC, Walter Bright wrote:
Thanks for pointing that out, I didn't know that. I just assumed LDC would have gone with a clang-style inline assembler (does clang even have inline asm?).

LDC supports both DMD-style asm {} blocks as well as LLVM's native inline assembly format, which is very similar to GCC's, with explicit clobber specifications and explicit parameter passing (https://wiki.dlang.org/LDC_inline_assembly_expressions). The latter is useful on non-x86 platforms as well as to allow more optimizations of functions using inline asm such as inlining (although inlining in particular can also be enabled for DMD-style asm blocks using a pragma).

There are also inline IR expressions for the few situations where you don't want to drop down all the way to inline assembly but still need to crack open the hood and control the emitted LLVM IR: https://wiki.dlang.org/LDC_inline_IR. For example, we use it to implement some target-independent SIMD intrinsics in the library.

 — David

Reply via email to