annotate run/a/asm_bx_02.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
638
61d8b062bf80 added some basic integer asm operations and registers tests
thomask
parents:
diff changeset
1 // $HeadURL$
61d8b062bf80 added some basic integer asm operations and registers tests
thomask
parents:
diff changeset
2 // $Date$
61d8b062bf80 added some basic integer asm operations and registers tests
thomask
parents:
diff changeset
3 // $Author$
61d8b062bf80 added some basic integer asm operations and registers tests
thomask
parents:
diff changeset
4
61d8b062bf80 added some basic integer asm operations and registers tests
thomask
parents:
diff changeset
5 module dstress.run.a.asm_bx_02;
61d8b062bf80 added some basic integer asm operations and registers tests
thomask
parents:
diff changeset
6
1151
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1063
diff changeset
7 // __DSTRESS_TORTURE_BLOCK__ -fPIC
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1063
diff changeset
8
1063
4c41b782a14e pre 0.162 review
thomask
parents: 1044
diff changeset
9 version(D_InlineAsm_X86){
4c41b782a14e pre 0.162 review
thomask
parents: 1044
diff changeset
10 version = runTest;
4c41b782a14e pre 0.162 review
thomask
parents: 1044
diff changeset
11 }else version(D_InlineAsm_X86_64){
4c41b782a14e pre 0.162 review
thomask
parents: 1044
diff changeset
12 version = runTest;
4c41b782a14e pre 0.162 review
thomask
parents: 1044
diff changeset
13 }
4c41b782a14e pre 0.162 review
thomask
parents: 1044
diff changeset
14
4c41b782a14e pre 0.162 review
thomask
parents: 1044
diff changeset
15 version(runTest){
4c41b782a14e pre 0.162 review
thomask
parents: 1044
diff changeset
16 int main(){
638
61d8b062bf80 added some basic integer asm operations and registers tests
thomask
parents:
diff changeset
17 byte a = 0;
61d8b062bf80 added some basic integer asm operations and registers tests
thomask
parents:
diff changeset
18 byte b = 0;
61d8b062bf80 added some basic integer asm operations and registers tests
thomask
parents:
diff changeset
19 short s=0x12_34;
1044
03c97933de98 inline ASM review
thomask
parents: 638
diff changeset
20
638
61d8b062bf80 added some basic integer asm operations and registers tests
thomask
parents:
diff changeset
21 asm{
61d8b062bf80 added some basic integer asm operations and registers tests
thomask
parents:
diff changeset
22 mov BX, s;
61d8b062bf80 added some basic integer asm operations and registers tests
thomask
parents:
diff changeset
23 mov a, BH;
61d8b062bf80 added some basic integer asm operations and registers tests
thomask
parents:
diff changeset
24 mov b, BL;
61d8b062bf80 added some basic integer asm operations and registers tests
thomask
parents:
diff changeset
25 }
1044
03c97933de98 inline ASM review
thomask
parents: 638
diff changeset
26
1063
4c41b782a14e pre 0.162 review
thomask
parents: 1044
diff changeset
27 if(a != 0x12){
4c41b782a14e pre 0.162 review
thomask
parents: 1044
diff changeset
28 assert(0);
4c41b782a14e pre 0.162 review
thomask
parents: 1044
diff changeset
29 }
4c41b782a14e pre 0.162 review
thomask
parents: 1044
diff changeset
30 if(b != 0x34){
4c41b782a14e pre 0.162 review
thomask
parents: 1044
diff changeset
31 assert(0);
4c41b782a14e pre 0.162 review
thomask
parents: 1044
diff changeset
32 }
1044
03c97933de98 inline ASM review
thomask
parents: 638
diff changeset
33
638
61d8b062bf80 added some basic integer asm operations and registers tests
thomask
parents:
diff changeset
34 return 0;
61d8b062bf80 added some basic integer asm operations and registers tests
thomask
parents:
diff changeset
35 }
1063
4c41b782a14e pre 0.162 review
thomask
parents: 1044
diff changeset
36 }else{
1386
7a397590d6e0 64-bit fixes
thomask
parents: 1151
diff changeset
37 pragma(msg, "DSTRESS{XFAIL}: no inline ASM support");
1063
4c41b782a14e pre 0.162 review
thomask
parents: 1044
diff changeset
38 static assert(0);
4c41b782a14e pre 0.162 review
thomask
parents: 1044
diff changeset
39 }