Mercurial > projects > ldc
view tests/mini/asm7.d @ 806:96b404ba7eb0
Move storage of final vtbl from BaseClass to IrInterface: BaseClass instances are shared!
Always use the target's irstruct interfaceMap when building the const initializer.
Tango helloworld works again.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sun, 30 Nov 2008 11:25:40 +0100 |
parents | 4ac97ec7c18e |
children | 12b423e17860 |
line wrap: on
line source
module tangotests.asm7; // test massive label collisions (runtime uses Loverflow too) extern(C) int printf(char*, ...); void main() { int a = add(1,2); int s = sub(1,2); assert(a == 3); assert(s == -1); } int add(int a, int b) { int res; version (LLVM_InlineAsm_X86) { asm { mov EAX, a; add EAX, b; jo Loverflow; mov res, EAX; } } else version (LLVM_InlineAsm_X86_64) { asm { mov EAX, a; add EAX, b; jo Loverflow; mov res, EAX; } } printf("%d\n",res); return res; Loverflow: assert(0, "add overflow"); } int sub(int a, int b) { int res; version (LLVM_InlineAsm_X86) { asm { mov EAX, a; sub EAX, b; jo Loverflow; mov res, EAX; } } else version (LLVM_InlineAsm_X86_64) { asm { mov EAX, a; sub EAX, b; jo Loverflow; mov res, EAX; } } printf("%d\n",res); return res; Loverflow: assert(0, "sub overflow"); int x; }