comparison run/mini/naked_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 int foo()
2 {
3 static size_t fourty2 = 42;
4 version(X86)
5 asm
6 {
7 naked;
8 mov EAX, fourty2;
9 ret;
10 }
11 else version (X86_64)
12 {
13 asm
14 {
15 naked;
16 movq RAX,fourty2;
17 ret;
18 }
19 }
20 else static assert(0, "todo");
21 }
22
23 void main()
24 {
25 int i = foo();
26 printf("i == %d\n", i);
27 assert(i == 42);
28 }
29
30 extern(C) int printf(char*, ...);