annotate run/a/asm_fdivr_01_D.d @ 715:a35e4f0a9049

partial iasm FPU review
author thomask
date Fri, 28 Oct 2005 21:22:25 +0000
parents
children 7b2c5a101190
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
715
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
1 // $HeadURL: svn://127.0.0.1/run/a/asm_fcos_01.d $
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
2 // $Date: 2005-10-04 11:25:00 +0200 (星期二, 04 十月 2005) $
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
3 // $Author: thomask $
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
4
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
5 // __DSTRESS_DFLAGS__ addon/cpuinfo.d
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
6
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
7 module dstress.run.a.asm_fdivr_01_D;
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
8 import addon.cpuinfo;
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
9
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
10 int main(){
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
11 version(D_InlineAsm){
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
12 haveFPU();
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
13
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
14 float a = 12.0;
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
15 float b = -3.0;
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
16 float c = 9.9;
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
17
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
18 asm{
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
19 fld b;
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
20 fldz;
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
21 fld a;
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
22 fdivr ST(2),ST;
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
23 fstp a;
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
24 fstp b;
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
25 fstp c;
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
26 }
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
27
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
28 assert(a == 12.0);
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
29 assert(b == 0.0);
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
30 assert(c == -4.0);
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
31
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
32 return 0;
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
33 }else{
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
34 pragma(msg, "no inline asm support");
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
35 static assert(0);
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
36 }
a35e4f0a9049 partial iasm FPU review
thomask
parents:
diff changeset
37 }