annotate run/a/asm_cmova_02_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 7a397590d6e0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
988
052b82b4924c inline ASM review
thomask
parents:
diff changeset
1 // $HeadURL$
052b82b4924c inline ASM review
thomask
parents:
diff changeset
2 // $Date$
052b82b4924c inline ASM review
thomask
parents:
diff changeset
3 // $Author$
1044
03c97933de98 inline ASM review
thomask
parents: 989
diff changeset
4
988
052b82b4924c inline ASM review
thomask
parents:
diff changeset
5 module dstress.run.a.asm_cmova_02_A;
052b82b4924c inline ASM review
thomask
parents:
diff changeset
6
1151
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1070
diff changeset
7 // __DSTRESS_TORTURE_BLOCK__ -fPIC
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1070
diff changeset
8
988
052b82b4924c inline ASM review
thomask
parents:
diff changeset
9 version(D_InlineAsm_X86){
989
a468938b0160 inline ASM review
thomask
parents: 988
diff changeset
10 version = runTest;
988
052b82b4924c inline ASM review
thomask
parents:
diff changeset
11 }else version(D_InlineAsm_X86_64){
989
a468938b0160 inline ASM review
thomask
parents: 988
diff changeset
12 version = runTest;
988
052b82b4924c inline ASM review
thomask
parents:
diff changeset
13 }
052b82b4924c inline ASM review
thomask
parents:
diff changeset
14
1070
3c1400d94f60 pre 0.162 review
thomask
parents: 1044
diff changeset
15 version(runTest){
3c1400d94f60 pre 0.162 review
thomask
parents: 1044
diff changeset
16 int main(){
988
052b82b4924c inline ASM review
thomask
parents:
diff changeset
17 uint a;
052b82b4924c inline ASM review
thomask
parents:
diff changeset
18 asm{
052b82b4924c inline ASM review
thomask
parents:
diff changeset
19 mov ECX, 0xAB_CD_EF_01;
052b82b4924c inline ASM review
thomask
parents:
diff changeset
20 mov EDX, 0x12_34_56_FE;
052b82b4924c inline ASM review
thomask
parents:
diff changeset
21 mov AL, 1;
052b82b4924c inline ASM review
thomask
parents:
diff changeset
22 mov BL, 2;
052b82b4924c inline ASM review
thomask
parents:
diff changeset
23 cmp AL, BL;
052b82b4924c inline ASM review
thomask
parents:
diff changeset
24 cmova ECX, EDX;
052b82b4924c inline ASM review
thomask
parents:
diff changeset
25 mov a, ECX;
052b82b4924c inline ASM review
thomask
parents:
diff changeset
26 }
052b82b4924c inline ASM review
thomask
parents:
diff changeset
27
052b82b4924c inline ASM review
thomask
parents:
diff changeset
28 if(a != 0xAB_CD_EF_01){
052b82b4924c inline ASM review
thomask
parents:
diff changeset
29 assert(0);
052b82b4924c inline ASM review
thomask
parents:
diff changeset
30 }
052b82b4924c inline ASM review
thomask
parents:
diff changeset
31
052b82b4924c inline ASM review
thomask
parents:
diff changeset
32 asm{
052b82b4924c inline ASM review
thomask
parents:
diff changeset
33 mov ECX, 0xAB_CD_EF_01;
052b82b4924c inline ASM review
thomask
parents:
diff changeset
34 mov AL, 2;
052b82b4924c inline ASM review
thomask
parents:
diff changeset
35 mov BL, 1;
052b82b4924c inline ASM review
thomask
parents:
diff changeset
36 cmp AL, BL;
052b82b4924c inline ASM review
thomask
parents:
diff changeset
37 cmova ECX, EDX;
052b82b4924c inline ASM review
thomask
parents:
diff changeset
38 mov a, ECX;
052b82b4924c inline ASM review
thomask
parents:
diff changeset
39 }
052b82b4924c inline ASM review
thomask
parents:
diff changeset
40 if(a != 0x12_34_56_FE){
052b82b4924c inline ASM review
thomask
parents:
diff changeset
41 assert(0);
052b82b4924c inline ASM review
thomask
parents:
diff changeset
42 }
1044
03c97933de98 inline ASM review
thomask
parents: 989
diff changeset
43
988
052b82b4924c inline ASM review
thomask
parents:
diff changeset
44 return 0;
052b82b4924c inline ASM review
thomask
parents:
diff changeset
45 error:
052b82b4924c inline ASM review
thomask
parents:
diff changeset
46 assert(0);
052b82b4924c inline ASM review
thomask
parents:
diff changeset
47 }
1070
3c1400d94f60 pre 0.162 review
thomask
parents: 1044
diff changeset
48 }else{
1386
7a397590d6e0 64-bit fixes
thomask
parents: 1151
diff changeset
49 pragma(msg, "DSTRESS{XFAIL}: no inline ASM support");
1070
3c1400d94f60 pre 0.162 review
thomask
parents: 1044
diff changeset
50 static assert(0);
988
052b82b4924c inline ASM review
thomask
parents:
diff changeset
51 }