Mercurial > projects > ldc
annotate tests/mini/asm8.d @ 959:7e669954db7d
Implement implicit return after inline asm on x86_64
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Sun, 15 Feb 2009 18:04:22 +0100 |
parents | b2d27ddf8f45 |
children | aa2e3a6c3410 |
rev | line source |
---|---|
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
1 const float one_f = 1; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
2 const double one_d = 1; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
3 const real one_r = 1; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
4 |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
5 int foo() |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
6 { |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
7 version(X86) |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
8 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
9 asm { mov EAX, 42; } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
10 } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
11 else version (X86_64) |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
12 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
13 asm { mov EAX, 42; } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
14 } |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
15 else static assert(0, "todo"); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
16 } |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
17 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
18 ulong bar() |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
19 { |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
20 version(X86) |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
21 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
22 asm { mov EDX, 0xAA; mov EAX, 0xFF; } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
23 } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
24 else version (X86_64) |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
25 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
26 asm { movq RAX, 0xFF; } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
27 } |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
28 else static assert(0, "todo"); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
29 } |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
30 |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
31 |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
32 float onef() |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
33 { |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
34 version(X86) |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
35 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
36 asm { fld1; } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
37 } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
38 else version (X86_64) |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
39 { |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
40 asm { movss XMM0, [one_f]; } |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
41 } |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
42 else static assert(0, "todo"); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
43 } |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
44 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
45 double oned() |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
46 { |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
47 version(X86) |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
48 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
49 asm { fld1; } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
50 } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
51 else version (X86_64) |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
52 { |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
53 asm { movsd XMM0, [one_d]; } |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
54 } |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
55 else static assert(0, "todo"); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
56 } |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
57 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
58 real oner() |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
59 { |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
60 version(X86) |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
61 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
62 asm { fld1; } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
63 } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
64 else version (X86_64) |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
65 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
66 asm { fld1; } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
67 } |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
68 else static assert(0, "todo"); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
69 } |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
70 |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
71 ifloat oneif() |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
72 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
73 version(X86) |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
74 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
75 asm { fld1; } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
76 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
77 else version (X86_64) |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
78 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
79 asm { movss XMM0, [one_f]; } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
80 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
81 else static assert(0, "todo"); |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
82 } |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
83 |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
84 idouble oneid() |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
85 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
86 version(X86) |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
87 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
88 asm { fld1; } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
89 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
90 else version (X86_64) |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
91 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
92 asm { movsd XMM0, [one_d]; } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
93 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
94 else static assert(0, "todo"); |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
95 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
96 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
97 ireal oneir() |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
98 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
99 version(X86) |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
100 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
101 asm { fld1; } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
102 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
103 else version (X86_64) |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
104 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
105 asm { fld1; } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
106 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
107 else static assert(0, "todo"); |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
108 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
109 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
110 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
111 const float two_f = 2; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
112 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
113 cfloat cf() |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
114 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
115 version(X86) |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
116 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
117 asm { fld1; flds two_f; } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
118 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
119 else version (X86_64) |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
120 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
121 asm |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
122 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
123 movss XMM1, [two_f]; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
124 movss XMM0, [one_f]; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
125 movd ECX, XMM1; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
126 movd EAX, XMM0; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
127 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
128 // invalid operand size :( |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
129 //shl RCX, 32; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
130 //or RAX, RCX; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
131 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
132 pushq RAX; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
133 mov [RSP + 4], EAX; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
134 popq RAX; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
135 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
136 movd XMM0, RAX; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
137 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
138 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
139 else static assert(0, "todo"); |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
140 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
141 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
142 cfloat cf2() |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
143 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
144 version(X86) |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
145 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
146 asm |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
147 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
148 naked; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
149 fld1; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
150 flds two_f; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
151 ret; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
152 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
153 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
154 else version (X86_64) |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
155 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
156 asm |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
157 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
158 naked; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
159 movss XMM1, [two_f]; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
160 movss XMM0, [one_f]; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
161 movd ECX, XMM1; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
162 movd EAX, XMM0; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
163 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
164 // invalid operand size :( |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
165 //shl RCX, 32; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
166 //or RAX, RCX; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
167 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
168 pushq RAX; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
169 mov [RSP + 4], EAX; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
170 popq RAX; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
171 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
172 movd RAX, XMM0; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
173 ret; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
174 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
175 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
176 else static assert(0, "todo"); |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
177 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
178 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
179 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
180 const double two_d = 2; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
181 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
182 cdouble cd() |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
183 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
184 version(X86) |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
185 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
186 asm { fld1; fld two_d } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
187 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
188 else version (X86_64) |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
189 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
190 asm |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
191 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
192 leaq RAX, [one_d]; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
193 leaq RCX, [two_d]; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
194 movsd XMM0, [RAX]; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
195 movsd XMM1, [RCX]; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
196 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
197 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
198 else static assert(0, "todo"); |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
199 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
200 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
201 cdouble cd2() |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
202 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
203 version(X86) |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
204 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
205 asm |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
206 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
207 naked; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
208 fld1; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
209 fld two_d; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
210 ret; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
211 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
212 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
213 else version (X86_64) |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
214 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
215 asm |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
216 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
217 naked; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
218 movsd XMM0, [one_d]; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
219 movsd XMM1, [two_d]; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
220 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
221 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
222 else static assert(0, "todo"); |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
223 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
224 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
225 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
226 const real two_r = 2.0; |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
227 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
228 creal cr() |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
229 { |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
230 version(X86) |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
231 { |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
232 asm { fld1; fld two_r; } |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
233 } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
234 else version (X86_64) |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
235 { |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
236 asm { fld two_r; fld1; } |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
237 } |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
238 else static assert(0, "todo"); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
239 } |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
240 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
241 creal cr2() |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
242 { |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
243 version(X86) |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
244 { |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
245 asm |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
246 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
247 naked; |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
248 fld1; |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
249 fld two_r; |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
250 ret; |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
251 } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
252 } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
253 else version (X86_64) |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
254 { |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
255 asm |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
256 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
257 naked; |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
258 fld two_r; |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
259 fld1; |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
260 ret; |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
261 } |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
262 } |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
263 else static assert(0, "todo"); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
264 } |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
265 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
266 void* vp() |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
267 { |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
268 version(X86) |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
269 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
270 asm { mov EAX, 0x80; } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
271 } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
272 else version (X86_64) |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
273 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
274 asm { movq RAX, 0x80; } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
275 } |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
276 else static assert(0, "todo"); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
277 } |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
278 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
279 int[int] gaa; |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
280 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
281 int[int] aa() |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
282 { |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
283 version(X86) |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
284 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
285 asm { mov EAX, gaa; } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
286 } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
287 else version (X86_64) |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
288 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
289 asm { movq RAX, gaa; } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
290 } |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
291 else static assert(0, "todo"); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
292 } |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
293 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
294 Object gobj; |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
295 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
296 Object ob() |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
297 { |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
298 version(X86) |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
299 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
300 asm { mov EAX, gobj; } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
301 } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
302 else version (X86_64) |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
303 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
304 asm { movq RAX, gobj; } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
305 } |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
306 else static assert(0, "todo"); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
307 } |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
308 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
309 char[] ghello = "hello world"; |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
310 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
311 char[] str() |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
312 { |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
313 version(X86) |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
314 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
315 asm { lea ECX, ghello; mov EAX, [ECX]; mov EDX, [ECX+4]; } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
316 } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
317 else version (X86_64) |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
318 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
319 asm { movq RAX, [ghello]; movq RDX, [ghello]+8; } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
320 } |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
321 else static assert(0, "todo"); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
322 } |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
323 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
324 char[] delegate() dg() |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
325 { |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
326 version(X86) |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
327 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
328 asm { mov EAX, gobj; lea EDX, Object.toString; } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
329 } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
330 else version (X86_64) |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
331 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
332 asm { movq RAX, [gobj]; leaq RDX, Object.toString; } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
333 } |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
334 else static assert(0, "todo"); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
335 } |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
336 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
337 void main() |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
338 { |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
339 gaa[4] = 5; |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
340 gobj = new Object; |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
341 auto adg = &gobj.toString; |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
342 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
343 assert(foo() == 42); |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
344 version(X86) |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
345 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
346 assert(bar() == 0x000000AA000000FF); |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
347 } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
348 else version (X86_64) |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
349 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
350 assert(bar() == 0x00000000000000FF); |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
351 } |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
352 assert(onef() == 1); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
353 assert(oned() == 1); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
354 assert(oner() == 1); |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
355 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
356 assert(oneif() == 1i); |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
357 assert(oneid() == 1i); |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
358 assert(oneir() == 1i); |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
359 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
360 assert(cf() == 1+2i); |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
361 assert(cf2() == 1+2i); |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
362 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
363 assert(cd() == 1+2i); |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
364 assert(cd2() == 1+2i); |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
365 |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
366 assert(cr() == 1+2i); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
367 assert(cr2() == 1+2i); |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
368 |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
369 assert(vp() == cast(void*)0x80); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
370 assert(aa() is gaa); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
371 assert(ob() is gobj); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
372 assert(str() == "hello world"); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
373 assert(dg()() == "object.Object"); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
374 } |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
375 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
376 extern(C) int printf(char*, ...); |