annotate run/a/asm_fstsw_01.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
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_fstsw_01;
9b960ca15583 extended^ iasm tests (mostly FPU related)
thomask
parents:
diff changeset
6
992
4c6602a06f32 inline ASM review
thomask
parents: 976
diff changeset
7 version(D_InlineAsm_X86){
4c6602a06f32 inline ASM review
thomask
parents: 976
diff changeset
8 version = runTest;
4c6602a06f32 inline ASM review
thomask
parents: 976
diff changeset
9 }else version(D_InlineAsm_X86_64){
4c6602a06f32 inline ASM review
thomask
parents: 976
diff changeset
10 version = runTest;
4c6602a06f32 inline ASM review
thomask
parents: 976
diff changeset
11 }
4c6602a06f32 inline ASM review
thomask
parents: 976
diff changeset
12
4c6602a06f32 inline ASM review
thomask
parents: 976
diff changeset
13 version(runTest){
4c6602a06f32 inline ASM review
thomask
parents: 976
diff changeset
14 import addon.cpuinfo;
4c6602a06f32 inline ASM review
thomask
parents: 976
diff changeset
15
4c6602a06f32 inline ASM review
thomask
parents: 976
diff changeset
16 int main(){
4c6602a06f32 inline ASM review
thomask
parents: 976
diff changeset
17 haveFPU!()();
4c6602a06f32 inline ASM review
thomask
parents: 976
diff changeset
18
976
4bc1d14d6851 extended SSE asm tests
thomask
parents: 856
diff changeset
19 short a;
4bc1d14d6851 extended SSE asm tests
thomask
parents: 856
diff changeset
20 int b;
4bc1d14d6851 extended SSE asm tests
thomask
parents: 856
diff changeset
21
699
9b960ca15583 extended^ iasm tests (mostly FPU related)
thomask
parents:
diff changeset
22 asm{
976
4bc1d14d6851 extended SSE asm tests
thomask
parents: 856
diff changeset
23 mov EAX, 0x1234_ABCD;
4bc1d14d6851 extended SSE asm tests
thomask
parents: 856
diff changeset
24 fstsw a;
4bc1d14d6851 extended SSE asm tests
thomask
parents: 856
diff changeset
25 fstsw AX;
4bc1d14d6851 extended SSE asm tests
thomask
parents: 856
diff changeset
26 mov b, EAX;
699
9b960ca15583 extended^ iasm tests (mostly FPU related)
thomask
parents:
diff changeset
27 }
976
4bc1d14d6851 extended SSE asm tests
thomask
parents: 856
diff changeset
28
4bc1d14d6851 extended SSE asm tests
thomask
parents: 856
diff changeset
29 if((b & 0xFFFF_0000) != 0x1234_0000){
4bc1d14d6851 extended SSE asm tests
thomask
parents: 856
diff changeset
30 assert(0);
4bc1d14d6851 extended SSE asm tests
thomask
parents: 856
diff changeset
31 }
4bc1d14d6851 extended SSE asm tests
thomask
parents: 856
diff changeset
32
4bc1d14d6851 extended SSE asm tests
thomask
parents: 856
diff changeset
33 if(a != (b & 0xFFFF)){
4bc1d14d6851 extended SSE asm tests
thomask
parents: 856
diff changeset
34 assert(0);
4bc1d14d6851 extended SSE asm tests
thomask
parents: 856
diff changeset
35 }
4bc1d14d6851 extended SSE asm tests
thomask
parents: 856
diff changeset
36
1044
03c97933de98 inline ASM review
thomask
parents: 992
diff changeset
37
699
9b960ca15583 extended^ iasm tests (mostly FPU related)
thomask
parents:
diff changeset
38 return 0;
9b960ca15583 extended^ iasm tests (mostly FPU related)
thomask
parents:
diff changeset
39 }
992
4c6602a06f32 inline ASM review
thomask
parents: 976
diff changeset
40 }else{
4c6602a06f32 inline ASM review
thomask
parents: 976
diff changeset
41 pragma(msg, "DSTRESS{XFAIL}: no inline ASM support");
4c6602a06f32 inline ASM review
thomask
parents: 976
diff changeset
42 static assert(0);
976
4bc1d14d6851 extended SSE asm tests
thomask
parents: 856
diff changeset
43 }