Mercurial > projects > dstress
annotate run/a/asm_pfsubr_01_A.d @ 1288:61d7e32e70a8
partial inline asm review
author | thomask |
---|---|
date | Wed, 27 Dec 2006 11:59:19 +0000 |
parents | 7360e428ad73 |
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_pfsubr_01_A; |
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; |
1062 | 20 a[0] = 6.0f; |
21 a[1] = 2.0f; | |
22 | |
1288 | 23 float* b = (new float[2]).ptr; |
1062 | 24 b[0] = 2.0f; |
25 b[1] = 1.0f; | |
26 | |
1288 | 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 |
1288 | 29 static if(size_t.sizeof == 4){ |
30 asm{ | |
31 mov EAX, a; | |
32 movq MM0, [EAX]; | |
33 mov EAX, b; | |
34 movq MM1, [EAX]; | |
35 pfsubr MM0, MM1; | |
36 mov EAX, c; | |
37 movq [EAX], MM0; | |
38 emms; | |
39 } | |
40 }else static if(size_t.sizeof == 8){ | |
41 asm{ | |
42 mov RAX, a; | |
43 movq MM0, [RAX]; | |
44 mov RAX, b; | |
45 movq MM1, [RAX]; | |
46 pfsubr MM0, MM1; | |
47 mov RAX, c; | |
48 movq [RAX], MM0; | |
49 emms; | |
50 } | |
51 }else{ | |
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] != -4.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 |
1288 | 59 if(c[1] != -1.0f){ |
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
|
60 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
|
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 |
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 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
|
64 } |
1042 | 65 }else{ |
66 pragma(msg, "DSTRESS{XPASS}: no inline ASM support"); | |
67 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
|
68 } |