annotate run/a/asm_maxpd_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 b3d4452d48ac
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
978
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
1 // $HeadURL$
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
2 // $Date$
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
3 // $Author$
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
4
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
5 module dstress.run.a.asm_maxpd_01_A;
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
6
1002
a7310ceac844 inline ASM review
thomask
parents: 978
diff changeset
7 version(D_InlineAsm_X86){
a7310ceac844 inline ASM review
thomask
parents: 978
diff changeset
8 version = runTest;
a7310ceac844 inline ASM review
thomask
parents: 978
diff changeset
9 }else version(D_InlineAsm_X86_64){
a7310ceac844 inline ASM review
thomask
parents: 978
diff changeset
10 version = runTest;
a7310ceac844 inline ASM review
thomask
parents: 978
diff changeset
11 }
a7310ceac844 inline ASM review
thomask
parents: 978
diff changeset
12
a7310ceac844 inline ASM review
thomask
parents: 978
diff changeset
13 version(runTest){
a7310ceac844 inline ASM review
thomask
parents: 978
diff changeset
14 import addon.cpuinfo;
1044
03c97933de98 inline ASM review
thomask
parents: 1002
diff changeset
15
1002
a7310ceac844 inline ASM review
thomask
parents: 978
diff changeset
16 int main(){
a7310ceac844 inline ASM review
thomask
parents: 978
diff changeset
17 haveSSE2!()();
a7310ceac844 inline ASM review
thomask
parents: 978
diff changeset
18
1264
b3d4452d48ac added DMD-0.177's results
thomask
parents: 1151
diff changeset
19 double* a = (new double[2]).ptr;
1084
91ff3e405be5 -fPIC fixes
thomask
parents: 1044
diff changeset
20 a[0] = 2.0;
91ff3e405be5 -fPIC fixes
thomask
parents: 1044
diff changeset
21 a[1] = 3.0;
91ff3e405be5 -fPIC fixes
thomask
parents: 1044
diff changeset
22
1264
b3d4452d48ac added DMD-0.177's results
thomask
parents: 1151
diff changeset
23 double* b = (new double[2]).ptr;
1084
91ff3e405be5 -fPIC fixes
thomask
parents: 1044
diff changeset
24 b[0] = 1.0;
91ff3e405be5 -fPIC fixes
thomask
parents: 1044
diff changeset
25 b[1] = 4.0;
1091
9dcac8d4e97f post DMD-0.163 review
thomask
parents: 1085
diff changeset
26
1264
b3d4452d48ac added DMD-0.177's results
thomask
parents: 1151
diff changeset
27 double* c = (new double[2]).ptr;
978
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
28
1151
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1125
diff changeset
29 static if(size_t.sizeof == 4){
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1125
diff changeset
30 asm{
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1125
diff changeset
31 mov EAX, a;
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1125
diff changeset
32 movupd XMM0, [EAX];
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1125
diff changeset
33 mov EAX, b;
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1125
diff changeset
34 movupd XMM1, [EAX];
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1125
diff changeset
35 maxpd XMM0, XMM1;
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1125
diff changeset
36 mov EAX, c;
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1125
diff changeset
37 movupd [EAX], XMM0;
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1125
diff changeset
38 }
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1125
diff changeset
39 }else static if(size_t.sizeof == 8){
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1125
diff changeset
40 asm{
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1125
diff changeset
41 mov RAX, a;
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1125
diff changeset
42 movupd XMM0, [RAX];
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1125
diff changeset
43 mov RAX, b;
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1125
diff changeset
44 movupd XMM1, [RAX];
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1125
diff changeset
45 maxpd XMM0, XMM1;
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1125
diff changeset
46 mov RAX, c;
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1125
diff changeset
47 movupd [RAX], XMM0;
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1125
diff changeset
48 }
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1125
diff changeset
49 }else{
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1125
diff changeset
50 static assert(0, "unhandled pointer size");
978
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
51 }
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
52
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
53 if(c[0] != 2.0){
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
54 assert(0);
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
55 }
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
56
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
57 if(c[1] != 4.0){
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
58 assert(0);
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
59 }
1044
03c97933de98 inline ASM review
thomask
parents: 1002
diff changeset
60
978
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
61 return 0;
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
62 }
1002
a7310ceac844 inline ASM review
thomask
parents: 978
diff changeset
63 }else{
a7310ceac844 inline ASM review
thomask
parents: 978
diff changeset
64 pragma(msg, "DSTRESS{XFAIL}: no inline ASM support");
a7310ceac844 inline ASM review
thomask
parents: 978
diff changeset
65 static assert(0);
978
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
66 }