comparison test/asm1.d @ 276:21f85bac0b1a trunk

[svn r297] Fixed: rewrote linker code to use LLVM's Program facilities instead of DMD's oldschool broken "native" approach.
author lindquist
date Fri, 20 Jun 2008 17:45:13 +0200
parents 5825d48b27d1
children
comparison
equal deleted inserted replaced
275:665b81613475 276:21f85bac0b1a
1 module asm1; 1 module asm1;
2
3 extern(C) int printf(char*, ...);
2 4
3 void main() 5 void main()
4 { 6 {
5 version(LLVM_InlineAsm_X86_64) 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)
6 { 18 {
7 long x; 19 long x;
8 asm 20 asm
9 { 21 {
10 mov RAX, 42L; 22 mov RAX, 42L;
12 } 24 }
13 printf("x = %ld\n", x); 25 printf("x = %ld\n", x);
14 } 26 }
15 else 27 else
16 { 28 {
17 static assert(0, "no llvm inline asm for this platform yet"); 29 static assert(0, "no inline asm for this platform yet");
18 } 30 }
19 } 31 }