comparison run/mini/asm5.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 version(X86)
4 {
5 asm { mov EAX, 42; }
6 } else version(X86_64)
7 {
8 asm { movq RAX, 42; }
9 }
10 else static assert(0, "todo");
11 }
12
13 ulong bar()
14 {
15 version(X86)
16 {
17 asm { mov EAX, 0xFF; mov EDX, 0xAA; }
18 } else version(X86_64)
19 {
20 asm { movq RAX, 0xAA000000FF; }
21 }
22 else static assert(0, "todo");
23 }
24
25 void main()
26 {
27 long l = 1;
28 l = 2;
29 l = 4;
30 l = 8;
31 assert(foo() == 42);
32 assert(bar() == 0xAA000000FF);
33 }