annotate tests/mini/asm6.d @ 741:4ac97ec7c18e

Applied easy part from wilsonk's x86-64 patch in #107
author Christian Kamm <kamm incasoftware de>
date Thu, 30 Oct 2008 11:08:34 +0100
parents 1bb99290e03a
children 4c524d80e6e1
rev   line source
lindquist@341 1 extern(C) int printf(char*, ...);
lindquist@341 2
lindquist@341 3 void main()
lindquist@341 4 {
lindquist@341 5 int a,b,c;
lindquist@341 6 a = int.max-1;
kamm@741 7 b = 5;
kamm@741 8 version (LLVM_InlineAsm_X86)
lindquist@341 9 {
kamm@741 10 asm
kamm@741 11 {
kamm@741 12 mov EAX, a;
kamm@741 13 mov ECX, b;
kamm@741 14 add EAX, ECX;
kamm@741 15 jo Loverflow;
kamm@741 16 mov c, EAX;
kamm@741 17 }
lindquist@341 18 }
kamm@741 19 else version (LLVM_InlineAsm_X86_64)
kamm@741 20 {
kamm@741 21 asm
kamm@741 22 {
kamm@741 23 movq RDX, a;
kamm@741 24 movq RAX, b;
kamm@741 25 add RDX, RAX;
kamm@741 26 jo Loverflow;
kamm@741 27 movq c, RDX;
kamm@741 28 }
kamm@741 29 }
kamm@741 30 printf("a == %d\n", a);
kamm@741 31 printf("b == %d\n", b);
lindquist@341 32 printf("c == %d\n", c);
kamm@741 33 assert(c == c);
lindquist@341 34 return;
lindquist@341 35
lindquist@341 36 Loverflow:
kamm@741 37 int y=0;
kamm@741 38 //assert(0, "overflow");
lindquist@341 39 }