Mercurial > projects > ldc
comparison tests/mini/asm1.d @ 341:1bb99290e03a trunk
[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
author | lindquist |
---|---|
date | Sun, 13 Jul 2008 02:51:19 +0200 |
parents | test/asm1.d@21f85bac0b1a |
children | 4ac97ec7c18e |
comparison
equal
deleted
inserted
replaced
340:351c0077d0b3 | 341:1bb99290e03a |
---|---|
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 mov RAX, 42L; | |
23 mov 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 } |