annotate run/a/asm_pxor_02_A.d @ 1329:1c8652b3795a

inline asm review
author thomask
date Fri, 12 Jan 2007 23:07:17 +0000
parents a929acac9127
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
973
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
1 // $HeadURL$
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
2 // $Date$
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
3 // $Author$
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
4
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
5 module dstress.run.a.asm_pxor_02_A;
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
6
1027
7ee2442b6bf4 inline ASM review
thomask
parents: 973
diff changeset
7 version(D_InlineAsm_X86){
7ee2442b6bf4 inline ASM review
thomask
parents: 973
diff changeset
8 version = runTest;
7ee2442b6bf4 inline ASM review
thomask
parents: 973
diff changeset
9 }else version(D_InlineAsm_X86_64){
7ee2442b6bf4 inline ASM review
thomask
parents: 973
diff changeset
10 version = runTest;
7ee2442b6bf4 inline ASM review
thomask
parents: 973
diff changeset
11 }
7ee2442b6bf4 inline ASM review
thomask
parents: 973
diff changeset
12
7ee2442b6bf4 inline ASM review
thomask
parents: 973
diff changeset
13 version(runTest){
7ee2442b6bf4 inline ASM review
thomask
parents: 973
diff changeset
14 import addon.cpuinfo;
1044
03c97933de98 inline ASM review
thomask
parents: 1027
diff changeset
15
1027
7ee2442b6bf4 inline ASM review
thomask
parents: 973
diff changeset
16 int main(){
7ee2442b6bf4 inline ASM review
thomask
parents: 973
diff changeset
17 haveSSE2!()();
7ee2442b6bf4 inline ASM review
thomask
parents: 973
diff changeset
18
1329
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
19 ushort* a = (new ushort[8]).ptr;
1125
a929acac9127 various test case fixes
thomask
parents: 1044
diff changeset
20 a[0] = 0x1200;
a929acac9127 various test case fixes
thomask
parents: 1044
diff changeset
21 a[1] = 0x0120;
a929acac9127 various test case fixes
thomask
parents: 1044
diff changeset
22 a[2] = 0x0012;
a929acac9127 various test case fixes
thomask
parents: 1044
diff changeset
23 a[3] = 0x2001;
a929acac9127 various test case fixes
thomask
parents: 1044
diff changeset
24 a[4] = 0x0008;
a929acac9127 various test case fixes
thomask
parents: 1044
diff changeset
25 a[5] = 0xFFFF;
a929acac9127 various test case fixes
thomask
parents: 1044
diff changeset
26 a[6] = 0x0000;
a929acac9127 various test case fixes
thomask
parents: 1044
diff changeset
27 a[7] = 0x1111;
973
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
28
1329
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
29 ushort* b = (new ushort[8]).ptr;
1125
a929acac9127 various test case fixes
thomask
parents: 1044
diff changeset
30 b[0] = 0x2100;
a929acac9127 various test case fixes
thomask
parents: 1044
diff changeset
31 b[1] = 0x2100;
a929acac9127 various test case fixes
thomask
parents: 1044
diff changeset
32 b[2] = 0x2100;
a929acac9127 various test case fixes
thomask
parents: 1044
diff changeset
33 b[3] = 0x2100;
a929acac9127 various test case fixes
thomask
parents: 1044
diff changeset
34 b[4] = 0x2100;
a929acac9127 various test case fixes
thomask
parents: 1044
diff changeset
35 b[5] = 0x0F00;
a929acac9127 various test case fixes
thomask
parents: 1044
diff changeset
36 b[6] = 0x0102;
a929acac9127 various test case fixes
thomask
parents: 1044
diff changeset
37 b[7] = 0x2222;
a929acac9127 various test case fixes
thomask
parents: 1044
diff changeset
38
1329
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
39 ushort* c = (new ushort[8]).ptr;
1125
a929acac9127 various test case fixes
thomask
parents: 1044
diff changeset
40 c[0] = 0x3300;
a929acac9127 various test case fixes
thomask
parents: 1044
diff changeset
41 c[1] = 0x2020;
a929acac9127 various test case fixes
thomask
parents: 1044
diff changeset
42 c[2] = 0x2112;
a929acac9127 various test case fixes
thomask
parents: 1044
diff changeset
43 c[3] = 0x0101;
a929acac9127 various test case fixes
thomask
parents: 1044
diff changeset
44 c[4] = 0x2108;
a929acac9127 various test case fixes
thomask
parents: 1044
diff changeset
45 c[5] = 0xF0FF;
a929acac9127 various test case fixes
thomask
parents: 1044
diff changeset
46 c[6] = 0x0102;
a929acac9127 various test case fixes
thomask
parents: 1044
diff changeset
47 c[7] = 0x3333;
a929acac9127 various test case fixes
thomask
parents: 1044
diff changeset
48
1329
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
49 ushort* d = (new ushort[8]).ptr;
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
50 ushort* e = (new ushort[8]).ptr;
1044
03c97933de98 inline ASM review
thomask
parents: 1027
diff changeset
51
1329
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
52 static if(size_t.sizeof == 4){
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
53 asm{
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
54 mov EAX, a;
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
55 movdqu XMM0, [EAX];
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
56 mov EAX, b;
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
57 movdqu XMM1, [EAX];
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
58 pxor XMM1, XMM0;
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
59 mov EAX, d;
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
60 movdqu [EAX], XMM0;
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
61 mov EAX, e;
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
62 movdqu [EAX], XMM1;
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
63 }
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
64 }else static if(size_t.sizeof == 8){
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
65 asm{
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
66 mov RAX, a;
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
67 movdqu XMM0, [RAX];
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
68 mov RAX, b;
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
69 movdqu XMM1, [RAX];
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
70 pxor XMM1, XMM0;
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
71 mov RAX, d;
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
72 movdqu [RAX], XMM0;
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
73 mov RAX, e;
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
74 movdqu [RAX], XMM1;
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
75 }
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
76 }else{
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
77 static assert(0, "unhandled pointer size");
973
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
78 }
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
79
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
80
1329
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
81 foreach(size_t i, ushort s; a[0 .. 8]){
1027
7ee2442b6bf4 inline ASM review
thomask
parents: 973
diff changeset
82 if(s != d[i]){
973
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
83 assert(0);
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
84 }
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
85 }
1329
1c8652b3795a inline asm review
thomask
parents: 1125
diff changeset
86 foreach(size_t i, ushort s; c[0 .. 8]){
1027
7ee2442b6bf4 inline ASM review
thomask
parents: 973
diff changeset
87 if(s != e[i]){
973
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
88 assert(0);
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
89 }
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
90 }
1044
03c97933de98 inline ASM review
thomask
parents: 1027
diff changeset
91
973
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
92 return 0;
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
93 }
1027
7ee2442b6bf4 inline ASM review
thomask
parents: 973
diff changeset
94 }else{
7ee2442b6bf4 inline ASM review
thomask
parents: 973
diff changeset
95 pragma(msg, "DSTRESS{XFAIL}: no inline ASM support");
7ee2442b6bf4 inline ASM review
thomask
parents: 973
diff changeset
96 static assert(0);
973
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
97 }