Mercurial > projects > ldc
annotate tests/mini/asm8.d @ 1650:40bd4a0d4870
Update to work with LLVM 2.7.
Removed use of dyn_cast, llvm no compiles
without exceptions and rtti by
default. We do need exceptions for the libconfig stuff, but rtti isn't
necessary (anymore).
Debug info needs to be rewritten, as in LLVM 2.7 the format has
completely changed. To have something to look at while rewriting, the
old code has been wrapped inside #ifndef DISABLE_DEBUG_INFO , this means
that you have to define this to compile at the moment.
Updated tango 0.99.9 patch to include updated EH runtime code, which is
needed for LLVM 2.7 as well.
author | Tomas Lindquist Olsen |
---|---|
date | Wed, 19 May 2010 12:42:32 +0200 |
parents | e8c6dbcd33d1 |
children |
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 { |
981
855889b7b268
Update some testcases now that 64-bit immediates are working.
Frits van Bommel <fvbommel wxs.nl>
parents:
967
diff
changeset
|
26 asm { movq RAX, 0xAA000000FF; } |
949
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 { |
967 | 117 asm { fld1; fld two_f; } |
959
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 { |
1002
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
121 asm |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
122 { |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
123 movss XMM0, [one_f]; |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
124 movss XMM1, [two_f]; |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
125 } |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
126 } |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
127 else static assert(0, "todo"); |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
128 } |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
129 |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
130 extern(C) cfloat cf_C() |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
131 { |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
132 version(X86) |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
133 { |
1018
e8c6dbcd33d1
- Fixed x86-32 C ABI for complex number return values.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
1002
diff
changeset
|
134 asm { |
e8c6dbcd33d1
- Fixed x86-32 C ABI for complex number return values.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
1002
diff
changeset
|
135 mov EAX, [one_f]; |
e8c6dbcd33d1
- Fixed x86-32 C ABI for complex number return values.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
1002
diff
changeset
|
136 mov EDX, [two_f]; |
e8c6dbcd33d1
- Fixed x86-32 C ABI for complex number return values.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
1002
diff
changeset
|
137 } |
1002
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
138 } |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
139 else version (X86_64) |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
140 { |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
141 asm { |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
142 mov EAX, [one_f]; |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
143 mov ECX, [two_f]; |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
144 |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
145 shl RCX, 32; |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
146 or RAX, RCX; |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
147 |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
148 movd XMM0, RAX; |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
149 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
150 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
151 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
|
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 cfloat cf2() |
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 version(X86) |
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 asm |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
159 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
160 naked; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
161 fld1; |
967 | 162 fld two_f; |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
163 ret; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
164 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
165 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
166 else version (X86_64) |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
167 { |
1002
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
168 asm |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
169 { |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
170 naked; |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
171 movss XMM0, [one_f]; |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
172 movss XMM1, [two_f]; |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
173 ret; |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
174 } |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
175 } |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
176 else static assert(0, "todo"); |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
177 } |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
178 |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
179 extern(C) cfloat cf2_C() |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
180 { |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
181 version(X86) |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
182 { |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
183 asm |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
184 { |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
185 naked; |
1018
e8c6dbcd33d1
- Fixed x86-32 C ABI for complex number return values.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
1002
diff
changeset
|
186 mov EAX, [one_f]; |
e8c6dbcd33d1
- Fixed x86-32 C ABI for complex number return values.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
1002
diff
changeset
|
187 mov EDX, [two_f]; |
1002
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
188 ret; |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
189 } |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
190 } |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
191 else version (X86_64) |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
192 { |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
193 asm { |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
194 naked; |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
195 mov EAX, [one_f]; |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
196 mov ECX, [two_f]; |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
197 |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
198 shl RCX, 32; |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
199 or RAX, RCX; |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
200 |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
201 movd XMM0, RAX; |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
202 ret; |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
203 } |
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 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
|
206 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
207 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
208 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
209 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
|
210 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
211 cdouble cd() |
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 version(X86) |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
214 { |
964
aa2e3a6c3410
Some changes I missed in my last commit (wound up in wrong patch file)
Frits van Bommel <fvbommel wxs.nl>
parents:
959
diff
changeset
|
215 asm { fld1; fld two_d; } |
959
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 else version (X86_64) |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
218 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
219 asm |
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 leaq RAX, [one_d]; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
222 leaq RCX, [two_d]; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
223 movsd XMM0, [RAX]; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
224 movsd XMM1, [RCX]; |
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 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
227 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
|
228 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
229 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
230 cdouble cd2() |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
231 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
232 version(X86) |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
233 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
234 asm |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
235 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
236 naked; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
237 fld1; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
238 fld two_d; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
239 ret; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
240 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
241 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
242 else version (X86_64) |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
243 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
244 asm |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
245 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
246 naked; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
247 movsd XMM0, [one_d]; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
248 movsd XMM1, [two_d]; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
249 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
250 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
251 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
|
252 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
253 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
254 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
255 const real two_r = 2.0; |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
256 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
257 creal cr() |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
258 { |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
259 version(X86) |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
260 { |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
261 asm { fld1; fld two_r; } |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
262 } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
263 else version (X86_64) |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
264 { |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
265 asm { fld two_r; fld1; } |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
266 } |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
267 else static assert(0, "todo"); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
268 } |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
269 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
270 creal cr2() |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
271 { |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
272 version(X86) |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
273 { |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
274 asm |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
275 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
276 naked; |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
277 fld1; |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
278 fld two_r; |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
279 ret; |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
280 } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
281 } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
282 else version (X86_64) |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
283 { |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
284 asm |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
285 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
286 naked; |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
287 fld two_r; |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
288 fld1; |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
289 ret; |
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 } |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
292 else static assert(0, "todo"); |
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 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
295 void* vp() |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
296 { |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
297 version(X86) |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
298 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
299 asm { mov EAX, 0x80; } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
300 } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
301 else version (X86_64) |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
302 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
303 asm { movq RAX, 0x80; } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
304 } |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
305 else static assert(0, "todo"); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
306 } |
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 int[int] gaa; |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
309 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
310 int[int] aa() |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
311 { |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
312 version(X86) |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
313 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
314 asm { mov EAX, gaa; } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
315 } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
316 else version (X86_64) |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
317 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
318 asm { movq RAX, gaa; } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
319 } |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
320 else static assert(0, "todo"); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
321 } |
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 Object gobj; |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
324 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
325 Object ob() |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
326 { |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
327 version(X86) |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
328 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
329 asm { mov EAX, gobj; } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
330 } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
331 else version (X86_64) |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
332 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
333 asm { movq RAX, gobj; } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
334 } |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
335 else static assert(0, "todo"); |
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 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
338 char[] ghello = "hello world"; |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
339 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
340 char[] str() |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
341 { |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
342 version(X86) |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
343 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
344 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
|
345 } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
346 else version (X86_64) |
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 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
|
349 } |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
350 else static assert(0, "todo"); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
351 } |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
352 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
353 char[] delegate() dg() |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
354 { |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
355 version(X86) |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
356 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
357 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
|
358 } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
359 else version (X86_64) |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
360 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
361 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
|
362 } |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
363 else static assert(0, "todo"); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
364 } |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
365 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
366 void main() |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
367 { |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
368 gaa[4] = 5; |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
369 gobj = new Object; |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
370 auto adg = &gobj.toString; |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
371 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
372 assert(foo() == 42); |
981
855889b7b268
Update some testcases now that 64-bit immediates are working.
Frits van Bommel <fvbommel wxs.nl>
parents:
967
diff
changeset
|
373 assert(bar() == 0xAA000000FF); |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
374 assert(onef() == 1); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
375 assert(oned() == 1); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
376 assert(oner() == 1); |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
377 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
378 assert(oneif() == 1i); |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
379 assert(oneid() == 1i); |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
380 assert(oneir() == 1i); |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
381 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
382 assert(cf() == 1+2i); |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
383 assert(cf2() == 1+2i); |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
384 |
1002
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
385 assert(cf_C() == 1+2i); |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
386 assert(cf2_C() == 1+2i); |
c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
Frits van Bommel <fvbommel wxs.nl>
parents:
981
diff
changeset
|
387 |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
388 assert(cd() == 1+2i); |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
389 assert(cd2() == 1+2i); |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
390 |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
391 assert(cr() == 1+2i); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
392 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
|
393 |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
394 assert(vp() == cast(void*)0x80); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
395 assert(aa() is gaa); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
396 assert(ob() is gobj); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
397 assert(str() == "hello world"); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
398 assert(dg()() == "object.Object"); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
399 } |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
400 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
401 extern(C) int printf(char*, ...); |