annotate run/a/asm_pmaxub_01_A.d @ 1290:e3d0dea394ab

partial inline asm review
author thomask
date Wed, 27 Dec 2006 11:59:48 +0000
parents 6e5d377573e1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1017
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
1 // $HeadURL$
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
2 // $Date$
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
3 // $Author$
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
4
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
5 module dstress.run.a.asm_pmaxub_01_A;
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
6
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
7 version(D_InlineAsm_X86){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
8 version = runTest;
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
9 }else version(D_InlineAsm_X86_64){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
10 version = runTest;
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
11 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
12
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
13 version(runTest){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
14 import addon.cpuinfo;
1044
03c97933de98 inline ASM review
thomask
parents: 1017
diff changeset
15
1017
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
16 int main(){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
17 haveSSE!()();
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
18
1290
e3d0dea394ab partial inline asm review
thomask
parents: 1182
diff changeset
19 ubyte[] A = [cast(ubyte) 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
e3d0dea394ab partial inline asm review
thomask
parents: 1182
diff changeset
20 ubyte* a = A.ptr;
e3d0dea394ab partial inline asm review
thomask
parents: 1182
diff changeset
21
e3d0dea394ab partial inline asm review
thomask
parents: 1182
diff changeset
22 ubyte[] B = [cast(ubyte)15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 17];
e3d0dea394ab partial inline asm review
thomask
parents: 1182
diff changeset
23 ubyte* b = B.ptr;
e3d0dea394ab partial inline asm review
thomask
parents: 1182
diff changeset
24
e3d0dea394ab partial inline asm review
thomask
parents: 1182
diff changeset
25 ubyte* c = (new ubyte[16]).ptr;
1044
03c97933de98 inline ASM review
thomask
parents: 1017
diff changeset
26
1182
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1165
diff changeset
27 static if(size_t.sizeof == 4){
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1165
diff changeset
28 asm{
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1165
diff changeset
29 mov EAX, a;
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1165
diff changeset
30 movdqu XMM0, [EAX];
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1165
diff changeset
31 mov EAX, b;
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1165
diff changeset
32 movdqu XMM1, [EAX];
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1165
diff changeset
33 pmaxub XMM0, XMM1;
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1165
diff changeset
34 mov EAX, c;
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1165
diff changeset
35 movdqu [EAX], XMM0;
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1165
diff changeset
36 }
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1165
diff changeset
37 }else static if(size_t.sizeof == 8){
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1165
diff changeset
38 asm{
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1165
diff changeset
39 mov RAX, a;
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1165
diff changeset
40 movdqu XMM0, [RAX];
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1165
diff changeset
41 mov RAX, b;
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1165
diff changeset
42 movdqu XMM1, [RAX];
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1165
diff changeset
43 pmaxub XMM0, XMM1;
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1165
diff changeset
44 mov RAX, c;
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1165
diff changeset
45 movdqu [RAX], XMM0;
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1165
diff changeset
46 }
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1165
diff changeset
47 }else{
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1165
diff changeset
48 static assert(0, "unhandled pointer size");
1017
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
49 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
50
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
51 if(c[0] != 15){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
52 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
53 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
54 if(c[1] != 14){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
55 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
56 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
57 if(c[2] != 13){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
58 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
59 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
60 if(c[3] != 12){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
61 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
62 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
63 if(c[4] != 11){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
64 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
65 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
66 if(c[5] != 10){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
67 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
68 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
69 if(c[6] != 9){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
70 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
71 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
72 if(c[7] != 8){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
73 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
74 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
75 if(c[8] != 9){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
76 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
77 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
78 if(c[9] != 10){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
79 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
80 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
81 if(c[10] != 11){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
82 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
83 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
84 if(c[11] != 12){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
85 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
86 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
87 if(c[12] != 13){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
88 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
89 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
90 if(c[13] != 14){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
91 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
92 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
93 if(c[14] != 15){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
94 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
95 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
96 if(c[15] != 17){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
97 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
98 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
99 return 0;
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
100 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
101 }else{
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
102 pragma(msg, "DSTRESS{XFAIL}: no inline ASM support");
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
103 static assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
104 }