comparison run/mini/asm1.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 asm1;
2
3 extern(C) int printf(char*, ...);
4
5 void main()
6 {
7 version(D_InlineAsm_X86)
8 {
9 int x;
10 asm
11 {
12 mov EAX, 42;
13 mov x, EAX;
14 }
15 printf("x = %d\n", x);
16 }
17 else version(D_InlineAsm_X86_64)
18 {
19 long x;
20 asm
21 {
22 movq RAX, 42L;
23 movq x, RAX;
24 }
25 printf("x = %ld\n", x);
26 }
27 else
28 {
29 static assert(0, "no inline asm for this platform yet");
30 }
31 }