annotate run/a/asm_fmul_01_D.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
992
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
1 // $HeadURL$
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
2 // $Date$
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
3 // $Author$
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
4
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
5 module dstress.run.a.asm_fmul_01_D;
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
6
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
7 version(D_InlineAsm_X86){
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
8 version = runTest;
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
9 }else version(D_InlineAsm_X86_64){
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
10 version = runTest;
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
11 }
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
12
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
13 version(runTest){
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
14 import addon.cpuinfo;
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
15
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
16 int main(){
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
17 haveFPU!()();
1044
03c97933de98 inline ASM review
thomask
parents: 992
diff changeset
18
992
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
19 float a = 2.0f;
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
20 float b = -3.0f;
1044
03c97933de98 inline ASM review
thomask
parents: 992
diff changeset
21
992
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
22 asm{
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
23 fld a;
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
24 fld b;
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
25 fmul ST(1), ST;
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
26 fdecstp;
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
27 fst b;
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
28 }
1044
03c97933de98 inline ASM review
thomask
parents: 992
diff changeset
29
992
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
30 b -= -6.0f;
1044
03c97933de98 inline ASM review
thomask
parents: 992
diff changeset
31
992
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
32 if(b < 0.0f){
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
33 b = -b;
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
34 }
1044
03c97933de98 inline ASM review
thomask
parents: 992
diff changeset
35
992
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
36 if(b > b.epsilon * 4.0f){
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
37 assert(0);
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
38 }
1044
03c97933de98 inline ASM review
thomask
parents: 992
diff changeset
39
992
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
40 return 0;
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
41 }
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
42 }else{
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
43 pragma(msg, "DSTRESS{XFAIL}: no inline ASM support");
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
44 static assert(0);
4c6602a06f32 inline ASM review
thomask
parents:
diff changeset
45 }