view tangotests/asm1.d @ 220:ccc2e6898a78 trunk

[svn r236] added initial codegen of inline asm, pretty buggy and incomplete still. see the tangotests/asm1.d test for a sample of what does work!
author lindquist
date Fri, 06 Jun 2008 20:14:51 +0200
parents
children
line wrap: on
line source

module tangotests.asm1;

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

int main()
{
    int i = 12;
    int* ip = &i;
    printf("%d\n", i);
    asm
    {
        mov EBX, ip;
        mov EAX, [EBX];
        add EAX, 8;
        mul EAX, EAX;
        mov [EBX], EAX;
    }
    printf("%d\n", i);
    assert(i == 400);
    return 0;
}