annotate run/a/asm_cmpxchg_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 2a1a6610f7ad
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
856
7b2c5a101190 meta data maintenance
thomask
parents: 699
diff changeset
1 // $HeadURL$
7b2c5a101190 meta data maintenance
thomask
parents: 699
diff changeset
2 // $Date$
7b2c5a101190 meta data maintenance
thomask
parents: 699
diff changeset
3 // $Author$
699
9b960ca15583 extended^ iasm tests (mostly FPU related)
thomask
parents:
diff changeset
4
9b960ca15583 extended^ iasm tests (mostly FPU related)
thomask
parents:
diff changeset
5 module dstress.run.a.asm_cmpxchg_01_B;
9b960ca15583 extended^ iasm tests (mostly FPU related)
thomask
parents:
diff changeset
6
1151
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1116
diff changeset
7 // __DSTRESS_TORTURE_BLOCK__ -fPIC
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1116
diff changeset
8
988
052b82b4924c inline ASM review
thomask
parents: 856
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: 856
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: 856
diff changeset
13 }
052b82b4924c inline ASM review
thomask
parents: 856
diff changeset
14
1116
5aa513911316 partial -fPIC fixes
thomask
parents: 1044
diff changeset
15 version(runTest){
5aa513911316 partial -fPIC fixes
thomask
parents: 1044
diff changeset
16 int main(){
699
9b960ca15583 extended^ iasm tests (mostly FPU related)
thomask
parents:
diff changeset
17 ushort a = 0;
9b960ca15583 extended^ iasm tests (mostly FPU related)
thomask
parents:
diff changeset
18 ushort c = 3;
9b960ca15583 extended^ iasm tests (mostly FPU related)
thomask
parents:
diff changeset
19 asm{
9b960ca15583 extended^ iasm tests (mostly FPU related)
thomask
parents:
diff changeset
20 mov AX, 1;
9b960ca15583 extended^ iasm tests (mostly FPU related)
thomask
parents:
diff changeset
21 mov BX, 2;
9b960ca15583 extended^ iasm tests (mostly FPU related)
thomask
parents:
diff changeset
22 cmpxchg c, BX;
9b960ca15583 extended^ iasm tests (mostly FPU related)
thomask
parents:
diff changeset
23 mov a, AX;
9b960ca15583 extended^ iasm tests (mostly FPU related)
thomask
parents:
diff changeset
24 }
1044
03c97933de98 inline ASM review
thomask
parents: 989
diff changeset
25
988
052b82b4924c inline ASM review
thomask
parents: 856
diff changeset
26 if(c != 3){
052b82b4924c inline ASM review
thomask
parents: 856
diff changeset
27 assert(0);
052b82b4924c inline ASM review
thomask
parents: 856
diff changeset
28 }
052b82b4924c inline ASM review
thomask
parents: 856
diff changeset
29 if(a != 3){
052b82b4924c inline ASM review
thomask
parents: 856
diff changeset
30 assert(0);
052b82b4924c inline ASM review
thomask
parents: 856
diff changeset
31 }
1044
03c97933de98 inline ASM review
thomask
parents: 989
diff changeset
32
699
9b960ca15583 extended^ iasm tests (mostly FPU related)
thomask
parents:
diff changeset
33 a = 0;
9b960ca15583 extended^ iasm tests (mostly FPU related)
thomask
parents:
diff changeset
34 c = 3;
1044
03c97933de98 inline ASM review
thomask
parents: 989
diff changeset
35
699
9b960ca15583 extended^ iasm tests (mostly FPU related)
thomask
parents:
diff changeset
36 asm{
9b960ca15583 extended^ iasm tests (mostly FPU related)
thomask
parents:
diff changeset
37 mov AX, 3;
9b960ca15583 extended^ iasm tests (mostly FPU related)
thomask
parents:
diff changeset
38 mov BX, 2;
9b960ca15583 extended^ iasm tests (mostly FPU related)
thomask
parents:
diff changeset
39 cmpxchg c, BX;
9b960ca15583 extended^ iasm tests (mostly FPU related)
thomask
parents:
diff changeset
40 mov a, AX;
9b960ca15583 extended^ iasm tests (mostly FPU related)
thomask
parents:
diff changeset
41 }
1044
03c97933de98 inline ASM review
thomask
parents: 989
diff changeset
42
988
052b82b4924c inline ASM review
thomask
parents: 856
diff changeset
43 if(c != 2){
052b82b4924c inline ASM review
thomask
parents: 856
diff changeset
44 assert(0);
052b82b4924c inline ASM review
thomask
parents: 856
diff changeset
45 }
052b82b4924c inline ASM review
thomask
parents: 856
diff changeset
46 if(a != 3){
052b82b4924c inline ASM review
thomask
parents: 856
diff changeset
47 assert(0);
052b82b4924c inline ASM review
thomask
parents: 856
diff changeset
48 }
1044
03c97933de98 inline ASM review
thomask
parents: 989
diff changeset
49
699
9b960ca15583 extended^ iasm tests (mostly FPU related)
thomask
parents:
diff changeset
50 return 0;
9b960ca15583 extended^ iasm tests (mostly FPU related)
thomask
parents:
diff changeset
51 }
1116
5aa513911316 partial -fPIC fixes
thomask
parents: 1044
diff changeset
52 }else{
5aa513911316 partial -fPIC fixes
thomask
parents: 1044
diff changeset
53 pragma(msg, "DSTRESS{XFAIL}: no inline ASM support");
5aa513911316 partial -fPIC fixes
thomask
parents: 1044
diff changeset
54 static assert(0);
988
052b82b4924c inline ASM review
thomask
parents: 856
diff changeset
55 }