Mercurial > projects > ldc
annotate tests/mini/asm2.d @ 1351:8d501abecd24
Initial (but disabled) fix for ticket #294 , the actual part that fixes the bug is in a #if 0 block as I'm afraid it will cause regressions. I'm most likely not going to be around tonight, and maybe not tomorrow as well, so I'm pushing it in case someone wants to run some serious testing/investigate the problem noted in llvmhelpers.cpp : realignOffset .
author | Tomas Lindquist Olsen <tomas.l.olsen gmail com> |
---|---|
date | Thu, 14 May 2009 17:20:17 +0200 |
parents | 12b423e17860 |
children |
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; |
1034
12b423e17860
Adjust mini tests to use D_InlineAsm
Christian Kamm <kamm incasoftware de>
parents:
741
diff
changeset
|
9 version(D_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 } |
1034
12b423e17860
Adjust mini tests to use D_InlineAsm
Christian Kamm <kamm incasoftware de>
parents:
741
diff
changeset
|
19 else version(D_InlineAsm_X86_64) |
741
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 } |