Mercurial > projects > ldc
view tests/mini/asm5.d @ 978:6a32d2e18175
Fix a latent bug in the asm code.
I think that technically, using "*m0" instead of "*0" allows LLVM to pick
between using the same memory as output 0 and using a new memory location.
(So far I haven't been able to construct a testcase that actually breaks
because of this, though)
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Wed, 18 Feb 2009 03:38:12 +0100 |
parents | b2d27ddf8f45 |
children | 855889b7b268 |
line wrap: on
line source
int foo() { version(X86) { asm { mov EAX, 42; } } else version(X86_64) { asm { movq RAX, 42; } } else static assert(0, "todo"); } ulong bar() { version(X86) { asm { mov EAX, 0xFF; mov EDX, 0xAA; } } else version(X86_64) { asm { movq RAX, 0xFF; } } else static assert(0, "todo"); } void main() { long l = 1; l = 2; l = 4; l = 8; assert(foo() == 42); version(X86) { assert(bar() == 0x000000AA000000FF); } else version(X86_64) { assert(bar() == 0x00000000000000FF); } }