Mercurial > projects > ldc
view tests/mini/naked_asm6.d @ 957:31bbc7f3b817
Backed out changeset [369996c08420].
The argument and order dependent numbering of static ctors/dtors generally doesn't matter
because other modules shouldn't reference their symbols. The next changeset
will fix a LDC bug that caused such references within ModuleInfo.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sun, 15 Feb 2009 14:50:33 +0100 |
parents | 97688ff7cf93 |
children | 855889b7b268 |
line wrap: on
line source
extern(C) int printf(char*, ...); ulong retval() { version (X86) asm { naked; mov EAX, 0xff; mov EDX, 0xaa; ret; } else version (X86_64) asm { naked; mov EAX, 0xff; mov EDX, 0xaa; ret; } } ulong retval2() { return (cast(ulong)0xaa << 32) | 0xff; } void main() { ulong a,b; a = retval(); b = retval2(); printf("%llu\n%llu\n", retval(), retval2()); version (X86) { assert(a == 0x000000aa000000ff); assert(a == b); } else version (X86_64) { assert(a == 0xff); assert(b == 0x000000aa000000ff); } }