annotate run/a/asm_pi2fd_01_B.d @ 1630:d0efa3ae5522 default tip

run/mini/naked_asm5: New x86_64 ABI passes the arguments in reverse order.
author David Nadlinger <code@klickverbot.at>
date Sat, 23 Apr 2011 22:57:32 +0200
parents 7a397590d6e0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
984
9acd7becc753 added 3DNow! tests - all of them are broken, see http://d.puremagic.com/bugzilla/show_bug.cgi?id=115
thomask
parents:
diff changeset
1 // $HeadURL$
9acd7becc753 added 3DNow! tests - all of them are broken, see http://d.puremagic.com/bugzilla/show_bug.cgi?id=115
thomask
parents:
diff changeset
2 // $Date$
9acd7becc753 added 3DNow! tests - all of them are broken, see http://d.puremagic.com/bugzilla/show_bug.cgi?id=115
thomask
parents:
diff changeset
3 // $Author$
9acd7becc753 added 3DNow! tests - all of them are broken, see http://d.puremagic.com/bugzilla/show_bug.cgi?id=115
thomask
parents:
diff changeset
4
9acd7becc753 added 3DNow! tests - all of them are broken, see http://d.puremagic.com/bugzilla/show_bug.cgi?id=115
thomask
parents:
diff changeset
5 module dstress.run.a.asm_pi2fd_01_B;
9acd7becc753 added 3DNow! tests - all of them are broken, see http://d.puremagic.com/bugzilla/show_bug.cgi?id=115
thomask
parents:
diff changeset
6
1042
f34b7d4a2db7 added DMD-0.160 results
thomask
parents: 984
diff changeset
7 version(D_InlineAsm_X86){
f34b7d4a2db7 added DMD-0.160 results
thomask
parents: 984
diff changeset
8 version = runTest;
f34b7d4a2db7 added DMD-0.160 results
thomask
parents: 984
diff changeset
9 }else version(D_InlineAsm_X86_64){
f34b7d4a2db7 added DMD-0.160 results
thomask
parents: 984
diff changeset
10 version = runTest;
f34b7d4a2db7 added DMD-0.160 results
thomask
parents: 984
diff changeset
11 }
f34b7d4a2db7 added DMD-0.160 results
thomask
parents: 984
diff changeset
12
f34b7d4a2db7 added DMD-0.160 results
thomask
parents: 984
diff changeset
13 version(runTest){
f34b7d4a2db7 added DMD-0.160 results
thomask
parents: 984
diff changeset
14 import addon.cpuinfo;
f34b7d4a2db7 added DMD-0.160 results
thomask
parents: 984
diff changeset
15
f34b7d4a2db7 added DMD-0.160 results
thomask
parents: 984
diff changeset
16 int main(){
f34b7d4a2db7 added DMD-0.160 results
thomask
parents: 984
diff changeset
17 have3DNow!()();
1044
03c97933de98 inline ASM review
thomask
parents: 1042
diff changeset
18
1289
ad4d84aba69b partial inline asm review
thomask
parents: 1091
diff changeset
19 int* a = (new int[2]).ptr;
1062
7360e428ad73 pre 0.162 review
thomask
parents: 1044
diff changeset
20 a[0] = 6;
7360e428ad73 pre 0.162 review
thomask
parents: 1044
diff changeset
21 a[1] = 2;
1091
9dcac8d4e97f post DMD-0.163 review
thomask
parents: 1062
diff changeset
22
1289
ad4d84aba69b partial inline asm review
thomask
parents: 1091
diff changeset
23 float* b = (new float[2]).ptr;
984
9acd7becc753 added 3DNow! tests - all of them are broken, see http://d.puremagic.com/bugzilla/show_bug.cgi?id=115
thomask
parents:
diff changeset
24
1289
ad4d84aba69b partial inline asm review
thomask
parents: 1091
diff changeset
25 static if(size_t.sizeof == 4){
ad4d84aba69b partial inline asm review
thomask
parents: 1091
diff changeset
26 asm{
ad4d84aba69b partial inline asm review
thomask
parents: 1091
diff changeset
27 mov EAX, a;
ad4d84aba69b partial inline asm review
thomask
parents: 1091
diff changeset
28 pi2fd MM0, [EAX];
ad4d84aba69b partial inline asm review
thomask
parents: 1091
diff changeset
29 mov EAX, b;
ad4d84aba69b partial inline asm review
thomask
parents: 1091
diff changeset
30 movq [EAX], MM0;
ad4d84aba69b partial inline asm review
thomask
parents: 1091
diff changeset
31 emms;
ad4d84aba69b partial inline asm review
thomask
parents: 1091
diff changeset
32 }
ad4d84aba69b partial inline asm review
thomask
parents: 1091
diff changeset
33 }else static if(size_t.sizeof == 8){
ad4d84aba69b partial inline asm review
thomask
parents: 1091
diff changeset
34 asm{
ad4d84aba69b partial inline asm review
thomask
parents: 1091
diff changeset
35 mov RAX, a;
ad4d84aba69b partial inline asm review
thomask
parents: 1091
diff changeset
36 pi2fd MM0, [RAX];
ad4d84aba69b partial inline asm review
thomask
parents: 1091
diff changeset
37 mov RAX, b;
ad4d84aba69b partial inline asm review
thomask
parents: 1091
diff changeset
38 movq [RAX], MM0;
ad4d84aba69b partial inline asm review
thomask
parents: 1091
diff changeset
39 emms;
ad4d84aba69b partial inline asm review
thomask
parents: 1091
diff changeset
40 }
ad4d84aba69b partial inline asm review
thomask
parents: 1091
diff changeset
41 }else{
ad4d84aba69b partial inline asm review
thomask
parents: 1091
diff changeset
42 static assert(0, "unhandled pointer size");
984
9acd7becc753 added 3DNow! tests - all of them are broken, see http://d.puremagic.com/bugzilla/show_bug.cgi?id=115
thomask
parents:
diff changeset
43 }
9acd7becc753 added 3DNow! tests - all of them are broken, see http://d.puremagic.com/bugzilla/show_bug.cgi?id=115
thomask
parents:
diff changeset
44
9acd7becc753 added 3DNow! tests - all of them are broken, see http://d.puremagic.com/bugzilla/show_bug.cgi?id=115
thomask
parents:
diff changeset
45 if(b[0] != 6.0f){
9acd7becc753 added 3DNow! tests - all of them are broken, see http://d.puremagic.com/bugzilla/show_bug.cgi?id=115
thomask
parents:
diff changeset
46 assert(0);
9acd7becc753 added 3DNow! tests - all of them are broken, see http://d.puremagic.com/bugzilla/show_bug.cgi?id=115
thomask
parents:
diff changeset
47 }
9acd7becc753 added 3DNow! tests - all of them are broken, see http://d.puremagic.com/bugzilla/show_bug.cgi?id=115
thomask
parents:
diff changeset
48
9acd7becc753 added 3DNow! tests - all of them are broken, see http://d.puremagic.com/bugzilla/show_bug.cgi?id=115
thomask
parents:
diff changeset
49 if(b[1] != 2.0f){
9acd7becc753 added 3DNow! tests - all of them are broken, see http://d.puremagic.com/bugzilla/show_bug.cgi?id=115
thomask
parents:
diff changeset
50 assert(0);
9acd7becc753 added 3DNow! tests - all of them are broken, see http://d.puremagic.com/bugzilla/show_bug.cgi?id=115
thomask
parents:
diff changeset
51 }
9acd7becc753 added 3DNow! tests - all of them are broken, see http://d.puremagic.com/bugzilla/show_bug.cgi?id=115
thomask
parents:
diff changeset
52
9acd7becc753 added 3DNow! tests - all of them are broken, see http://d.puremagic.com/bugzilla/show_bug.cgi?id=115
thomask
parents:
diff changeset
53 return 0;
9acd7becc753 added 3DNow! tests - all of them are broken, see http://d.puremagic.com/bugzilla/show_bug.cgi?id=115
thomask
parents:
diff changeset
54 }
1042
f34b7d4a2db7 added DMD-0.160 results
thomask
parents: 984
diff changeset
55 }else{
1386
7a397590d6e0 64-bit fixes
thomask
parents: 1289
diff changeset
56 pragma(msg, "DSTRESS{XFAIL}: no inline ASM support");
1042
f34b7d4a2db7 added DMD-0.160 results
thomask
parents: 984
diff changeset
57 static assert(0);
984
9acd7becc753 added 3DNow! tests - all of them are broken, see http://d.puremagic.com/bugzilla/show_bug.cgi?id=115
thomask
parents:
diff changeset
58 }