annotate run/a/asm_packssdw_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_packssdw_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: 1042
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!()();
1042
f34b7d4a2db7 added DMD-0.160 results
thomask
parents: 1017
diff changeset
18 haveMMX!()();
1017
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
19
1285
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
20 int* a = (new int[4]).ptr;
1085
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
21 a[0] = 1;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
22 a[1] = -2;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
23 a[2] = 3;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
24 a[3] = -4;
1091
9dcac8d4e97f post DMD-0.163 review
thomask
parents: 1085
diff changeset
25
1285
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
26 int* b = (new int[4]).ptr;
1085
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
27 b[0] = 5;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
28 b[1] = -6;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
29 b[2] = 7;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
30 b[3] = -8;
98f634622849 -fPIC fixes
thomask
parents: 1044
diff changeset
31
1285
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
32 short* c = (new short[8]).ptr;
1044
03c97933de98 inline ASM review
thomask
parents: 1042
diff changeset
33
1285
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
34 static if(size_t.sizeof == 4){
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
35 asm{
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
36 mov EAX, a;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
37 movdqu XMM0, [EAX];
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
38 mov EAX, b;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
39 movdqu XMM1, [EAX];
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
40 packssdw XMM0, XMM1;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
41 mov EAX, c;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
42 movdqu [EAX], XMM0;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
43 }
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
44 }else static if(size_t.sizeof == 8){
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
45 asm{
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
46 mov RAX, a;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
47 movdqu XMM0, [RAX];
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
48 mov RAX, b;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
49 movdqu XMM1, [RAX];
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
50 packssdw XMM0, XMM1;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
51 mov RAX, c;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
52 movdqu [RAX], XMM0;
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
53 }
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
54 }else{
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
55 static assert(0, "unhandled pointer size");
1017
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
56 }
1285
229e630d4b1a partuial inline asm review
thomask
parents: 1091
diff changeset
57
1017
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
58 if(c[0] != 1){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
59 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
60 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
61 if(c[1] != -2){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
62 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
63 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
64 if(c[2] != 3){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
65 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
66 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
67 if(c[3] != -4){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
68 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
69 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
70 if(c[4] != 5){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
71 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
72 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
73 if(c[5] != -6){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
74 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
75 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
76 if(c[6] != 7){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
77 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
78 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
79 if(c[7] != -8){
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
80 assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
81 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
82 return 0;
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
83 }
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
84 }else{
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
85 pragma(msg, "DSTRESS{XFAIL}: no inline ASM support");
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
86 static assert(0);
26f680ab52cd inline ASM review
thomask
parents:
diff changeset
87 }