annotate run/a/asm_comisd_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
988
052b82b4924c inline ASM review
thomask
parents:
diff changeset
1 // $HeadURL$
052b82b4924c inline ASM review
thomask
parents:
diff changeset
2 // $Date$
052b82b4924c inline ASM review
thomask
parents:
diff changeset
3 // $Author$
1044
03c97933de98 inline ASM review
thomask
parents: 1028
diff changeset
4
988
052b82b4924c inline ASM review
thomask
parents:
diff changeset
5 module dstress.run.a.asm_comisd_01_A;
052b82b4924c inline ASM review
thomask
parents:
diff changeset
6
052b82b4924c inline ASM review
thomask
parents:
diff changeset
7 version(D_InlineAsm_X86){
989
a468938b0160 inline ASM review
thomask
parents: 988
diff changeset
8 version = runTest;
988
052b82b4924c inline ASM review
thomask
parents:
diff changeset
9 }else version(D_InlineAsm_X86_64){
989
a468938b0160 inline ASM review
thomask
parents: 988
diff changeset
10 version = runTest;
988
052b82b4924c inline ASM review
thomask
parents:
diff changeset
11 }
052b82b4924c inline ASM review
thomask
parents:
diff changeset
12
1070
3c1400d94f60 pre 0.162 review
thomask
parents: 1044
diff changeset
13 version(runTest){
3c1400d94f60 pre 0.162 review
thomask
parents: 1044
diff changeset
14 import addon.cpuinfo;
1091
9dcac8d4e97f post DMD-0.163 review
thomask
parents: 1070
diff changeset
15
1070
3c1400d94f60 pre 0.162 review
thomask
parents: 1044
diff changeset
16 int main(){
3c1400d94f60 pre 0.162 review
thomask
parents: 1044
diff changeset
17 haveSSE2!()();
1091
9dcac8d4e97f post DMD-0.163 review
thomask
parents: 1070
diff changeset
18
1268
93511f726375 partial review
thomask
parents: 1116
diff changeset
19 double* a = (new double[2]).ptr;
1329
1c8652b3795a inline asm review
thomask
parents: 1268
diff changeset
20 a[0] = 3.0;
1c8652b3795a inline asm review
thomask
parents: 1268
diff changeset
21 a[1] = 4.0;
1c8652b3795a inline asm review
thomask
parents: 1268
diff changeset
22
1091
9dcac8d4e97f post DMD-0.163 review
thomask
parents: 1070
diff changeset
23
1268
93511f726375 partial review
thomask
parents: 1116
diff changeset
24 double* b = (new double[2]).ptr;
1329
1c8652b3795a inline asm review
thomask
parents: 1268
diff changeset
25 b[0] = 3.0;
1c8652b3795a inline asm review
thomask
parents: 1268
diff changeset
26 b[1] = 5.0;
988
052b82b4924c inline ASM review
thomask
parents:
diff changeset
27
1268
93511f726375 partial review
thomask
parents: 1116
diff changeset
28 static if(size_t.sizeof == 4){
93511f726375 partial review
thomask
parents: 1116
diff changeset
29 asm{
93511f726375 partial review
thomask
parents: 1116
diff changeset
30 mov EAX, a;
93511f726375 partial review
thomask
parents: 1116
diff changeset
31 movupd XMM0, [EAX];
93511f726375 partial review
thomask
parents: 1116
diff changeset
32 mov EAX, b;
93511f726375 partial review
thomask
parents: 1116
diff changeset
33 movupd XMM1, [EAX];
93511f726375 partial review
thomask
parents: 1116
diff changeset
34 comisd XMM0, XMM1;
1329
1c8652b3795a inline asm review
thomask
parents: 1268
diff changeset
35 jnz error;
1268
93511f726375 partial review
thomask
parents: 1116
diff changeset
36 jp error;
93511f726375 partial review
thomask
parents: 1116
diff changeset
37 jc error;
93511f726375 partial review
thomask
parents: 1116
diff changeset
38 }
93511f726375 partial review
thomask
parents: 1116
diff changeset
39 }else static if(size_t.sizeof == 8){
93511f726375 partial review
thomask
parents: 1116
diff changeset
40 asm{
93511f726375 partial review
thomask
parents: 1116
diff changeset
41 mov RAX, a;
93511f726375 partial review
thomask
parents: 1116
diff changeset
42 movupd XMM0, [RAX];
93511f726375 partial review
thomask
parents: 1116
diff changeset
43 mov RAX, b;
93511f726375 partial review
thomask
parents: 1116
diff changeset
44 movupd XMM1, [RAX];
93511f726375 partial review
thomask
parents: 1116
diff changeset
45 comisd XMM0, XMM1;
1329
1c8652b3795a inline asm review
thomask
parents: 1268
diff changeset
46 jnz error;
1268
93511f726375 partial review
thomask
parents: 1116
diff changeset
47 jp error;
93511f726375 partial review
thomask
parents: 1116
diff changeset
48 jc error;
93511f726375 partial review
thomask
parents: 1116
diff changeset
49 }
93511f726375 partial review
thomask
parents: 1116
diff changeset
50 }else{
93511f726375 partial review
thomask
parents: 1116
diff changeset
51 static assert(0, "unhandled pointer size");
988
052b82b4924c inline ASM review
thomask
parents:
diff changeset
52 }
1044
03c97933de98 inline ASM review
thomask
parents: 1028
diff changeset
53
988
052b82b4924c inline ASM review
thomask
parents:
diff changeset
54
052b82b4924c inline ASM review
thomask
parents:
diff changeset
55 return 0;
052b82b4924c inline ASM review
thomask
parents:
diff changeset
56 error:
052b82b4924c inline ASM review
thomask
parents:
diff changeset
57 assert(0);
052b82b4924c inline ASM review
thomask
parents:
diff changeset
58 }
1070
3c1400d94f60 pre 0.162 review
thomask
parents: 1044
diff changeset
59 }else{
3c1400d94f60 pre 0.162 review
thomask
parents: 1044
diff changeset
60 pragma(msg, "DSTRESS{XFAIL}: no inline ASM support");
3c1400d94f60 pre 0.162 review
thomask
parents: 1044
diff changeset
61 static assert(0);
988
052b82b4924c inline ASM review
thomask
parents:
diff changeset
62 }