annotate run/a/asm_div_02_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 251a3e0d98f7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
989
a468938b0160 inline ASM review
thomask
parents:
diff changeset
1 // $HeadURL$
a468938b0160 inline ASM review
thomask
parents:
diff changeset
2 // $Date$
a468938b0160 inline ASM review
thomask
parents:
diff changeset
3 // $Author$
a468938b0160 inline ASM review
thomask
parents:
diff changeset
4
a468938b0160 inline ASM review
thomask
parents:
diff changeset
5 module dstress.run.a.asm_div_02_B;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
6
1151
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1044
diff changeset
7 // __DSTRESS_TORTURE_BLOCK__ -fPIC
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1044
diff changeset
8
989
a468938b0160 inline ASM review
thomask
parents:
diff changeset
9 version(D_InlineAsm_X86){
a468938b0160 inline ASM review
thomask
parents:
diff changeset
10 version = runTest;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
11 }else version(D_InlineAsm_X86_64){
a468938b0160 inline ASM review
thomask
parents:
diff changeset
12 version = runTest;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
13 }
a468938b0160 inline ASM review
thomask
parents:
diff changeset
14
a468938b0160 inline ASM review
thomask
parents:
diff changeset
15 int main(){
a468938b0160 inline ASM review
thomask
parents:
diff changeset
16 version(runTest){
a468938b0160 inline ASM review
thomask
parents:
diff changeset
17 ushort y = 2;
1044
03c97933de98 inline ASM review
thomask
parents: 989
diff changeset
18
989
a468938b0160 inline ASM review
thomask
parents:
diff changeset
19 ushort a = 0x00_00u;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
20 ushort b = 0xFF_FFu;
1044
03c97933de98 inline ASM review
thomask
parents: 989
diff changeset
21
989
a468938b0160 inline ASM review
thomask
parents:
diff changeset
22 asm{
a468938b0160 inline ASM review
thomask
parents:
diff changeset
23 mov DX, a;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
24 mov AX, b;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
25 mov BX, y;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
26 div BX;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
27 mov a, AX;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
28 mov b, DX;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
29 }
a468938b0160 inline ASM review
thomask
parents:
diff changeset
30
a468938b0160 inline ASM review
thomask
parents:
diff changeset
31 if(a != 0x7F_FFu){
a468938b0160 inline ASM review
thomask
parents:
diff changeset
32 assert(0);
a468938b0160 inline ASM review
thomask
parents:
diff changeset
33 }
a468938b0160 inline ASM review
thomask
parents:
diff changeset
34 if(b != 0x1u){
a468938b0160 inline ASM review
thomask
parents:
diff changeset
35 assert(0);
a468938b0160 inline ASM review
thomask
parents:
diff changeset
36 }
1044
03c97933de98 inline ASM review
thomask
parents: 989
diff changeset
37
989
a468938b0160 inline ASM review
thomask
parents:
diff changeset
38 a = 0x00_00u;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
39 b = 0xFF_FEu;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
40
a468938b0160 inline ASM review
thomask
parents:
diff changeset
41 asm{
a468938b0160 inline ASM review
thomask
parents:
diff changeset
42 mov DX, a;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
43 mov AX, b;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
44 mov BX, y;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
45 div BX;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
46 mov a, AX;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
47 mov b, DX;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
48 }
a468938b0160 inline ASM review
thomask
parents:
diff changeset
49
a468938b0160 inline ASM review
thomask
parents:
diff changeset
50 if(a != 0x7F_FFu){
a468938b0160 inline ASM review
thomask
parents:
diff changeset
51 assert(0);
a468938b0160 inline ASM review
thomask
parents:
diff changeset
52 }
a468938b0160 inline ASM review
thomask
parents:
diff changeset
53 if(b != 0x0u){
a468938b0160 inline ASM review
thomask
parents:
diff changeset
54 assert(0);
a468938b0160 inline ASM review
thomask
parents:
diff changeset
55 }
1044
03c97933de98 inline ASM review
thomask
parents: 989
diff changeset
56
989
a468938b0160 inline ASM review
thomask
parents:
diff changeset
57 return 0;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
58 }else{
1395
251a3e0d98f7 div. inline asm fixes
thomask
parents: 1386
diff changeset
59 pragma(msg, "DSTRESS{XFAIL}: no inline ASM support");
989
a468938b0160 inline ASM review
thomask
parents:
diff changeset
60 static assert(0);
a468938b0160 inline ASM review
thomask
parents:
diff changeset
61 }
a468938b0160 inline ASM review
thomask
parents:
diff changeset
62 }