annotate run/a/asm_psrad_01_B.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 7ee2442b6bf4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1027
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
1 // $HeadURL$
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
2 // $Date$
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
3 // $Author$
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
4
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
5 module dstress.run.a.asm_psrad_01_B;
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
6
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
7 version(D_InlineAsm_X86){
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
8 version = runTest;
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
9 }else version(D_InlineAsm_X86_64){
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
10 version = runTest;
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
11 }
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
12
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
13 version(runTest){
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
14 import addon.cpuinfo;
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
15
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
16 int main(){
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
17 haveSSE2!()();
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
18
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
19 const uint[4] A = [
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
20 (1 << 31) | 1,
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
21 (1 << 31) | (1 << 8),
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
22 (1 << 31) | (1 << 16),
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
23 (1 << 31) | (1 << 23)];
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
24
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
25 uint[4] c;
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
26
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
27 asm{
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
28 movdqu XMM0, A;
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
29 psrad XMM0, 1;
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
30 movdqu c, XMM0;
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
31 }
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
32
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
33 if(c[0] != (1 << 30)){
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
34 assert(0);
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
35 }
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
36 if(c[1] != ((1 << 30) | (1 << 7))){
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
37 assert(0);
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
38 }
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
39 if(c[2] != ((1 << 30) | (1 << 15))){
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
40 assert(0);
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
41 }
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
42 if(c[3] != ((1 << 30) | (1 << 22))){
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
43 assert(0);
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
44 }
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
45
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
46 return 0;
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
47 }
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
48 }else{
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
49 pragma(msg, "DSTRESS{XFAIL}: no inline ASM support");
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
50 static assert(0);
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
51 }