Quellcode durchsuchen

+ internal round/trunc support for ppc970 using fctid/fctidz
* a_fctw_ -> a_fctiw_

git-svn-id: trunk@10367 -

Jonas Maebe vor 17 Jahren
Ursprung
Commit
417b5dcfda

+ 5 - 2
compiler/powerpc/aoptcpu.pas

@@ -58,8 +58,10 @@ const
     a_none, a_none, a_none, a_none, a_none, a_none, a_divw, a_divw_, a_divwo, a_divwo_,
     a_divwu, a_divwu_, a_divwuo, a_divwuo_, a_none, a_none, a_none, a_eqv,
     a_eqv_, a_extsb, a_extsb_, a_extsh, a_extsh_, a_fabs, a_fabs_, a_fadd,
-    a_fadd_, a_fadds, a_fadds_, a_none, a_none, a_none, a_none, a_none,
-    a_none, a_fdiv, a_fdiv_, a_fdivs, a_fdivs_, a_fmadd, a_fmadd_, a_fmadds,
+    a_fadd_, a_fadds, a_fadds_, a_none, a_none,
+    a_fctid, a_fctid_, a_fctidz, a_fctidz_,
+    a_fctiw, a_fctiw_, a_fctiwz, a_fctiwz_,
+    a_fdiv, a_fdiv_, a_fdivs, a_fdivs_, a_fmadd, a_fmadd_, a_fmadds,
     a_fmadds_, a_none, a_fmsub, a_fmsub_, a_fmsubs, a_fmsubs_, a_fmul, a_fmul_,
     a_fmuls, a_fmuls_, a_fnabs, a_fnabs_, a_fneg, a_fneg_, a_fnmadd,
     a_fnmadd_, a_fnmadds, a_fnmadds_, a_fnmsub, a_fnmsub_, a_fnmsubs,
@@ -418,6 +420,7 @@ const
       a_none, a_none, a_none, a_none, a_none, a_none, a_none, a_none,
       a_none, a_none, a_none, a_none, a_none, a_none, a_none,
       a_none, a_none, a_none, a_none, a_none, a_none,
+      a_none, a_none, a_none, a_none,
       a_none, a_none, a_none, a_none, a_none, a_none, a_none,
       a_none, a_none, a_none, a_none, a_none, a_none, a_none, a_none,
       a_none, a_none, a_none, a_none, a_none, a_none, a_none, a_none,

+ 3 - 2
compiler/powerpc/cpubase.pas

@@ -49,8 +49,9 @@ uses
         a_dcbf, a_dcbi, a_dcbst, a_dcbt, a_dcbtst, a_dcbz, a_divw, a_divw_, a_divwo, a_divwo_,
         a_divwu, a_divwu_, a_divwuo, a_divwuo_, a_eciwx, a_ecowx, a_eieio, a_eqv,
         a_eqv_, a_extsb, a_extsb_, a_extsh, a_extsh_, a_fabs, a_fabs_, a_fadd,
-        a_fadd_, a_fadds, a_fadds_, a_fcmpo, a_fcmpu, a_fctiw, a_fctw_, a_fctwz,
-        a_fctwz_, a_fdiv, a_fdiv_, a_fdivs, a_fdivs_, a_fmadd, a_fmadd_, a_fmadds,
+        a_fadd_, a_fadds, a_fadds_, a_fcmpo, a_fcmpu, a_fctid, a_fctid_,
+        a_fctidz, a_fctidz_, a_fctiw, a_fctiw_, a_fctiwz, a_fctiwz_,
+        a_fdiv, a_fdiv_, a_fdivs, a_fdivs_, a_fmadd, a_fmadd_, a_fmadds,
         a_fmadds_, a_fmr, a_fmsub, a_fmsub_, a_fmsubs, a_fmsubs_, a_fmul, a_fmul_,
         a_fmuls, a_fmuls_, a_fnabs, a_fnabs_, a_fneg, a_fneg_, a_fnmadd,
         a_fnmadd_, a_fnmadds, a_fnmadds_, a_fnmsub, a_fnmsub_, a_fnmsubs,

+ 2 - 1
compiler/powerpc/itcpugas.pas

@@ -40,7 +40,8 @@ interface
         'dcbf','dcbi','dcbst','dcbt','dcbtst','dcbz','divw','divw.','divwo','divwo.',
         'divwu','divwu.','divwuo','divwuo.','eciwx','ecowx','eieio','eqv',
         'eqv.','extsb','extsb.','extsh','extsh.','fabs','fabs.','fadd',
-        'fadd.','fadds','fadds.','fcmpo','fcmpu','fctiw','fctiw.','fctiwz',
+        'fadd.','fadds','fadds.','fcmpo','fcmpu','fctid','fctid.','fctidz',
+        'fctidz.','fctiw','fctiw.','fctiwz',
         'fctiwz.','fdiv','fdiv.','fdivs','fdivs.','fmadd','fmadd.','fmadds',
         'fmadds.','fmr','fmsub','fmsub.','fmsubs','fmsubs.','fmul','fmul.',
         'fmuls','fmuls.','fnabs','fnabs.','fneg','fneg.','fnmadd',

+ 1 - 1
compiler/powerpc64/cpubase.pas

@@ -49,7 +49,7 @@ type
       a_divwo_,
     a_divwu, a_divwu_, a_divwuo, a_divwuo_, a_eciwx, a_ecowx, a_eieio, a_eqv,
     a_eqv_, a_extsb, a_extsb_, a_extsh, a_extsh_, a_fabs, a_fabs_, a_fadd,
-    a_fadd_, a_fadds, a_fadds_, a_fcmpo, a_fcmpu, a_fctiw, a_fctw_, a_fctwz,
+    a_fadd_, a_fadds, a_fadds_, a_fcmpo, a_fcmpu, a_fctiw, a_fctiw_, a_fctiwz,
     a_fctwz_, a_fdiv, a_fdiv_, a_fdivs, a_fdivs_, a_fmadd, a_fmadd_, a_fmadds,
     a_fmadds_, a_fmr, a_fmsub, a_fmsub_, a_fmsubs, a_fmsubs_, a_fmul, a_fmul_,
     a_fmuls, a_fmuls_, a_fnabs, a_fnabs_, a_fneg, a_fneg_, a_fnmadd,

+ 64 - 3
compiler/ppcgen/ngppcinl.pas

@@ -26,6 +26,7 @@ unit ngppcinl;
 interface
 
     uses
+       cpubase,
        node,ninl,ncginl;
 
     type
@@ -37,24 +38,29 @@ interface
           function first_sqrt_real: tnode; override;
           function first_abs_real: tnode; override;
           function first_sqr_real: tnode; override;
+          function first_trunc_real: tnode; override;
+          function first_round_real: tnode; override;
           procedure second_sqrt_real; override;
           procedure second_abs_real; override;
           procedure second_sqr_real; override;
+          procedure second_trunc_real; override;
+          procedure second_round_real; override;
           procedure second_prefetch;override;
        protected
           procedure load_fpu_location;
+          procedure second_trunc_round_real(op: tasmop);
        end;
 
 implementation
 
     uses
-      cutils,globals,verbose,
+      cutils,globals,verbose,globtype,
       aasmtai,aasmdata,aasmcpu,
       symconst,symdef,
       defutil,
       cgbase,pass_2,
-      cpubase,cpuinfo,ncgutil,
-      cgutils,cgobj,rgobj;
+      cpuinfo,ncgutil,
+      cgutils,cgobj,rgobj,tgobj;
 
 
 {*****************************************************************************
@@ -87,6 +93,30 @@ implementation
       end;
 
 
+     function tgppcinlinenode.first_trunc_real : tnode;
+      begin
+       if (current_settings.cputype >= cpu_PPC970) then
+          begin
+            expectloc:=LOC_REFERENCE;
+            first_trunc_real := nil;
+          end
+        else
+          result:=inherited first_trunc_real;
+      end;
+
+
+     function tgppcinlinenode.first_round_real : tnode;
+      begin
+       if (current_settings.cputype >= cpu_PPC970) then
+          begin
+            expectloc:=LOC_REFERENCE;
+            first_round_real := nil;
+          end
+        else
+          result:=inherited first_round_real;
+      end;
+
+
      { load the FPU into the an fpu register }
      procedure tgppcinlinenode.load_fpu_location;
        begin
@@ -141,6 +171,37 @@ implementation
        end;
 
 
+     procedure tgppcinlinenode.second_trunc_round_real(op: tasmop);
+       var
+         tmpreg: tregister;
+       begin
+         if (current_settings.cputype < cpu_PPC970) then
+           internalerror(2007020910);
+         secondpass(left);
+         location_force_fpureg(current_asmdata.CurrAsmList,left.location,true);
+         tmpreg:=cg.getfpuregister(current_asmdata.CurrAsmList,OS_F64);
+         current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op,tmpreg,
+           left.location.register));
+         location_reset(location,LOC_REFERENCE,def_cgsize(resultdef));
+         tg.gettemptyped(current_asmdata.CurrAsmList,resultdef,tt_normal,
+           location.reference);
+         cg.a_loadfpu_reg_ref(current_asmdata.CurrAsmList,OS_F64,OS_F64,tmpreg,
+           location.reference);
+       end;
+
+
+    procedure tgppcinlinenode.second_trunc_real;
+      begin
+        second_trunc_round_real(A_FCTIDZ);
+      end;
+
+
+    procedure tgppcinlinenode.second_round_real;
+      begin
+        second_trunc_round_real(A_FCTID);
+      end;
+
+
      procedure tgppcinlinenode.second_prefetch;
        var
          r: tregister;