diff tests/mini/asm4.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 ef5f75ae6895
line wrap: on
line diff
--- a/tests/mini/asm4.d	Thu Oct 30 10:17:05 2008 +0100
+++ b/tests/mini/asm4.d	Thu Oct 30 11:08:34 2008 +0100
@@ -4,17 +4,38 @@
 
 void main()
 {
-    char* fmt = "yay!\n";
-    asm
+    char* stmt = "yay!\n";
+    char* fmt = "%s";
+    version (LLVM_InlineAsm_X86)
     {
-        jmp L2;
-    L1:;
-        jmp L3;
-    L2:;
-        jmp L1;
-    L3:;
-        push fmt;
-        call printf;
-        pop EAX;
+	asm
+    	{
+		jmp L2;
+   	L1:;
+		jmp L3;
+    	L2:;
+		jmp L1;
+    	L3:;
+		push fmt;
+        	call printf;
+        	pop AX;
+    	}
     }
+    else version(LLVM_InlineAsm_X86_64)
+    {
+	asm
+	{
+		jmp L2;
+   	L1:;
+		jmp L3;
+    	L2:;
+		jmp L1;
+    	L3:;	
+		movq	RDI, fmt;
+		movq	RSI, stmt;
+		xor	AL, AL;
+		call	printf;
+	}
+    }
+    printf(fmt,stmt);
 }