view tests/mini/asm2.d @ 983:6e68054cfc20

Fix out-ouf-source build for runtime as well. To build out-of-source, follow these steps: # [[Insert LLVM build instructions here]] mkdir my_build_dir cd my_build_dir svn co http://svn.dsource.org/projects/tango/trunk tango ccmake <PATH_TO_SOURCE> # (Regular ccmake stuff, press 'c' a few times followed by 'g') make make runtime # add `PWD`/bin to PATH closes #213
author Frits van Bommel <fvbommel wxs.nl>
date Thu, 19 Feb 2009 11:01:34 +0100
parents 4ac97ec7c18e
children 12b423e17860
line wrap: on
line source

module tangotests.asm2;

extern(C) int printf(char*, ...);

int main()
{
    int i = 40;
    int j = 2;
    version(LLVM_InlineAsm_X86)
    {
	asm
    	{	
        	mov EAX, i;
        	mov EBX, j;
        	add EAX, EBX;
        	mov i, EAX;
    	}
    }
    else version(LLVM_InlineAsm_X86_64)
    {
	asm
	{
		mov EAX, i;
		mov EBX, j;
		add EAX, EBX;
		mov i, EAX;
    	}
    }
    printf("42 = %d\n", i);
    assert(i == 42);
    return 0;
}