Mercurial > projects > ldc
comparison 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 |
comparison
equal
deleted
inserted
replaced
740:96484f5bf5af | 741:4ac97ec7c18e |
---|---|
2 | 2 |
3 extern(C) int printf(char*,...); | 3 extern(C) int printf(char*,...); |
4 | 4 |
5 void main() | 5 void main() |
6 { | 6 { |
7 char* fmt = "yay!\n"; | 7 char* stmt = "yay!\n"; |
8 asm | 8 char* fmt = "%s"; |
9 version (LLVM_InlineAsm_X86) | |
9 { | 10 { |
10 jmp L2; | 11 asm |
11 L1:; | 12 { |
12 jmp L3; | 13 jmp L2; |
13 L2:; | 14 L1:; |
14 jmp L1; | 15 jmp L3; |
15 L3:; | 16 L2:; |
16 push fmt; | 17 jmp L1; |
17 call printf; | 18 L3:; |
18 pop EAX; | 19 push fmt; |
20 call printf; | |
21 pop AX; | |
22 } | |
19 } | 23 } |
24 else version(LLVM_InlineAsm_X86_64) | |
25 { | |
26 asm | |
27 { | |
28 jmp L2; | |
29 L1:; | |
30 jmp L3; | |
31 L2:; | |
32 jmp L1; | |
33 L3:; | |
34 movq RDI, fmt; | |
35 movq RSI, stmt; | |
36 xor AL, AL; | |
37 call printf; | |
38 } | |
39 } | |
40 printf(fmt,stmt); | |
20 } | 41 } |