Mercurial > projects > ldc
annotate tests/mini/asm1.d @ 819:446263a8a30d
Fixed taking address of global static array element as constant expression.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Tue, 02 Dec 2008 01:07:22 +0100 |
parents | a58784e0f035 |
children | 4c524d80e6e1 |
rev | line source |
---|---|
131 | 1 module asm1; |
2 | |
276
21f85bac0b1a
[svn r297] Fixed: rewrote linker code to use LLVM's Program facilities instead of DMD's oldschool broken "native" approach.
lindquist
parents:
131
diff
changeset
|
3 extern(C) int printf(char*, ...); |
21f85bac0b1a
[svn r297] Fixed: rewrote linker code to use LLVM's Program facilities instead of DMD's oldschool broken "native" approach.
lindquist
parents:
131
diff
changeset
|
4 |
131 | 5 void main() |
6 { | |
756
a58784e0f035
Merge wilsonk's x86-64 inline assembly.
Christian Kamm <kamm incasoftware de>
parents:
741
diff
changeset
|
7 version(LLVM_InlineAsm_X86) |
276
21f85bac0b1a
[svn r297] Fixed: rewrote linker code to use LLVM's Program facilities instead of DMD's oldschool broken "native" approach.
lindquist
parents:
131
diff
changeset
|
8 { |
21f85bac0b1a
[svn r297] Fixed: rewrote linker code to use LLVM's Program facilities instead of DMD's oldschool broken "native" approach.
lindquist
parents:
131
diff
changeset
|
9 int x; |
21f85bac0b1a
[svn r297] Fixed: rewrote linker code to use LLVM's Program facilities instead of DMD's oldschool broken "native" approach.
lindquist
parents:
131
diff
changeset
|
10 asm |
21f85bac0b1a
[svn r297] Fixed: rewrote linker code to use LLVM's Program facilities instead of DMD's oldschool broken "native" approach.
lindquist
parents:
131
diff
changeset
|
11 { |
21f85bac0b1a
[svn r297] Fixed: rewrote linker code to use LLVM's Program facilities instead of DMD's oldschool broken "native" approach.
lindquist
parents:
131
diff
changeset
|
12 mov EAX, 42; |
21f85bac0b1a
[svn r297] Fixed: rewrote linker code to use LLVM's Program facilities instead of DMD's oldschool broken "native" approach.
lindquist
parents:
131
diff
changeset
|
13 mov x, EAX; |
21f85bac0b1a
[svn r297] Fixed: rewrote linker code to use LLVM's Program facilities instead of DMD's oldschool broken "native" approach.
lindquist
parents:
131
diff
changeset
|
14 } |
21f85bac0b1a
[svn r297] Fixed: rewrote linker code to use LLVM's Program facilities instead of DMD's oldschool broken "native" approach.
lindquist
parents:
131
diff
changeset
|
15 printf("x = %d\n", x); |
21f85bac0b1a
[svn r297] Fixed: rewrote linker code to use LLVM's Program facilities instead of DMD's oldschool broken "native" approach.
lindquist
parents:
131
diff
changeset
|
16 } |
741
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
17 else version(LLVM_InlineAsm_X86_64) |
131 | 18 { |
19 long x; | |
20 asm | |
21 { | |
741
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
22 movq RAX, 42L; |
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
23 movq x, RAX; |
131 | 24 } |
25 printf("x = %ld\n", x); | |
26 } | |
27 else | |
28 { | |
276
21f85bac0b1a
[svn r297] Fixed: rewrote linker code to use LLVM's Program facilities instead of DMD's oldschool broken "native" approach.
lindquist
parents:
131
diff
changeset
|
29 static assert(0, "no inline asm for this platform yet"); |
131 | 30 } |
31 } |