annotate tests/mini/naked_asm5.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 e92e14690a4f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
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 :)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
1 int foo(int op)(int a, int b)
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 :)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
2 {
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 :)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
3 version(X86)
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 :)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
4 {
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 :)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
5 const OP = (op == '+') ? "add" : "sub";
1448
e92e14690a4f change mingw32 versioning to version(Windows)
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 1447
diff changeset
6 version (Windows)
1447
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 928
diff changeset
7 {
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 928
diff changeset
8 asm { naked; }
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 928
diff changeset
9 mixin("asm{push EBP;mov EBP,ESP;sub ESP,8;mov ECX,[EBP+8];"~OP~" EAX, ECX;add ESP,8;pop EBP;}");
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 928
diff changeset
10 asm { ret; }
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 928
diff changeset
11 } else
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 928
diff changeset
12 {
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 928
diff changeset
13 asm { naked; }
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 928
diff changeset
14 mixin("asm{"~OP~" EAX, [ESP+4];}");
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 928
diff changeset
15 asm { ret 4; }
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 928
diff changeset
16 }
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 :)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
17 }
928
1b10a9c6e3e8 Added X86-64 version. Needed significant changes.
wilsonk@ubuntu
parents: 920
diff changeset
18 else version(X86_64)
1b10a9c6e3e8 Added X86-64 version. Needed significant changes.
wilsonk@ubuntu
parents: 920
diff changeset
19 {
1b10a9c6e3e8 Added X86-64 version. Needed significant changes.
wilsonk@ubuntu
parents: 920
diff changeset
20 const OP = (op == '+') ? "add" : "sub";
1b10a9c6e3e8 Added X86-64 version. Needed significant changes.
wilsonk@ubuntu
parents: 920
diff changeset
21 asm { naked; }
1b10a9c6e3e8 Added X86-64 version. Needed significant changes.
wilsonk@ubuntu
parents: 920
diff changeset
22 mixin("asm{"~OP~" ESI,EDI; mov EAX, ESI;}");
1b10a9c6e3e8 Added X86-64 version. Needed significant changes.
wilsonk@ubuntu
parents: 920
diff changeset
23 asm { ret; }
1b10a9c6e3e8 Added X86-64 version. Needed significant changes.
wilsonk@ubuntu
parents: 920
diff changeset
24 }
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 :)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
25 else static assert(0, "todo");
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 :)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
26 }
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 :)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
27
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 :)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
28 void main()
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 :)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
29 {
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 :)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
30 int i = foo!('+')(2, 4);
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 :)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
31 assert(i == 6);
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 :)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
32 i = foo!('-')(2, 4);
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 :)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
33 assert(i == 2);
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 :)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
34 }