mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-13 03:13:13 +01:00
31 lines
373 B
D
31 lines
373 B
D
module tangotests.asm5;
|
|
|
|
extern(C) int printf(char*, ...);
|
|
|
|
void main()
|
|
{
|
|
int i = func();
|
|
printf("%d\n", i);
|
|
assert(i == 42);
|
|
}
|
|
|
|
int func()
|
|
{
|
|
version (LLVM_InlineAsm_X86)
|
|
{
|
|
asm
|
|
{
|
|
naked;
|
|
mov EAX, 42;
|
|
ret;
|
|
}
|
|
}
|
|
else version(LLVM_InlineAsm_X86_64)
|
|
{
|
|
asm
|
|
{
|
|
movq RAX, 42;
|
|
}
|
|
}
|
|
}
|