Mercurial > projects > ldc
annotate tests/mini/asm8.d @ 1002:c749648ed2b8
Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
functions.
There's no need to waste cycles with extern(D), which we get to define
ourselves. Fixes tests/mini/asm8.d. (Since the asm abiret code already assumed
{xmm0, xmm1} returns)
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Thu, 26 Feb 2009 23:35:39 +0100 |
parents | 855889b7b268 |
children | e8c6dbcd33d1 |
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 { |
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
|
134 asm { fld1; fld 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
|
135 } |
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
|
136 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
|
137 { |
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 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
|
139 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
|
140 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
|
141 |
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 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
|
143 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
|
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 movd XMM0, RAX; |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
146 } |
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 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
|
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 cfloat cf2() |
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 version(X86) |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
154 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
155 asm |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
156 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
157 naked; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
158 fld1; |
967 | 159 fld two_f; |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
160 ret; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
161 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
162 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
163 else version (X86_64) |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
164 { |
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
|
165 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
|
166 { |
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
|
167 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
|
168 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
|
169 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
|
170 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
|
171 } |
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 } |
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 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
|
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 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
|
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 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
|
179 { |
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 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
|
181 { |
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 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
|
183 fld1; |
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 fld 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
|
185 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
|
186 } |
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
|
187 } |
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 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
|
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 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
|
191 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
|
192 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
|
193 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
|
194 |
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 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
|
196 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
|
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 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
|
199 ret; |
959
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 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
202 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
|
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 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
206 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
|
207 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
208 cdouble cd() |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
209 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
210 version(X86) |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
211 { |
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
|
212 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
|
213 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
214 else version (X86_64) |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
215 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
216 asm |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
217 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
218 leaq RAX, [one_d]; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
219 leaq RCX, [two_d]; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
220 movsd XMM0, [RAX]; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
221 movsd XMM1, [RCX]; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
222 } |
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 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
|
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 cdouble cd2() |
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 version(X86) |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
230 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
231 asm |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
232 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
233 naked; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
234 fld1; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
235 fld two_d; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
236 ret; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
237 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
238 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
239 else version (X86_64) |
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 asm |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
242 { |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
243 naked; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
244 movsd XMM0, [one_d]; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
245 movsd XMM1, [two_d]; |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
246 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
247 } |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
248 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
|
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 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
252 const real two_r = 2.0; |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
253 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
254 creal cr() |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
255 { |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
256 version(X86) |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
257 { |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
258 asm { fld1; fld two_r; } |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
259 } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
260 else version (X86_64) |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
261 { |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
262 asm { fld two_r; fld1; } |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
263 } |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
264 else static assert(0, "todo"); |
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 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
267 creal cr2() |
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 version(X86) |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
270 { |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
271 asm |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
272 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
273 naked; |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
274 fld1; |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
275 fld two_r; |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
276 ret; |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
277 } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
278 } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
279 else version (X86_64) |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
280 { |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
281 asm |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
282 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
283 naked; |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
284 fld two_r; |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
285 fld1; |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
286 ret; |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
287 } |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
288 } |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
289 else static assert(0, "todo"); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
290 } |
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 void* vp() |
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 version(X86) |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
295 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
296 asm { mov EAX, 0x80; } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
297 } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
298 else version (X86_64) |
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 { movq RAX, 0x80; } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
301 } |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
302 else static assert(0, "todo"); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
303 } |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
304 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
305 int[int] gaa; |
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 int[int] aa() |
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 version(X86) |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
310 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
311 asm { mov EAX, gaa; } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
312 } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
313 else version (X86_64) |
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 { movq RAX, gaa; } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
316 } |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
317 else static assert(0, "todo"); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
318 } |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
319 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
320 Object gobj; |
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 Object ob() |
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 version(X86) |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
325 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
326 asm { mov EAX, gobj; } |
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 else version (X86_64) |
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 asm { movq RAX, gobj; } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
331 } |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
332 else static assert(0, "todo"); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
333 } |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
334 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
335 char[] ghello = "hello world"; |
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 char[] str() |
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 version(X86) |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
340 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
341 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
|
342 } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
343 else version (X86_64) |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
344 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
345 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
|
346 } |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
347 else static assert(0, "todo"); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
348 } |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
349 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
350 char[] delegate() dg() |
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 version(X86) |
949
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
353 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
354 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
|
355 } |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
356 else version (X86_64) |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
357 { |
b2d27ddf8f45
changes to get the naked asm stuff working for x64
wilsonk@ubuntu
parents:
945
diff
changeset
|
358 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
|
359 } |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
360 else static assert(0, "todo"); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
361 } |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
362 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
363 void main() |
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 gaa[4] = 5; |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
366 gobj = new Object; |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
367 auto adg = &gobj.toString; |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
368 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
369 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
|
370 assert(bar() == 0xAA000000FF); |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
371 assert(onef() == 1); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
372 assert(oned() == 1); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
373 assert(oner() == 1); |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
374 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
375 assert(oneif() == 1i); |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
376 assert(oneid() == 1i); |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
377 assert(oneir() == 1i); |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
378 |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
379 assert(cf() == 1+2i); |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
380 assert(cf2() == 1+2i); |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
381 |
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
|
382 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
|
383 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
|
384 |
959
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
385 assert(cd() == 1+2i); |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
386 assert(cd2() == 1+2i); |
7e669954db7d
Implement implicit return after inline asm on x86_64
Frits van Bommel <fvbommel wxs.nl>
parents:
949
diff
changeset
|
387 |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
388 assert(cr() == 1+2i); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
389 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
|
390 |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
391 assert(vp() == cast(void*)0x80); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
392 assert(aa() is gaa); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
393 assert(ob() is gobj); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
394 assert(str() == "hello world"); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
395 assert(dg()() == "object.Object"); |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
396 } |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
397 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff
changeset
|
398 extern(C) int printf(char*, ...); |