annotate run/a/asm_pfrcp_01_B.d @ 1288:61d7e32e70a8

partial inline asm review
author thomask
date Wed, 27 Dec 2006 11:59:19 +0000
parents 03c97933de98
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_pfrcp_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
1288
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
7 version(D_InlineAsm_X86){
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
8 version = runTest;
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
9 }else version(D_InlineAsm_X86_64){
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
10 version = runTest;
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
11 }
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
12
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
13 version(runTest){
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
14 import addon.cpuinfo;
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
15
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
16 int main(){
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
17 haveMMX!()();
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
18
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
19 float[] A = [2.0f, 3.3f];
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
20 float* a = A.ptr;
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
21
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
22 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
23
1288
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
24 static if(size_t.sizeof == 4){
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
25 asm{
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
26 mov EAX, a;
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
27 movq MM1, [EAX];
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
28 pfrcp MM0, MM1;
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
29 mov EAX, c;
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
30 movq [EAX], MM0;
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
31 emms;
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
32 }
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
33 }else static if(size_t.sizeof == 8){
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
34 asm{
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
35 mov RAX, a;
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
36 movq MM1, [RAX];
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
37 pfrcp MM0, MM1;
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
38 mov RAX, c;
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
39 movq [RAX], MM0;
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
40 emms;
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
41 }
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
42 }else{
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
43 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
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
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 c[0] -= 0.5f;
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 if(c[0] < 0.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
48 c[0] = -c[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
49 }
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 if(c[0] > float.epsilon * (1 << 11)){
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 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
52 }
1044
03c97933de98 inline ASM review
thomask
parents: 1042
diff changeset
53
1042
f34b7d4a2db7 added DMD-0.160 results
thomask
parents: 984
diff changeset
54 c[1] -= 0.5f;
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
55 if(c[1] < 0.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 c[1] = -c[1];
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] > float.epsilon * (1 << 11)){
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 }
1288
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
64 }else{
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
diff changeset
65 pragma(msg, "DSTRESS{XFAIL}: no inline ASM support");
61d7e32e70a8 partial inline asm review
thomask
parents: 1044
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 }