Mercurial > projects > ldc
annotate tests/mini/asm1_1.d @ 1605:1d5721f9ae18
[WIP] Merge DMD r251: bugzilla 111 (appending a dchar to a char[])
This patch needs some work in the code generation, because of the runtime
changes (functions "_d_arrayappendcd" and "_d_arrayappendwd" are added).
This doesn't affect existing code though, it just makes with patch
a little useless, because something like this:
char [] s;
s ~= '\u6211';
That failed to compile with a nice error message previously to this
change, now fails with and ugly error message (a failed assertion).
Apparently there is a regression introduced by this patch too, when
compiling Dil I get this assertion message:
ldc: /home/luca/tesis/ldc/gen/statements.cpp:132: virtual void ReturnStatement::toIR(IRState*): Assertion `p->topfunc()->getReturnType() == llvm::Type::getVoidTy(gIR->context())' failed.
0 ldc 0x08a91628
Thank god we have bisecting capabilities in VCSs now ;)
---
dmd/expression.c | 47 +++++++++++++++++++++++++++++++++++++++++------
1 files changed, 41 insertions(+), 6 deletions(-)
author | Leandro Lucarella <llucax@gmail.com> |
---|---|
date | Wed, 06 Jan 2010 15:18:19 -0300 |
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:
220
diff
changeset
|
1 module tangotests.asm1_1; |
220
ccc2e6898a78
[svn r236] added initial codegen of inline asm, pretty buggy and incomplete still. see the tangotests/asm1.d test for a sample of what does
lindquist
parents:
diff
changeset
|
2 |
ccc2e6898a78
[svn r236] added initial codegen of inline asm, pretty buggy and incomplete still. see the tangotests/asm1.d test for a sample of what does
lindquist
parents:
diff
changeset
|
3 extern(C) int printf(char*, ...); |
ccc2e6898a78
[svn r236] added initial codegen of inline asm, pretty buggy and incomplete still. see the tangotests/asm1.d test for a sample of what does
lindquist
parents:
diff
changeset
|
4 |
ccc2e6898a78
[svn r236] added initial codegen of inline asm, pretty buggy and incomplete still. see the tangotests/asm1.d test for a sample of what does
lindquist
parents:
diff
changeset
|
5 int main() |
ccc2e6898a78
[svn r236] added initial codegen of inline asm, pretty buggy and incomplete still. see the tangotests/asm1.d test for a sample of what does
lindquist
parents:
diff
changeset
|
6 { |
ccc2e6898a78
[svn r236] added initial codegen of inline asm, pretty buggy and incomplete still. see the tangotests/asm1.d test for a sample of what does
lindquist
parents:
diff
changeset
|
7 int i = 12; |
ccc2e6898a78
[svn r236] added initial codegen of inline asm, pretty buggy and incomplete still. see the tangotests/asm1.d test for a sample of what does
lindquist
parents:
diff
changeset
|
8 int* ip = &i; |
ccc2e6898a78
[svn r236] added initial codegen of inline asm, pretty buggy and incomplete still. see the tangotests/asm1.d test for a sample of what does
lindquist
parents:
diff
changeset
|
9 printf("%d\n", i); |
1034
12b423e17860
Adjust mini tests to use D_InlineAsm
Christian Kamm <kamm incasoftware de>
parents:
741
diff
changeset
|
10 version (D_InlineAsm_X86) |
220
ccc2e6898a78
[svn r236] added initial codegen of inline asm, pretty buggy and incomplete still. see the tangotests/asm1.d test for a sample of what does
lindquist
parents:
diff
changeset
|
11 { |
1215
08f87d8cd101
Fix some unittests for 64-bit asm. They were operating on int variables as if
Frits van Bommel <fvbommel wxs.nl>
parents:
1034
diff
changeset
|
12 asm |
08f87d8cd101
Fix some unittests for 64-bit asm. They were operating on int variables as if
Frits van Bommel <fvbommel wxs.nl>
parents:
1034
diff
changeset
|
13 { |
08f87d8cd101
Fix some unittests for 64-bit asm. They were operating on int variables as if
Frits van Bommel <fvbommel wxs.nl>
parents:
1034
diff
changeset
|
14 mov ECX, ip; |
08f87d8cd101
Fix some unittests for 64-bit asm. They were operating on int variables as if
Frits van Bommel <fvbommel wxs.nl>
parents:
1034
diff
changeset
|
15 mov 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:
1034
diff
changeset
|
16 add EAX, 8; |
08f87d8cd101
Fix some unittests for 64-bit asm. They were operating on int variables as if
Frits van Bommel <fvbommel wxs.nl>
parents:
1034
diff
changeset
|
17 mul EAX, EAX; |
08f87d8cd101
Fix some unittests for 64-bit asm. They were operating on int variables as if
Frits van Bommel <fvbommel wxs.nl>
parents:
1034
diff
changeset
|
18 mov [ECX], EAX; |
08f87d8cd101
Fix some unittests for 64-bit asm. They were operating on int variables as if
Frits van Bommel <fvbommel wxs.nl>
parents:
1034
diff
changeset
|
19 } |
741
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
20 } |
1034
12b423e17860
Adjust mini tests to use D_InlineAsm
Christian Kamm <kamm incasoftware de>
parents:
741
diff
changeset
|
21 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
|
22 { |
1215
08f87d8cd101
Fix some unittests for 64-bit asm. They were operating on int variables as if
Frits van Bommel <fvbommel wxs.nl>
parents:
1034
diff
changeset
|
23 asm |
08f87d8cd101
Fix some unittests for 64-bit asm. They were operating on int variables as if
Frits van Bommel <fvbommel wxs.nl>
parents:
1034
diff
changeset
|
24 { |
08f87d8cd101
Fix some unittests for 64-bit asm. They were operating on int variables as if
Frits van Bommel <fvbommel wxs.nl>
parents:
1034
diff
changeset
|
25 movq RCX, ip; |
08f87d8cd101
Fix some unittests for 64-bit asm. They were operating on int variables as if
Frits van Bommel <fvbommel wxs.nl>
parents:
1034
diff
changeset
|
26 mov EAX, [RCX]; |
08f87d8cd101
Fix some unittests for 64-bit asm. They were operating on int variables as if
Frits van Bommel <fvbommel wxs.nl>
parents:
1034
diff
changeset
|
27 add EAX, 8; |
08f87d8cd101
Fix some unittests for 64-bit asm. They were operating on int variables as if
Frits van Bommel <fvbommel wxs.nl>
parents:
1034
diff
changeset
|
28 imul EAX, EAX; |
08f87d8cd101
Fix some unittests for 64-bit asm. They were operating on int variables as if
Frits van Bommel <fvbommel wxs.nl>
parents:
1034
diff
changeset
|
29 mov [RCX], EAX; |
08f87d8cd101
Fix some unittests for 64-bit asm. They were operating on int variables as if
Frits van Bommel <fvbommel wxs.nl>
parents:
1034
diff
changeset
|
30 } |
220
ccc2e6898a78
[svn r236] added initial codegen of inline asm, pretty buggy and incomplete still. see the tangotests/asm1.d test for a sample of what does
lindquist
parents:
diff
changeset
|
31 } |
ccc2e6898a78
[svn r236] added initial codegen of inline asm, pretty buggy and incomplete still. see the tangotests/asm1.d test for a sample of what does
lindquist
parents:
diff
changeset
|
32 printf("%d\n", i); |
ccc2e6898a78
[svn r236] added initial codegen of inline asm, pretty buggy and incomplete still. see the tangotests/asm1.d test for a sample of what does
lindquist
parents:
diff
changeset
|
33 assert(i == 400); |
ccc2e6898a78
[svn r236] added initial codegen of inline asm, pretty buggy and incomplete still. see the tangotests/asm1.d test for a sample of what does
lindquist
parents:
diff
changeset
|
34 return 0; |
ccc2e6898a78
[svn r236] added initial codegen of inline asm, pretty buggy and incomplete still. see the tangotests/asm1.d test for a sample of what does
lindquist
parents:
diff
changeset
|
35 } |