Mercurial > projects > ldc
annotate tests/mini/asm6.d @ 1647:638a823ace45
Strange workaround for returning from within 'void main()'. The new dmdfe sets the ReturnStatement->exp to null. Fixed bug #391.
author | Kelly Wilson <wilsonk cpsc.ucalgary.ca> |
---|---|
date | Wed, 10 Mar 2010 19:35:14 -0700 |
parents | 08f87d8cd101 |
children |
rev | line source |
---|---|
341
1bb99290e03a
[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
lindquist
parents:
diff
changeset
|
1 extern(C) int printf(char*, ...); |
1bb99290e03a
[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
lindquist
parents:
diff
changeset
|
2 |
1215
08f87d8cd101
Fix some unittests for 64-bit asm. They were operating on int variables as if
Frits van Bommel <fvbommel wxs.nl>
parents:
1035
diff
changeset
|
3 version (D_InlineAsm_X86) |
08f87d8cd101
Fix some unittests for 64-bit asm. They were operating on int variables as if
Frits van Bommel <fvbommel wxs.nl>
parents:
1035
diff
changeset
|
4 version = InlineAsm_X86_Any; |
08f87d8cd101
Fix some unittests for 64-bit asm. They were operating on int variables as if
Frits van Bommel <fvbommel wxs.nl>
parents:
1035
diff
changeset
|
5 version (D_InlineAsm_X86_64) |
08f87d8cd101
Fix some unittests for 64-bit asm. They were operating on int variables as if
Frits van Bommel <fvbommel wxs.nl>
parents:
1035
diff
changeset
|
6 version = InlineAsm_X86_Any; |
08f87d8cd101
Fix some unittests for 64-bit asm. They were operating on int variables as if
Frits van Bommel <fvbommel wxs.nl>
parents:
1035
diff
changeset
|
7 |
341
1bb99290e03a
[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
lindquist
parents:
diff
changeset
|
8 void main() |
1bb99290e03a
[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
lindquist
parents:
diff
changeset
|
9 { |
1bb99290e03a
[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
lindquist
parents:
diff
changeset
|
10 int a,b,c; |
1bb99290e03a
[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
lindquist
parents:
diff
changeset
|
11 a = int.max-1; |
741
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
12 b = 5; |
1215
08f87d8cd101
Fix some unittests for 64-bit asm. They were operating on int variables as if
Frits van Bommel <fvbommel wxs.nl>
parents:
1035
diff
changeset
|
13 version (InlineAsm_X86_Any) |
741
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
14 { |
1215
08f87d8cd101
Fix some unittests for 64-bit asm. They were operating on int variables as if
Frits van Bommel <fvbommel wxs.nl>
parents:
1035
diff
changeset
|
15 asm |
08f87d8cd101
Fix some unittests for 64-bit asm. They were operating on int variables as if
Frits van Bommel <fvbommel wxs.nl>
parents:
1035
diff
changeset
|
16 { |
08f87d8cd101
Fix some unittests for 64-bit asm. They were operating on int variables as if
Frits van Bommel <fvbommel wxs.nl>
parents:
1035
diff
changeset
|
17 mov EAX, a; |
08f87d8cd101
Fix some unittests for 64-bit asm. They were operating on int variables as if
Frits van Bommel <fvbommel wxs.nl>
parents:
1035
diff
changeset
|
18 mov ECX, b; |
08f87d8cd101
Fix some unittests for 64-bit asm. They were operating on int variables as if
Frits van Bommel <fvbommel wxs.nl>
parents:
1035
diff
changeset
|
19 add EAX, ECX; |
08f87d8cd101
Fix some unittests for 64-bit asm. They were operating on int variables as if
Frits van Bommel <fvbommel wxs.nl>
parents:
1035
diff
changeset
|
20 jo Loverflow; |
08f87d8cd101
Fix some unittests for 64-bit asm. They were operating on int variables as if
Frits van Bommel <fvbommel wxs.nl>
parents:
1035
diff
changeset
|
21 mov c, EAX; |
08f87d8cd101
Fix some unittests for 64-bit asm. They were operating on int variables as if
Frits van Bommel <fvbommel wxs.nl>
parents:
1035
diff
changeset
|
22 } |
341
1bb99290e03a
[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
lindquist
parents:
diff
changeset
|
23 } |
741
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
24 printf("a == %d\n", a); |
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
25 printf("b == %d\n", b); |
341
1bb99290e03a
[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
lindquist
parents:
diff
changeset
|
26 printf("c == %d\n", c); |
741
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
27 assert(c == c); |
341
1bb99290e03a
[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
lindquist
parents:
diff
changeset
|
28 return; |
1bb99290e03a
[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
lindquist
parents:
diff
changeset
|
29 |
1bb99290e03a
[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
lindquist
parents:
diff
changeset
|
30 Loverflow: |
741
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
31 int y=0; |
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
32 //assert(0, "overflow"); |
341
1bb99290e03a
[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
lindquist
parents:
diff
changeset
|
33 } |