annotate run/a/asm_paddb_01_A.d @ 1285:229e630d4b1a

partuial inline asm review
author thomask
date Tue, 26 Dec 2006 14:21:37 +0000
parents 9dcac8d4e97f
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_paddb_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 haveSSE2!()();
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
18
1285
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
19 byte* a = (new byte[16]).ptr;
1085
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
20 a[0] = 1;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
21 a[1] = 2;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
22 a[2] = 3;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
23 a[3] = 4;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
24 a[4] = 5;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
25 a[5] = 6;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
26 a[6] = 7;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
27 a[7] = 8;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
28 a[8] = 9;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
29 a[9] = 10;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
30 a[10] = 11;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
31 a[11] = 12;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
32 a[12] = 13;
1285
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
33 a[13] = 14;
1085
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
34 a[14] = 15;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
35 a[15] = 16;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
36
1285
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
37 byte* b = (new byte[16]).ptr;
1085
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
38 b[0] = -8;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
39 b[1] = -7;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
40 b[2] = -6;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
41 b[3] = -5;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
42 b[4] = -4;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
43 b[5] = -3;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
44 b[6] = -2;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
45 b[7] = -1;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
46 b[8] = 0;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
47 b[9] = 1;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
48 b[10] = 2;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
49 b[11] = 3;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
50 b[12] = 4;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
51 b[13] = 5;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
52 b[14] = 6;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
53 b[15] = 7;
1091
9dcac8d4e97f post DMD-0.163 review
thomask
parents: 1085
diff changeset
54
1285
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
55 byte* c = (new byte[16]).ptr;
1044
03c97933de98 inline ASM review
thomask
parents: 1017
diff changeset
56
1285
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
57 static if(size_t.sizeof == 4){
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
58 asm{
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
59 mov EAX, a;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
60 movdqu XMM0, [EAX];
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
61 mov EAX, b;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
62 movdqu XMM1, [EAX];
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
63 paddb XMM0, XMM1;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
64 mov EAX, c;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
65 movdqu [EAX], XMM0;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
66 }
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
67 }else static if(size_t.sizeof == 8){
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
68 asm{
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
69 mov RAX, a;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
70 movdqu XMM0, [RAX];
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
71 mov RAX, b;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
72 movdqu XMM1, [RAX];
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
73 paddb XMM0, XMM1;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
74 mov RAX, c;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
75 movdqu [RAX], XMM0;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
76 }
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
77 }else{
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
78 static assert(0, "unhandled pointer size");
1017
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
79 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
80
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
81 if(c[0] != -7){
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[1] != -5){
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[2] != -3){
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[3] != -1){
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[4] != 1){
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[5] != 3){
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 if(c[6] != 5){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
100 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
101 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
102 if(c[7] != 7){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
103 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
104 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
105 if(c[8] != 9){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
106 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
107 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
108 if(c[9] != 11){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
109 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
110 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
111 if(c[10] != 13){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
112 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
113 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
114 if(c[11] != 15){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
115 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
116 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
117 if(c[12] != 17){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
118 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
119 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
120 if(c[13] != 19){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
121 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
122 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
123 if(c[14] != 21){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
124 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
125 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
126 if(c[15] != 23){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
127 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
128 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
129 return 0;
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
130 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
131 }else{
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
132 pragma(msg, "DSTRESS{XFAIL}: no inline ASM support");
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
133 static assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
134 }