annotate run/a/asm_fcmove_01_A.d @ 1621:8f6d65d2b129

Fix #4.
author Christian Kamm <kamm incasoftware de>
date Sat, 07 Nov 2009 19:06:53 +0100
parents 31d658aa7480
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
989
a468938b0160 inline ASM review
thomask
parents:
diff changeset
1 // $HeadURL$
a468938b0160 inline ASM review
thomask
parents:
diff changeset
2 // $Date$
a468938b0160 inline ASM review
thomask
parents:
diff changeset
3 // $Author$
1044
03c97933de98 inline ASM review
thomask
parents: 989
diff changeset
4
989
a468938b0160 inline ASM review
thomask
parents:
diff changeset
5 module dstress.run.a.asm_fcmove_01_A;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
6
1151
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1044
diff changeset
7 // __DSTRESS_TORTURE_BLOCK__ -fPIC
2a1a6610f7ad various inline assembler fixes
thomask
parents: 1044
diff changeset
8
989
a468938b0160 inline ASM review
thomask
parents:
diff changeset
9 version(D_InlineAsm_X86){
a468938b0160 inline ASM review
thomask
parents:
diff changeset
10 version = runTest;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
11 }else version(D_InlineAsm_X86_64){
a468938b0160 inline ASM review
thomask
parents:
diff changeset
12 version = runTest;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
13 }
a468938b0160 inline ASM review
thomask
parents:
diff changeset
14
a468938b0160 inline ASM review
thomask
parents:
diff changeset
15 version(runTest){
a468938b0160 inline ASM review
thomask
parents:
diff changeset
16 import addon.cpuinfo;
1044
03c97933de98 inline ASM review
thomask
parents: 989
diff changeset
17
989
a468938b0160 inline ASM review
thomask
parents:
diff changeset
18 int main(){
a468938b0160 inline ASM review
thomask
parents:
diff changeset
19 haveFPU!()();
a468938b0160 inline ASM review
thomask
parents:
diff changeset
20 haveCMOV!()();
a468938b0160 inline ASM review
thomask
parents:
diff changeset
21
a468938b0160 inline ASM review
thomask
parents:
diff changeset
22 float f = -9.9f;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
23
a468938b0160 inline ASM review
thomask
parents:
diff changeset
24 asm{
a468938b0160 inline ASM review
thomask
parents:
diff changeset
25 mov AL, 2;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
26 mov BL, 1;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
27 cmp AL, BL;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
28 fld1;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
29 fldz;
1621
8f6d65d2b129 Fix #4.
Christian Kamm <kamm incasoftware de>
parents: 1522
diff changeset
30 fcmove ST, ST(1);
989
a468938b0160 inline ASM review
thomask
parents:
diff changeset
31 fst f;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
32 }
a468938b0160 inline ASM review
thomask
parents:
diff changeset
33
a468938b0160 inline ASM review
thomask
parents:
diff changeset
34 if(f != 0.0f){
a468938b0160 inline ASM review
thomask
parents:
diff changeset
35 assert(0);
a468938b0160 inline ASM review
thomask
parents:
diff changeset
36 }
a468938b0160 inline ASM review
thomask
parents:
diff changeset
37
a468938b0160 inline ASM review
thomask
parents:
diff changeset
38 asm{
a468938b0160 inline ASM review
thomask
parents:
diff changeset
39 mov AL, 1;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
40 mov BL, 1;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
41 cmp AL, BL;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
42 fld1;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
43 fldz;
1621
8f6d65d2b129 Fix #4.
Christian Kamm <kamm incasoftware de>
parents: 1522
diff changeset
44 fcmove ST, ST(1);
989
a468938b0160 inline ASM review
thomask
parents:
diff changeset
45 fst f;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
46 }
a468938b0160 inline ASM review
thomask
parents:
diff changeset
47
a468938b0160 inline ASM review
thomask
parents:
diff changeset
48 if(f != 1.0f){
a468938b0160 inline ASM review
thomask
parents:
diff changeset
49 assert(0);
a468938b0160 inline ASM review
thomask
parents:
diff changeset
50 }
a468938b0160 inline ASM review
thomask
parents:
diff changeset
51
a468938b0160 inline ASM review
thomask
parents:
diff changeset
52 return 0;
a468938b0160 inline ASM review
thomask
parents:
diff changeset
53 }
a468938b0160 inline ASM review
thomask
parents:
diff changeset
54 }else{
a468938b0160 inline ASM review
thomask
parents:
diff changeset
55 pragma(msg, "DSTRESS{XFAIL}: no inline ASM support");
a468938b0160 inline ASM review
thomask
parents:
diff changeset
56 static assert(0);
a468938b0160 inline ASM review
thomask
parents:
diff changeset
57 }