annotate run/a/asm_idiv_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 03c97933de98
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
640
1fc8a80e4599 * added conditional jump tests
thomask
parents:
diff changeset
1 // $HeadURL$
1fc8a80e4599 * added conditional jump tests
thomask
parents:
diff changeset
2 // $Date$
1fc8a80e4599 * added conditional jump tests
thomask
parents:
diff changeset
3 // $Author$
1fc8a80e4599 * added conditional jump tests
thomask
parents:
diff changeset
4
1fc8a80e4599 * added conditional jump tests
thomask
parents:
diff changeset
5 module dstress.run.a.asm_idiv_01_A;
1fc8a80e4599 * added conditional jump tests
thomask
parents:
diff changeset
6
993
861fe190f7ef inline ASM review
thomask
parents: 640
diff changeset
7 version(D_InlineAsm_X86){
861fe190f7ef inline ASM review
thomask
parents: 640
diff changeset
8 version = runTest;
861fe190f7ef inline ASM review
thomask
parents: 640
diff changeset
9 }else version(D_InlineAsm_X86_64){
861fe190f7ef inline ASM review
thomask
parents: 640
diff changeset
10 version = runTest;
861fe190f7ef inline ASM review
thomask
parents: 640
diff changeset
11 }
861fe190f7ef inline ASM review
thomask
parents: 640
diff changeset
12
861fe190f7ef inline ASM review
thomask
parents: 640
diff changeset
13 version(runTest){
861fe190f7ef inline ASM review
thomask
parents: 640
diff changeset
14 import addon.cpuinfo;
861fe190f7ef inline ASM review
thomask
parents: 640
diff changeset
15
861fe190f7ef inline ASM review
thomask
parents: 640
diff changeset
16 int main(){
640
1fc8a80e4599 * added conditional jump tests
thomask
parents:
diff changeset
17 byte y = 2;
1044
03c97933de98 inline ASM review
thomask
parents: 993
diff changeset
18
993
861fe190f7ef inline ASM review
thomask
parents: 640
diff changeset
19 ushort a = 0x00_81;
1044
03c97933de98 inline ASM review
thomask
parents: 993
diff changeset
20
640
1fc8a80e4599 * added conditional jump tests
thomask
parents:
diff changeset
21 asm{
993
861fe190f7ef inline ASM review
thomask
parents: 640
diff changeset
22 mov AX, a;
640
1fc8a80e4599 * added conditional jump tests
thomask
parents:
diff changeset
23 idiv y;
993
861fe190f7ef inline ASM review
thomask
parents: 640
diff changeset
24 mov a, AX;
640
1fc8a80e4599 * added conditional jump tests
thomask
parents:
diff changeset
25 }
993
861fe190f7ef inline ASM review
thomask
parents: 640
diff changeset
26 if(a != 0x0140){
861fe190f7ef inline ASM review
thomask
parents: 640
diff changeset
27 assert(0);
861fe190f7ef inline ASM review
thomask
parents: 640
diff changeset
28 }
1044
03c97933de98 inline ASM review
thomask
parents: 993
diff changeset
29
993
861fe190f7ef inline ASM review
thomask
parents: 640
diff changeset
30 a = 0x00_80;
640
1fc8a80e4599 * added conditional jump tests
thomask
parents:
diff changeset
31
1fc8a80e4599 * added conditional jump tests
thomask
parents:
diff changeset
32 asm{
993
861fe190f7ef inline ASM review
thomask
parents: 640
diff changeset
33 mov AX, a;
640
1fc8a80e4599 * added conditional jump tests
thomask
parents:
diff changeset
34 idiv y;
993
861fe190f7ef inline ASM review
thomask
parents: 640
diff changeset
35 mov a, AX;
640
1fc8a80e4599 * added conditional jump tests
thomask
parents:
diff changeset
36 }
1044
03c97933de98 inline ASM review
thomask
parents: 993
diff changeset
37
993
861fe190f7ef inline ASM review
thomask
parents: 640
diff changeset
38 if(a != 0x0040){
861fe190f7ef inline ASM review
thomask
parents: 640
diff changeset
39 assert(0);
861fe190f7ef inline ASM review
thomask
parents: 640
diff changeset
40 }
1044
03c97933de98 inline ASM review
thomask
parents: 993
diff changeset
41
640
1fc8a80e4599 * added conditional jump tests
thomask
parents:
diff changeset
42 return 0;
1fc8a80e4599 * added conditional jump tests
thomask
parents:
diff changeset
43 }
993
861fe190f7ef inline ASM review
thomask
parents: 640
diff changeset
44 }else{
861fe190f7ef inline ASM review
thomask
parents: 640
diff changeset
45 pragma(msg, "DSTRESS{XFAIL}: no inline ASM support");
861fe190f7ef inline ASM review
thomask
parents: 640
diff changeset
46 static assert(0);
861fe190f7ef inline ASM review
thomask
parents: 640
diff changeset
47 }