Files
ldc/tests/mini/asm1.d
2008-11-08 22:29:19 +01:00

32 lines
457 B
D

module asm1;
extern(C) int printf(char*, ...);
void main()
{
version(LLVM_InlineAsm_X86)
{
int x;
asm
{
mov EAX, 42;
mov x, EAX;
}
printf("x = %d\n", x);
}
else version(LLVM_InlineAsm_X86_64)
{
long x;
asm
{
movq RAX, 42L;
movq x, RAX;
}
printf("x = %ld\n", x);
}
else
{
static assert(0, "no inline asm for this platform yet");
}
}