annotate run/a/asm_pfacc_01_B.d @ 1285:229e630d4b1a

partuial inline asm review
author thomask
date Tue, 26 Dec 2006 14:21:37 +0000
parents 9dcac8d4e97f
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_pfacc_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
1285
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
7 version(D_InlineAsm_X86){
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
8 version = runTest;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
9 }else version(D_InlineAsm_X86_64){
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
10 version = runTest;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
11 }
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
12
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
13 version(runTest){
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
14 import addon.cpuinfo;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
15
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
16 int main(){
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
17 have3DNow!()();
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
18
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
19 float* a = (new float[2]).ptr;
1085
98f634622849 -fPIC fixes
thomask
parents: 1042
diff changeset
20 a[0] = 123.0f;
98f634622849 -fPIC fixes
thomask
parents: 1042
diff changeset
21 a[1] = -456.0f;
1091
9dcac8d4e97f post DMD-0.163 review
thomask
parents: 1085
diff changeset
22
1285
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
23 float* b = (new float[2]).ptr;
1085
98f634622849 -fPIC fixes
thomask
parents: 1042
diff changeset
24 b[0] = 12.0f;
98f634622849 -fPIC fixes
thomask
parents: 1042
diff changeset
25 b[1] = 17.0f;
1091
9dcac8d4e97f post DMD-0.163 review
thomask
parents: 1085
diff changeset
26
1285
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
27 float* c = (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
28
1285
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
29 static if(size_t.sizeof == 4){
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
30 asm{
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
31 mov EAX, a;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
32 movq MM0, [EAX];
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
33 mov EAX, b;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
34 movq MM1, [EAX];
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
35 pfacc MM0, MM1;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
36 mov EAX, c;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
37 movq [EAX], MM0;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
38 emms;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
39 }
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
40 }else static if(size_t.sizeof == 8){
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
41 asm{
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
42 mov RAX, a;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
43 movq MM0, [RAX];
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
44 mov RAX, b;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
45 movq MM1, [RAX];
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
46 pfacc MM0, MM1;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
47 mov RAX, c;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
48 movq [RAX], MM0;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
49 emms;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
50 }
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
51 }else{
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
52 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
53 }
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
9acd7becc753 added 3DNow! tests - all of them are broken, see http://d.puremagic.com/bugzilla/show_bug.cgi?id=115
thomask
parents:
diff changeset
55 if(c[0] != -333.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
56 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
57 }
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 if(c[1] != 29.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
59 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
60 }
9acd7becc753 added 3DNow! tests - all of them are broken, see http://d.puremagic.com/bugzilla/show_bug.cgi?id=115
thomask
parents:
diff changeset
61
9acd7becc753 added 3DNow! tests - all of them are broken, see http://d.puremagic.com/bugzilla/show_bug.cgi?id=115
thomask
parents:
diff changeset
62 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
63 }
1285
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
64 }else{
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
65 pragma(msg, "DSTRESS{XFAIL}: no inline ASM support");
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
66 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
67 }