comparison run/mini/asm2.d @ 1628:c6ef09dfba4d

add mini test set from ldc project
author Moritz Warning <moritzwarning@web.de>
date Mon, 10 Jan 2011 19:47:18 +0100
parents
children
comparison
equal deleted inserted replaced
1627:e1b954780837 1628:c6ef09dfba4d
1 module tangotests.asm2;
2
3 extern(C) int printf(char*, ...);
4
5 int main()
6 {
7 int i = 40;
8 int j = 2;
9 version(D_InlineAsm_X86)
10 {
11 asm
12 {
13 mov EAX, i;
14 mov EBX, j;
15 add EAX, EBX;
16 mov i, EAX;
17 }
18 }
19 else version(D_InlineAsm_X86_64)
20 {
21 asm
22 {
23 mov EAX, i;
24 mov EBX, j;
25 add EAX, EBX;
26 mov i, EAX;
27 }
28 }
29 printf("42 = %d\n", i);
30 assert(i == 42);
31 return 0;
32 }