annotate run/a/asm_pshufhw_01_A.d @ 1630:d0efa3ae5522 default tip

run/mini/naked_asm5: New x86_64 ABI passes the arguments in reverse order.
author David Nadlinger <code@klickverbot.at>
date Sat, 23 Apr 2011 22:57:32 +0200
parents 1c8652b3795a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1019
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
1 // $HeadURL$
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
2 // $Date$
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
3 // $Author$
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
4
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
5 module dstress.run.a.asm_pshufhw_01_A;
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
6
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
7 version(D_InlineAsm_X86){
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
8 version = runTest;
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
9 }else version(D_InlineAsm_X86_64){
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
10 version = runTest;
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
11 }
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
12
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
13 version(runTest){
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
14 import addon.cpuinfo;
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
15
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
16 int main(){
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
17 haveSSE2!()();
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
18
1329
1c8652b3795a inline asm review
thomask
parents: 1044
diff changeset
19 short[] A = [9, 9, 9, 9, 9, 9, 9, 9];
1c8652b3795a inline asm review
thomask
parents: 1044
diff changeset
20 short* a = A.ptr;
1019
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
21
1329
1c8652b3795a inline asm review
thomask
parents: 1044
diff changeset
22 short[] B = [1, 2, 3, 4, 5, 6, 7, 8];
1c8652b3795a inline asm review
thomask
parents: 1044
diff changeset
23 short* b = B.ptr;
1c8652b3795a inline asm review
thomask
parents: 1044
diff changeset
24
1c8652b3795a inline asm review
thomask
parents: 1044
diff changeset
25 short* c = (new short[8]).ptr;
1019
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
26
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
27 asm{
1329
1c8652b3795a inline asm review
thomask
parents: 1044
diff changeset
28 mov EAX, a;
1c8652b3795a inline asm review
thomask
parents: 1044
diff changeset
29 movdqu XMM0, [EAX];
1c8652b3795a inline asm review
thomask
parents: 1044
diff changeset
30 mov EAX, b;
1c8652b3795a inline asm review
thomask
parents: 1044
diff changeset
31 movdqu XMM1, [EAX];
1044
03c97933de98 inline ASM review
thomask
parents: 1027
diff changeset
32 pshufhw XMM0, XMM1, 0b11_10_01_00;
1329
1c8652b3795a inline asm review
thomask
parents: 1044
diff changeset
33 mov EAX, c;
1c8652b3795a inline asm review
thomask
parents: 1044
diff changeset
34 movdqu [EAX], XMM0;
1019
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
35 }
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
36
1329
1c8652b3795a inline asm review
thomask
parents: 1044
diff changeset
37 if(c[0] != 1){
1019
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
38 assert(0);
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
39 }
1329
1c8652b3795a inline asm review
thomask
parents: 1044
diff changeset
40 if(c[1] != 2){
1019
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
41 assert(0);
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
42 }
1329
1c8652b3795a inline asm review
thomask
parents: 1044
diff changeset
43 if(c[2] != 3){
1019
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
44 assert(0);
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
45 }
1329
1c8652b3795a inline asm review
thomask
parents: 1044
diff changeset
46 if(c[3] != 4){
1019
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
47 assert(0);
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
48 }
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
49 if(c[4] != 5){
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
50 assert(0);
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
51 }
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
52 if(c[5] != 6){
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
53 assert(0);
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
54 }
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
55 if(c[6] != 7){
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
56 assert(0);
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
57 }
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
58 if(c[7] != 8){
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
59 assert(0);
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
60 }
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
61
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
62 return 0;
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
63 }
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
64 }else{
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
65 pragma(msg, "DSTRESS{XFAIL}: no inline ASM support");
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
66 static assert(0);
d9dbc4d0698f inline ASM review
thomask
parents:
diff changeset
67 }