annotate run/a/asm_psrld_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_psrld_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 const long[2] B = [0x8FFF_FFFF_FFFF_FFFF, 1];
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
26 uint[4] c;
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
27
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
28 asm{
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
29 movdqu XMM0, A;
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
30 psrld XMM0, 1;
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
31 movdqu c, XMM0;
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
32 }
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
33
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
34 if(c[0] != (1 << 30)){
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
35 assert(0);
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
36 }
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
37 if(c[1] != ((1 << 30) | (1 << 7))){
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
38 assert(0);
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
39 }
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
40 if(c[2] != ((1 << 30) | (1 << 15))){
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
41 assert(0);
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
42 }
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
43 if(c[3] != ((1 << 30) | (1 << 22))){
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
44 assert(0);
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
45 }
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
46
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
47 return 0;
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
48 }
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
49 }else{
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
50 pragma(msg, "DSTRESS{XFAIL}: no inline ASM support");
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
51 static assert(0);
7ee2442b6bf4 inline ASM review
thomask
parents:
diff changeset
52 }