annotate run/a/asm_cvtpd2dq_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
976
4bc1d14d6851 extended SSE asm tests
thomask
parents:
diff changeset
1 // $HeadURL$
4bc1d14d6851 extended SSE asm tests
thomask
parents:
diff changeset
2 // $Date$
4bc1d14d6851 extended SSE asm tests
thomask
parents:
diff changeset
3 // $Author$
4bc1d14d6851 extended SSE asm tests
thomask
parents:
diff changeset
4
4bc1d14d6851 extended SSE asm tests
thomask
parents:
diff changeset
5 module dstress.run.a.asm_cvtpd2dq_01_A;
4bc1d14d6851 extended SSE asm tests
thomask
parents:
diff changeset
6
1083
8d76f113a70c fPIC fixes
thomask
parents: 976
diff changeset
7 version(D_InlineAsm_X86){
8d76f113a70c fPIC fixes
thomask
parents: 976
diff changeset
8 version = runTest;
8d76f113a70c fPIC fixes
thomask
parents: 976
diff changeset
9 }else version(D_InlineAsm_X86_64){
8d76f113a70c fPIC fixes
thomask
parents: 976
diff changeset
10 version = runTest;
8d76f113a70c fPIC fixes
thomask
parents: 976
diff changeset
11 }
8d76f113a70c fPIC fixes
thomask
parents: 976
diff changeset
12
8d76f113a70c fPIC fixes
thomask
parents: 976
diff changeset
13 version(runTest){
8d76f113a70c fPIC fixes
thomask
parents: 976
diff changeset
14 import addon.cpuinfo;
1091
9dcac8d4e97f post DMD-0.163 review
thomask
parents: 1085
diff changeset
15
1083
8d76f113a70c fPIC fixes
thomask
parents: 976
diff changeset
16 int main(){
8d76f113a70c fPIC fixes
thomask
parents: 976
diff changeset
17 haveSSE2!()();
8d76f113a70c fPIC fixes
thomask
parents: 976
diff changeset
18
1264
b3d4452d48ac added DMD-0.177's results
thomask
parents: 1151
diff changeset
19 double* a = (new double[2]).ptr;
1083
8d76f113a70c fPIC fixes
thomask
parents: 976
diff changeset
20 a[0] = -2.0;
8d76f113a70c fPIC fixes
thomask
parents: 976
diff changeset
21 a[1] = 4.0;
8d76f113a70c fPIC fixes
thomask
parents: 976
diff changeset
22
1264
b3d4452d48ac added DMD-0.177's results
thomask
parents: 1151
diff changeset
23 int* b = (new int[4]).ptr;
976
4bc1d14d6851 extended SSE asm tests
thomask
parents:
diff changeset
24
1151
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1116
diff changeset
25 static if(size_t.sizeof == 4){
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1116
diff changeset
26 asm{
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1116
diff changeset
27 mov EAX, a;
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1116
diff changeset
28 movdqu XMM0, [EAX];
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1116
diff changeset
29 cvtpd2dq XMM1, XMM0;
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1116
diff changeset
30 mov EAX, b;
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1116
diff changeset
31 movdqu [EAX], XMM1;
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1116
diff changeset
32 }
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1116
diff changeset
33 }else static if(size_t.sizeof == 8){
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1116
diff changeset
34 asm{
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1116
diff changeset
35 mov RAX, a;
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1116
diff changeset
36 movdqu XMM0, [RAX];
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1116
diff changeset
37 cvtpd2dq XMM1, XMM0;
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1116
diff changeset
38 mov RAX, b;
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1116
diff changeset
39 movdqu [RAX], XMM1;
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1116
diff changeset
40 }
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1116
diff changeset
41 }else{
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1116
diff changeset
42 static assert(0, "unhandled pointer size");
976
4bc1d14d6851 extended SSE asm tests
thomask
parents:
diff changeset
43 }
4bc1d14d6851 extended SSE asm tests
thomask
parents:
diff changeset
44
4bc1d14d6851 extended SSE asm tests
thomask
parents:
diff changeset
45 if(b[0] != -2){
4bc1d14d6851 extended SSE asm tests
thomask
parents:
diff changeset
46 assert(0);
4bc1d14d6851 extended SSE asm tests
thomask
parents:
diff changeset
47 }
4bc1d14d6851 extended SSE asm tests
thomask
parents:
diff changeset
48 if(b[1] != 4){
4bc1d14d6851 extended SSE asm tests
thomask
parents:
diff changeset
49 assert(0);
4bc1d14d6851 extended SSE asm tests
thomask
parents:
diff changeset
50 }
4bc1d14d6851 extended SSE asm tests
thomask
parents:
diff changeset
51 if(b[2] != 0){
4bc1d14d6851 extended SSE asm tests
thomask
parents:
diff changeset
52 assert(0);
4bc1d14d6851 extended SSE asm tests
thomask
parents:
diff changeset
53 }
4bc1d14d6851 extended SSE asm tests
thomask
parents:
diff changeset
54 if(b[3] != 0){
4bc1d14d6851 extended SSE asm tests
thomask
parents:
diff changeset
55 assert(0);
4bc1d14d6851 extended SSE asm tests
thomask
parents:
diff changeset
56 }
4bc1d14d6851 extended SSE asm tests
thomask
parents:
diff changeset
57
4bc1d14d6851 extended SSE asm tests
thomask
parents:
diff changeset
58 return 0;
4bc1d14d6851 extended SSE asm tests
thomask
parents:
diff changeset
59 }
1083
8d76f113a70c fPIC fixes
thomask
parents: 976
diff changeset
60 }else{
8d76f113a70c fPIC fixes
thomask
parents: 976
diff changeset
61 pragma(msg, "DSTRESS{XFAIL}: no inline ASM support");
8d76f113a70c fPIC fixes
thomask
parents: 976
diff changeset
62 static assert(0);
976
4bc1d14d6851 extended SSE asm tests
thomask
parents:
diff changeset
63 }