Mercurial > projects > ldc
comparison 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 |
comparison
equal
deleted
inserted
replaced
219:761c8352f494 | 220:ccc2e6898a78 |
---|---|
1 module tangotests.asm1; | |
2 | |
3 extern(C) int printf(char*, ...); | |
4 | |
5 int main() | |
6 { | |
7 int i = 12; | |
8 int* ip = &i; | |
9 printf("%d\n", i); | |
10 asm | |
11 { | |
12 mov EBX, ip; | |
13 mov EAX, [EBX]; | |
14 add EAX, 8; | |
15 mul EAX, EAX; | |
16 mov [EBX], EAX; | |
17 } | |
18 printf("%d\n", i); | |
19 assert(i == 400); | |
20 return 0; | |
21 } |