Mercurial > projects > dstress
annotate run/a/asm_pfrsqrtit1_01_B.d @ 1288:61d7e32e70a8
partial inline asm review
author | thomask |
---|---|
date | Wed, 27 Dec 2006 11:59:19 +0000 |
parents | 7fbe1218b3b5 |
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_pfrsqrtit1_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 have3DNow!()(); | |
1044 | 18 |
1288 | 19 float* a = (new float[2]).ptr; |
1164 | 20 a[0] = 4.0f; |
21 a[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
|
22 |
1164 | 23 static if(size_t.sizeof == 4){ |
24 asm{ | |
25 mov EAX, a; | |
26 movq MM1, [EAX]; | |
27 pfrsqrt MM0, MM1; | |
28 pfrsqit1 MM0, MM1; | |
29 movq [EAX], MM0; | |
30 emms; | |
31 } | |
32 }else static if(size_t.sizeof == 8){ | |
33 asm{ | |
34 mov RAX, a; | |
35 movq MM1, [RAX]; | |
36 pfrsqrt MM0, MM1; | |
37 pfrsqit1 MM0, MM1; | |
38 movq [RAX], MM0; | |
39 emms; | |
40 } | |
41 }else{ | |
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 |
1164 | 45 a[0] -= 1.001953f; |
46 if(a[0] < 0.0f){ | |
47 a[0] = -a[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
|
48 } |
1164 | 49 if(a[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
|
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 } |
1044 | 52 |
1164 | 53 a[1] -= 1.001953f; |
54 if(a[1] < 0.0f){ | |
55 a[1] = -a[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
|
56 } |
1164 | 57 if(a[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
|
58 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
|
59 } |
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 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
|
62 } |
1042 | 63 }else{ |
64 pragma(msg, "DSTRESS{XPASS}: no inline ASM support"); | |
65 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
|
66 } |