Pārlūkot izejas kodu

+ create defines with FPU capabilites
+ make use of FPU capability defines in the rtl

git-svn-id: trunk@42681 -

florian 6 gadi atpakaļ
vecāks
revīzija
c418d63c16
6 mainītis faili ar 48 papildinājumiem un 9 dzēšanām
  1. 4 3
      compiler/arm/cpuinfo.pas
  2. 1 0
      compiler/fpcdefs.inc
  3. 16 1
      compiler/options.pas
  4. 10 2
      rtl/arm/arm.inc
  5. 10 1
      rtl/arm/math.inc
  6. 7 2
      rtl/arm/mathu.inc

+ 4 - 3
compiler/arm/cpuinfo.pas

@@ -1059,6 +1059,7 @@ Const
 
 
    tfpuflags =
    tfpuflags =
       (
       (
+        FPUARM_HAS_FPA,                { fpu is an fpa based FPU                                                               }
         FPUARM_HAS_VFP_EXTENSION,      { fpu is a vfp extension                                                                }
         FPUARM_HAS_VFP_EXTENSION,      { fpu is a vfp extension                                                                }
         FPUARM_HAS_VFP_DOUBLE,         { vfp has double support                                                                }
         FPUARM_HAS_VFP_DOUBLE,         { vfp has double support                                                                }
         FPUARM_HAS_VFP_SINGLE_ONLY,    { vfp has only single support, disjunct to FPUARM_HAS_VFP_DOUBLE, for error checking    }
         FPUARM_HAS_VFP_SINGLE_ONLY,    { vfp has only single support, disjunct to FPUARM_HAS_VFP_DOUBLE, for error checking    }
@@ -1096,9 +1097,9 @@ Const
        ( { fpu_none       } [],
        ( { fpu_none       } [],
          { fpu_soft       } [],
          { fpu_soft       } [],
          { fpu_libgcc     } [],
          { fpu_libgcc     } [],
-         { fpu_fpa        } [],
-         { fpu_fpa10      } [],
-         { fpu_fpa11      } [],
+         { fpu_fpa        } [FPUARM_HAS_FPA],
+         { fpu_fpa10      } [FPUARM_HAS_FPA],
+         { fpu_fpa11      } [FPUARM_HAS_FPA],
          { fpu_vfpv2      } [FPUARM_HAS_VFP_EXTENSION,FPUARM_HAS_VFP_DOUBLE],
          { fpu_vfpv2      } [FPUARM_HAS_VFP_EXTENSION,FPUARM_HAS_VFP_DOUBLE],
          { fpu_vfpv3      } [FPUARM_HAS_VFP_EXTENSION,FPUARM_HAS_VFP_DOUBLE,FPUARM_HAS_32REGS,FPUARM_HAS_VMOV_CONST],
          { fpu_vfpv3      } [FPUARM_HAS_VFP_EXTENSION,FPUARM_HAS_VFP_DOUBLE,FPUARM_HAS_32REGS,FPUARM_HAS_VMOV_CONST],
          { fpu_neon_vfpv3 } [FPUARM_HAS_VFP_EXTENSION,FPUARM_HAS_VFP_DOUBLE,FPUARM_HAS_32REGS,FPUARM_HAS_VMOV_CONST,FPUARM_HAS_NEON],
          { fpu_neon_vfpv3 } [FPUARM_HAS_VFP_EXTENSION,FPUARM_HAS_VFP_DOUBLE,FPUARM_HAS_32REGS,FPUARM_HAS_VMOV_CONST,FPUARM_HAS_NEON],

+ 1 - 0
compiler/fpcdefs.inc

@@ -177,6 +177,7 @@
   {$define cputargethasfixedstack}
   {$define cputargethasfixedstack}
   {$define cpurefshaveindexreg}
   {$define cpurefshaveindexreg}
   {$define cpucapabilities}
   {$define cpucapabilities}
+  {$define fpucapabilities}
   {$define SUPPORT_SAFECALL}
   {$define SUPPORT_SAFECALL}
   {$define SUPPORT_GET_FRAME}
   {$define SUPPORT_GET_FRAME}
   { default to armel }
   { default to armel }

+ 16 - 1
compiler/options.pas

@@ -3772,8 +3772,13 @@ var
   cmdstr : TCmdStr;
   cmdstr : TCmdStr;
 {$if defined(cpucapabilities)}
 {$if defined(cpucapabilities)}
   cpuflag : tcpuflags;
   cpuflag : tcpuflags;
-  hs : string;
 {$endif defined(cpucapabilities)}
 {$endif defined(cpucapabilities)}
+{$if defined(fpucapabilities)}
+  fpuflag : tfpuflags;
+{$endif defined(fpucapabilities)}
+{$if defined(cpucapabilities) or defined(fpucapabilities)}
+  hs : string;
+{$endif defined(cpucapabilities) or defined(fpucapabilities)}
 begin
 begin
   option:=coption.create;
   option:=coption.create;
   disable_configfile:=false;
   disable_configfile:=false;
@@ -4395,6 +4400,16 @@ begin
         undef_system_macro(hs);
         undef_system_macro(hs);
     end;
     end;
 {$endif defined(cpucapabilities)}
 {$endif defined(cpucapabilities)}
+{$if defined(fpucapabilities)}
+  for fpuflag:=low(fpuflag) to high(fpuflag) do
+    begin
+      str(fpuflag,hs);
+      if fpuflag in fpu_capabilities[init_settings.fputype] then
+        def_system_macro(hs)
+      else
+        undef_system_macro(hs);
+    end;
+{$endif defined(fpucapabilities)}
 
 
   if init_settings.fputype<>fpu_none then
   if init_settings.fputype<>fpu_none then
     begin
     begin

+ 10 - 2
rtl/arm/arm.inc

@@ -35,7 +35,15 @@ const
 {$if not(defined(wince)) and not(defined(gba)) and not(defined(nds)) and not(defined(FPUSOFT)) and not(defined(FPULIBGCC))}
 {$if not(defined(wince)) and not(defined(gba)) and not(defined(nds)) and not(defined(FPUSOFT)) and not(defined(FPULIBGCC))}
 
 
 {$define FPC_SYSTEM_HAS_SYSINITFPU}
 {$define FPC_SYSTEM_HAS_SYSINITFPU}
-{$if not defined(darwin) and not defined(FPUVFPV2) and not defined(FPUVFPV3) and not defined(FPUVFPV4) and not defined(FPUVFPV3_D16)}
+
+{ for bootstrapping with 3.0.x/3.2.x }
+{$if not defined(darwin) and not defined(FPUVFPV2) and not defined(FPUVFPV3) and not defined(FPUVFPV4) and not defined(FPUVFPV3_D16) and not defined(FPUARM_HAS_VFP_EXTENSION))}
+{$define FPUARM_HAS_FPA}
+{$else}
+{$define FPUARM_HAS_VFP_EXTENSION}
+{$endif}
+
+{$if defined(FPUARM_HAS_FPA)}
 Procedure SysInitFPU;{$ifdef SYSTEMINLINE}inline;{$endif}
 Procedure SysInitFPU;{$ifdef SYSTEMINLINE}inline;{$endif}
 begin
 begin
   { Enable FPU exceptions, but disable INEXACT, UNDERFLOW, DENORMAL }
   { Enable FPU exceptions, but disable INEXACT, UNDERFLOW, DENORMAL }
@@ -46,7 +54,7 @@ begin
     wfs r0
     wfs r0
   end;
   end;
 end;
 end;
-{$else}
+{$elseif defined(FPUARM_HAS_VFP_EXTENSION)}
 
 
 
 
 const
 const

+ 10 - 1
rtl/arm/math.inc

@@ -14,7 +14,16 @@
 
 
  **********************************************************************}
  **********************************************************************}
 
 
-{$if defined(FPUFPA) or defined(FPUFPA10) or defined(FPUFPA11) or defined(FPUVFPV2) or defined(FPUVFPV3) or defined(FPUVFPV4) or defined(FPUVFPV3_D16)}
+
+{ for bootstrapping with 3.0.x/3.2.x }
+{$if defined(FPUFPA) or defined(FPUFPA10) or defined(FPUFPA11)}
+{$define FPUARM_HAS_FPA}
+{$endif}
+{$if defined(FPUVFPV2) or defined(FPUVFPV3) or defined(FPUVFPV4) or defined(FPUVFPV3_D16)}
+{$define FPUARM_HAS_VFP_EXTENSION}
+{$endif}
+
+{$if defined(FPUARM_HAS_FPA) or defined(FPUARM_HAS_VFP_EXTENSION)}
     {$ifndef FPC_SYSTEM_HAS_ABS}
     {$ifndef FPC_SYSTEM_HAS_ABS}
     {$define FPC_SYSTEM_HAS_ABS}
     {$define FPC_SYSTEM_HAS_ABS}
     function fpc_abs_real(d : ValReal) : ValReal;compilerproc;
     function fpc_abs_real(d : ValReal) : ValReal;compilerproc;

+ 7 - 2
rtl/arm/mathu.inc

@@ -12,6 +12,11 @@
 
 
  **********************************************************************}
  **********************************************************************}
 
 
+ { for bootstrapping with 3.0.x/3.2.x }
+{$if defined(darwin) or defined(FPUVFPV2) or defined(FPUVFPV3) or defined(FPUVFPV4) or defined(FPUVFPV3_d16) or defined(FPUFPV4_s16)}
+{$define FPUARM_HAS_VFP_EXTENSION}
+{$endif}
+
 {$if defined(wince)}
 {$if defined(wince)}
 
 
 const
 const
@@ -132,7 +137,7 @@ procedure ClearExceptions(RaisePending: Boolean =true);
 begin
 begin
 end;
 end;
 
 
-{$elseif defined(darwin) or defined(FPUVFPV2) or defined(FPUVFPV3) or defined(FPUVFPV4) or defined(FPUVFPV3_d16) or defined(FPUFPV4_s16)}
+{$elseif defined(FPUARM_HAS_VFP_EXTENSION)}
 
 
 const
 const
   _VFP_ENABLE_IM  =  1 shl 8;         { invalid operation      }
   _VFP_ENABLE_IM  =  1 shl 8;         { invalid operation      }
@@ -287,7 +292,7 @@ procedure ClearExceptions(RaisePending: Boolean =true);
     VFP_SetCW(VFP_GetCW and (not _VFP_EXCEPTIONS_PENDING_MASK));
     VFP_SetCW(VFP_GetCW and (not _VFP_EXCEPTIONS_PENDING_MASK));
   end;
   end;
 
 
-{$else wince/darwin/vfpv2/vfpv3}
+{$else FPUARM_HAS_VFP_EXTENSION}
 
 
 {*****************************************************************************
 {*****************************************************************************
                                    FPA code
                                    FPA code