Mercurial > projects > dstress
annotate run/a/asm_pfrcpit1_01_B.d @ 1288:61d7e32e70a8
partial inline asm review
author | thomask |
---|---|
date | Wed, 27 Dec 2006 11:59:19 +0000 |
parents | 03c97933de98 |
children | 7a397590d6e0 |
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_pfrcpit1_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 | 7 version(D_InlineAsm_X86){ |
8 version = runTest; | |
9 }else version(D_InlineAsm_X86_64){ | |
10 version = runTest; | |
11 } | |
12 | |
13 version(runTest){ | |
14 import addon.cpuinfo; | |
15 | |
16 int main(){ | |
17 haveMMX!()(); | |
18 have3DNow!()(); | |
19 | |
1288 | 20 float* a = (new float[2]).ptr; |
21 a[0] = 2.0f; | |
22 a[1] = -0.5f; | |
23 | |
24 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
|
25 |
1288 | 26 static if(size_t.sizeof == 4){ |
27 asm{ | |
28 mov EAX, a; | |
29 movq MM1, [EAX]; | |
30 pfrcp MM0, MM1; | |
31 pfrcpit1 MM0, MM1; | |
32 mov EAX, c; | |
33 movq [EAX], MM0; | |
34 emms; | |
35 } | |
36 }else static if(size_t.sizeof == 8){ | |
37 asm{ | |
38 mov RAX, a; | |
39 movq MM1, [RAX]; | |
40 pfrcp MM0, MM1; | |
41 pfrcpit1 MM0, MM1; | |
42 mov RAX, c; | |
43 movq [RAX], MM0; | |
44 emms; | |
45 } | |
46 }else{ | |
47 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
|
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 |
1042 | 50 c[0] -= 1.007812f; |
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
|
51 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
|
52 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
|
53 } |
1288 | 54 if(c[0] > float.epsilon * (1 << 8)){ |
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 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
|
56 } |
1044 | 57 |
1288 | 58 c[1] -= 1.007812; |
59 if(c[1] < 0.0f){ | |
60 c[1] = -c[1]; | |
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
|
61 } |
1288 | 62 if(c[1] > float.epsilon * (1 << 8)){ |
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
|
63 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
|
64 } |
9acd7becc753
added 3DNow! tests - all of them are broken, see http://d.puremagic.com/bugzilla/show_bug.cgi?id=115
thomask
parents:
diff
changeset
|
65 |
9acd7becc753
added 3DNow! tests - all of them are broken, see http://d.puremagic.com/bugzilla/show_bug.cgi?id=115
thomask
parents:
diff
changeset
|
66 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
|
67 } |
1042 | 68 }else{ |
69 pragma(msg, "DSTRESS{XPASS}: no inline ASM support"); | |
70 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
|
71 } |