Mercurial > projects > dstress
annotate run/a/asm_pfrsqrt_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_pfrsqrt_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!()(); | |
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 movq [EAX], MM0; | |
29 emms; | |
30 } | |
31 }else static if(size_t.sizeof == 8){ | |
32 asm{ | |
33 mov RAX, a; | |
34 movq MM1, [RAX]; | |
35 pfrsqrt MM0, MM1; | |
36 movq [RAX], MM0; | |
37 emms; | |
38 } | |
39 }else{ | |
40 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
|
41 } |
9acd7becc753
added 3DNow! tests - all of them are broken, see http://d.puremagic.com/bugzilla/show_bug.cgi?id=115
thomask
parents:
diff
changeset
|
42 |
1164 | 43 a[0] -= 0.5f; |
44 if(a[0] < 0.0f){ | |
45 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
|
46 } |
1164 | 47 if(a[0] > float.epsilon * (1 << 11)){ |
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 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
|
49 } |
1044 | 50 |
1164 | 51 a[1] -= 4.0f; |
52 if(a[0] < 0.0f){ | |
53 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
|
54 } |
1164 | 55 if(a[0] > float.epsilon * (1 << 11)){ |
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 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 |
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 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
|
60 } |
1042 | 61 }else{ |
62 pragma(msg, "DSTRESS{XPASS}: no inline ASM support"); | |
63 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
|
64 } |