Mercurial > projects > ldc
annotate tests/mini/asm2.d @ 920:545f54041d91
Implemented proper support for naked asm using llvm module level asm. Still not 100% complete, but already 1000 times better that what we had before. Don's BignumX86 implementation from Tango (when turned into a standalone unittest) seems to fully work with no changes, and great performance :)
Fixed align N; in asm blocks.
Fixed inreg parameter passing on x86 for ref/out params.
Removed support for lazy initialization of function local static variables, I have no idea why I ever implemented this, it's not in the D spec, and DMD doesn't support it :P
Some of the global variable related changes might cause minor regressions, but they should be easily fixable.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Tue, 03 Feb 2009 08:54:57 +0100 |
parents | 4ac97ec7c18e |
children | 12b423e17860 |
rev | line source |
---|---|
221
68687d8c3e9a
[svn r237] some inline asm output now seems to work, see tangotests/asm2.d
lindquist
parents:
diff
changeset
|
1 module tangotests.asm2; |
68687d8c3e9a
[svn r237] some inline asm output now seems to work, see tangotests/asm2.d
lindquist
parents:
diff
changeset
|
2 |
68687d8c3e9a
[svn r237] some inline asm output now seems to work, see tangotests/asm2.d
lindquist
parents:
diff
changeset
|
3 extern(C) int printf(char*, ...); |
68687d8c3e9a
[svn r237] some inline asm output now seems to work, see tangotests/asm2.d
lindquist
parents:
diff
changeset
|
4 |
68687d8c3e9a
[svn r237] some inline asm output now seems to work, see tangotests/asm2.d
lindquist
parents:
diff
changeset
|
5 int main() |
68687d8c3e9a
[svn r237] some inline asm output now seems to work, see tangotests/asm2.d
lindquist
parents:
diff
changeset
|
6 { |
68687d8c3e9a
[svn r237] some inline asm output now seems to work, see tangotests/asm2.d
lindquist
parents:
diff
changeset
|
7 int i = 40; |
225
74701ba40398
[svn r241] Fixed missing terminator for void main() with inline asm block.
lindquist
parents:
221
diff
changeset
|
8 int j = 2; |
741
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
9 version(LLVM_InlineAsm_X86) |
221
68687d8c3e9a
[svn r237] some inline asm output now seems to work, see tangotests/asm2.d
lindquist
parents:
diff
changeset
|
10 { |
741
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
11 asm |
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
12 { |
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
13 mov EAX, i; |
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
14 mov EBX, j; |
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
15 add EAX, EBX; |
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
16 mov i, EAX; |
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
17 } |
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
18 } |
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
19 else version(LLVM_InlineAsm_X86_64) |
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
20 { |
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
21 asm |
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
22 { |
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
23 mov EAX, i; |
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
24 mov EBX, j; |
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
25 add EAX, EBX; |
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
26 mov i, EAX; |
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
27 } |
221
68687d8c3e9a
[svn r237] some inline asm output now seems to work, see tangotests/asm2.d
lindquist
parents:
diff
changeset
|
28 } |
68687d8c3e9a
[svn r237] some inline asm output now seems to work, see tangotests/asm2.d
lindquist
parents:
diff
changeset
|
29 printf("42 = %d\n", i); |
68687d8c3e9a
[svn r237] some inline asm output now seems to work, see tangotests/asm2.d
lindquist
parents:
diff
changeset
|
30 assert(i == 42); |
68687d8c3e9a
[svn r237] some inline asm output now seems to work, see tangotests/asm2.d
lindquist
parents:
diff
changeset
|
31 return 0; |
68687d8c3e9a
[svn r237] some inline asm output now seems to work, see tangotests/asm2.d
lindquist
parents:
diff
changeset
|
32 } |