Browse Source

+ fpu emulation helpers (ppu checking also)

carl 23 years ago
parent
commit
9d4f336f74
3 changed files with 64 additions and 6 deletions
  1. 16 2
      compiler/fppu.pas
  2. 43 3
      compiler/nmat.pas
  3. 5 1
      compiler/ppu.pas

+ 16 - 2
compiler/fppu.pas

@@ -181,6 +181,16 @@ uses
            Message(unit_u_ppu_invalid_target);
            exit;
          end;
+       { check if floating point emulation is on?}
+        if ((ppufile.header.flags and uf_fpu_emulation)<>0) and 
+            (cs_fp_emulation in aktmoduleswitches) then
+         begin
+           ppufile.free;
+           ppufile:=nil;
+           Message(unit_u_ppu_invalid_fpumode);
+           exit;
+         end;
+       
       { Load values to be access easier }
         flags:=ppufile.header.flags;
         crc:=ppufile.header.checksum;
@@ -800,7 +810,8 @@ uses
           flags:=flags or uf_local_browser;
          if do_release then
           flags:=flags or uf_release;
-
+         if (cs_fp_emulation in aktmoduleswitches) then
+           flags:=flags or uf_fpu_emulation;
 {$ifdef Test_Double_checksum_write}
          Assign(CRCFile,s+'.IMP');
          Rewrite(CRCFile);
@@ -1259,7 +1270,10 @@ uses
 end.
 {
   $Log$
-  Revision 1.20  2002-08-12 16:46:04  peter
+  Revision 1.21  2002-08-15 15:09:41  carl
+    + fpu emulation helpers (ppu checking also)
+
+  Revision 1.20  2002/08/12 16:46:04  peter
     * tscannerfile is now destroyed in tmodule.reset and current_scanner
       is updated accordingly. This removes all the loading and saving of
       the old scanner and the invalid flag marking

+ 43 - 3
compiler/nmat.pas

@@ -44,6 +44,12 @@ interface
        tshlshrnode = class(tbinopnode)
           function pass_1 : tnode;override;
           function det_resulttype:tnode;override;
+          { override the following if you want to implement }
+          { parts explicitely in the code generator (CEC)   
+            Should return nil, if everything will be handled
+            in the code generator
+          }
+          function first_shlshr64bitint: tnode; virtual;
        end;
        tshlshrnodeclass = class of tshlshrnode;
 
@@ -312,6 +318,30 @@ implementation
                               TSHLSHRNODE
  ****************************************************************************}
 
+
+    function tshlshrnode.first_shlshr64bitint: tnode;
+      var
+        procname: string[31];
+      begin
+        result := nil;
+        { otherwise create a call to a helper }
+        if nodetype = shln then
+          procname := 'fpc_shl_int64'
+        else
+          procname := 'fpc_shr_int64';
+{        if is_signed(resulttype.def) then
+          procname := procname + 'int64'
+        else
+          procname := procname + 'qword';
+}
+        result := ccallnode.createintern(procname,ccallparanode.create(left,
+          ccallparanode.create(right,nil)));
+        left := nil;
+        right := nil;
+        firstpass(result);
+      end;
+      
+
     function tshlshrnode.det_resulttype:tnode;
       var
          t : tnode;
@@ -370,9 +400,16 @@ implementation
 
          { 64 bit ints have their own shift handling }
          if not(is_64bitint(left.resulttype.def)) then
-          regs:=1
+           begin
+            regs:=1
+           end
          else
-          regs:=2;
+           begin 
+             result := first_shlshr64bitint;
+             if assigned(result) then
+               exit;
+              regs:=2;
+           end;
 
          if (right.nodetype<>ordconstn) then
           inc(regs);
@@ -718,7 +755,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.37  2002-08-14 19:26:55  carl
+  Revision 1.38  2002-08-15 15:09:42  carl
+    + fpu emulation helpers (ppu checking also)
+
+  Revision 1.37  2002/08/14 19:26:55  carl
     + generic int_to_real type conversion
     + generic unaryminus node
 

+ 5 - 1
compiler/ppu.pas

@@ -130,6 +130,7 @@ const
   uf_little_endian = $1000;
   uf_release       = $2000;{ unit was compiled with -Ur option }
   uf_local_threadvars = $4000;  { unit has local threadvars }
+  uf_fpu_emulation = $8000; { this unit was compiled with fpu emulation on }
 
 type
   ppureal=extended;
@@ -982,7 +983,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.23  2002-08-13 21:40:56  florian
+  Revision 1.24  2002-08-15 15:09:42  carl
+    + fpu emulation helpers (ppu checking also)
+
+  Revision 1.23  2002/08/13 21:40:56  florian
     * more fixes for ppc calling conventions
 
   Revision 1.22  2002/08/11 13:24:12  peter