view tests/mini/naked_asm1.d @ 943:95d09451cb59

Reverted the template instantiation changes from rev [940]. Wasn't safe it seems :(
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Thu, 05 Feb 2009 18:17:42 +0100
parents 545f54041d91
children 4c524d80e6e1
line wrap: on
line source

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
        {
            naked;
            movq RAX, 42;
            ret;
        }
    }
}