Browse Source

+ more assembler tests

pierre 25 years ago
parent
commit
9581f8a99b
1 changed files with 66 additions and 0 deletions
  1. 66 0
      tests/test/testfpu.pp

+ 66 - 0
tests/test/testfpu.pp

@@ -5,6 +5,7 @@ program test_fp_instructions;
 
   var
     x,y : integer;
+    statusword,controlword : word;
     z,t : longint;
     a,b,c : comp;
     begin
@@ -13,8 +14,30 @@ program test_fp_instructions;
        t:=5;
        z:=4;
        a:=20;
+       { test all FPU instructions using 's' and 'l' suffix
+         for word and dword size PM }
 {$asmmode att}
        asm
+         fildl z
+         fiadds x
+         fistpq b
+         fildl z
+         ficoms x
+         fistpq b
+         fildl z
+         ficomps x
+         fildl z
+         fidivs x
+         fistpq b
+         fildl z
+         fidivrs x
+         fistpq b
+         fildl z
+         fisubs x
+         fistpq b
+         fildl z
+         fisubrs x
+         fistpq b
          fildl z
          fimuls x
          fistpq b
@@ -25,6 +48,26 @@ program test_fp_instructions;
            Halt(1);
          end;
        asm
+         fildl z
+         fiaddl t
+         fistpq b
+         fildl z
+         ficoml t
+         fistpq b
+         fildl z
+         ficompl t
+         fildl z
+         fidivl t
+         fistpq b
+         fildl z
+         fidivrl t
+         fistpq b
+         fildl z
+         fisubl t
+         fistpq b
+         fildl z
+         fisubrl t
+         fistpq b
          fildl z
          fimull t
          fistpq b
@@ -34,6 +77,21 @@ program test_fp_instructions;
            Writeln('Error in FPU att syntax code generation');
            Halt(1);
          end;
+       { test CW and SW instructions }
+       { FSTSW FNSTSW
+         FLDCW FSTCW FNSTCW }
+       asm
+         fstsw statusword
+         fstsww statusword
+         fnstsw statusword
+         fnstsww statusword
+         fstcw controlword
+         fstcww controlword
+         fnstcw controlword
+         fnstcww controlword
+         fldcw controlword
+         fldcww controlword
+       end;
 {$asmmode intel}
        asm
          fild dword ptr z
@@ -48,6 +106,14 @@ program test_fp_instructions;
            Writeln('Error in FPU code generation');
            Halt(1);
          end;
+       { test CW and SW instructions }
+       asm
+         fstsw word ptr [statusword]
+         fnstsw word ptr [statusword]
+         fstcw word ptr [controlword]
+         fnstcw word ptr[controlword]
+         fldcw word ptr [controlword]
+       end;
        test:=b;
     end;