Browse Source

+ more tests

pierre 25 years ago
parent
commit
97c84ffed8
1 changed files with 54 additions and 6 deletions
  1. 54 6
      tests/tbs/tbs0309.pp

+ 54 - 6
tests/tbs/tbs0309.pp

@@ -6,18 +6,24 @@ program bug0309;
 
 var
    a,b : double;
-
+   _as,bs : single;
+   al,bl : extended;
+   aw,bw : integer;
+   ai,bi : longint;
+   ac : comp;
 begin
+{$ifdef CPU86}
+{$asmmode att}
    asm
       fninit;
    end;
    a:=1;
    b:=2;
    asm
-      movl $1,%eax
-      fldl a
-      fldl b
-      fadd
+      movl  $1,%eax
+      fldl  a
+      fldl  b
+      faddp %st,%st(1)
       fstpl a
    end;
    { the above generates wrong code in binary writer
@@ -30,4 +36,46 @@ begin
    a:=1.0;
    a:=a+b;
    writeln('a = ',a,' should be 3');
-end.
+   _as:=0;
+   al:=0;
+   asm
+     fldl a
+     fsts _as
+     fstpt al
+   end;
+   if (_as<>3.0) or (al<>3.0) then
+     Halt(1);
+   ai:=5;
+   bi:=5;
+   asm
+     fildl ai
+     fstpl a
+   end;
+   if a<>5.0 then
+     Halt(1);
+
+   ac:=5;
+   asm
+     fildl ai
+     fstpl a
+   end;
+   if a<>5.0 then
+     Halt(1);
+   aw:=-4;
+   bw:=45;
+   asm
+     fildw aw
+     fstpl a
+   end;
+   if a<>-4.0 then
+     Halt(1);
+   ac:=345;
+   asm
+     fildq ac
+     fstpl a
+   end;
+   if a<>345.0 then
+     Halt(1);
+
+{$endif CPU86}
+end.