view tests/mini/asm2.d @ 1615:3da302cc4966

Merge DMD r294: bugzilla 2816 Sudden-death static assert is not... bugzilla 2816 Sudden-death static assert is not very useful. --- dmd/expression.h | 12 ++++++ dmd/staticassert.c | 10 +--- dmd/template.c | 108 ++++++++++++++++++++++++++++++++++++++++++++++++---- dmd/template.h | 2 + 4 files changed, 117 insertions(+), 15 deletions(-)
author Leandro Lucarella <llucax@gmail.com>
date Wed, 06 Jan 2010 15:18:21 -0300
parents 12b423e17860
children
line wrap: on
line source

module tangotests.asm2;

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

int main()
{
    int i = 40;
    int j = 2;
    version(D_InlineAsm_X86)
    {
	asm
    	{	
        	mov EAX, i;
        	mov EBX, j;
        	add EAX, EBX;
        	mov i, EAX;
    	}
    }
    else version(D_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;
}