annotate run/a/asm_ficomp_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 03c97933de98
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
856
7b2c5a101190 meta data maintenance
thomask
parents: 715
diff changeset
1 // $HeadURL$
7b2c5a101190 meta data maintenance
thomask
parents: 715
diff changeset
2 // $Date$
7b2c5a101190 meta data maintenance
thomask
parents: 715
diff changeset
3 // $Author$
715
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
4
990
15b0469145fb inline ASM review
thomask
parents: 989
diff changeset
5 module dstress.run.a.asm_ficomp_01_B;
715
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
6
990
15b0469145fb inline ASM review
thomask
parents: 989
diff changeset
7 version(D_InlineAsm_X86){
15b0469145fb inline ASM review
thomask
parents: 989
diff changeset
8 version = runTest;
15b0469145fb inline ASM review
thomask
parents: 989
diff changeset
9 }else version(D_InlineAsm_X86_64){
15b0469145fb inline ASM review
thomask
parents: 989
diff changeset
10 version = runTest;
15b0469145fb inline ASM review
thomask
parents: 989
diff changeset
11 }
715
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
12
990
15b0469145fb inline ASM review
thomask
parents: 989
diff changeset
13 version(runTest){
15b0469145fb inline ASM review
thomask
parents: 989
diff changeset
14 import addon.cpuinfo;
15b0469145fb inline ASM review
thomask
parents: 989
diff changeset
15
15b0469145fb inline ASM review
thomask
parents: 989
diff changeset
16 int main(){
989
a468938b0160 inline ASM review
thomask
parents: 856
diff changeset
17 haveFPU!()();
1044
03c97933de98 inline ASM review
thomask
parents: 990
diff changeset
18
990
15b0469145fb inline ASM review
thomask
parents: 989
diff changeset
19 float f = -3.0f;
715
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
20 int i = 3;
1044
03c97933de98 inline ASM review
thomask
parents: 990
diff changeset
21
715
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
22 ushort s;
1044
03c97933de98 inline ASM review
thomask
parents: 990
diff changeset
23
715
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
24 asm{
990
15b0469145fb inline ASM review
thomask
parents: 989
diff changeset
25 fld1;
715
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
26 fld f;
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
27 ficomp i;
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
28 fstsw s;
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
29 fstp f;
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
30 }
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
31
990
15b0469145fb inline ASM review
thomask
parents: 989
diff changeset
32 if(f != 1.0f){
15b0469145fb inline ASM review
thomask
parents: 989
diff changeset
33 assert(0);
15b0469145fb inline ASM review
thomask
parents: 989
diff changeset
34 }
1044
03c97933de98 inline ASM review
thomask
parents: 990
diff changeset
35
715
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
36 ushort C0 = 1 << 8;
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
37 ushort C2 = 1 << 10;
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
38 ushort C3 = 1 << 14;
1044
03c97933de98 inline ASM review
thomask
parents: 990
diff changeset
39
990
15b0469145fb inline ASM review
thomask
parents: 989
diff changeset
40 if(!(s & C0)){
15b0469145fb inline ASM review
thomask
parents: 989
diff changeset
41 assert(0);
15b0469145fb inline ASM review
thomask
parents: 989
diff changeset
42 }
15b0469145fb inline ASM review
thomask
parents: 989
diff changeset
43 if(s & C2){
15b0469145fb inline ASM review
thomask
parents: 989
diff changeset
44 assert(0);
15b0469145fb inline ASM review
thomask
parents: 989
diff changeset
45 }
15b0469145fb inline ASM review
thomask
parents: 989
diff changeset
46 if(s & C3){
15b0469145fb inline ASM review
thomask
parents: 989
diff changeset
47 assert(0);
15b0469145fb inline ASM review
thomask
parents: 989
diff changeset
48 }
1044
03c97933de98 inline ASM review
thomask
parents: 990
diff changeset
49
715
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
50 return 0;
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
51 }
990
15b0469145fb inline ASM review
thomask
parents: 989
diff changeset
52 }else{
15b0469145fb inline ASM review
thomask
parents: 989
diff changeset
53 pragma(msg, "DSTRESS{XFAIL}: no inline ASM support");
15b0469145fb inline ASM review
thomask
parents: 989
diff changeset
54 static assert(0);
15b0469145fb inline ASM review
thomask
parents: 989
diff changeset
55 }