annotate run/a/asm_shrd_01_D.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 7a397590d6e0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1046
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
1 // $HeadURL$
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
2 // $Date$
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
3 // $Author$
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
4
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
5 module dstress.run.a.asm_shrd_01_D;
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
6
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
7 version(D_InlineAsm_X86){
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
8 version = runTest;
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
9 }else version(D_InlineAsm_X86_64){
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
10 version = runTest;
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
11 }
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
12
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
13 version(runTest){
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
14 int main(){
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
15
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
16 uint a = 0b0000_0000__1000_0000__0000_0000__0000_0000;
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
17 uint b = 0b1000_0000__0000_0000__0000_0000__0000_0101;
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
18
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
19 asm{
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
20 mov EAX, a;
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
21 mov EBX, b;
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
22 shrd EAX, EBX, 3;
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
23 mov a, EAX;
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
24 mov b, EBX;
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
25 }
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
26
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
27 if(a != 0b1010_0000__0001_0000__0000_0000__0000_0000){
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
28 assert(0);
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
29 }
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
30 if(b != 0b1000_0000__0000_0000__0000_0000__0000_0101){
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
31 assert(0);
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
32 }
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
33
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
34 return 0;
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
35 }
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
36 }else{
1386
7a397590d6e0 64-bit fixes
thomask
parents: 1046
diff changeset
37 pragma(msg, "DSTRESS{XFAIL}: no inline ASM support");
1046
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
38 static assert(0);
01fb56fb4971 inline ASM review
thomask
parents:
diff changeset
39 }