Explorar el Código

* Completely fixed float constants in softfloat mode when compiler was compiled in hardfloat mode on arm-linux host.

git-svn-id: trunk@8015 -
yury hace 18 años
padre
commit
1782305ae2
Se han modificado 5 ficheros con 18 adiciones y 14 borrados
  1. 1 5
      compiler/arm/narmcon.pas
  2. 14 0
      compiler/globals.pas
  3. 1 5
      compiler/ncgcon.pas
  4. 1 2
      compiler/ptconst.pas
  5. 1 2
      compiler/rautils.pas

+ 1 - 5
compiler/arm/narmcon.pas

@@ -66,11 +66,7 @@ interface
         location_reset(location,LOC_CREFERENCE,def_cgsize(resultdef));
         lastlabel:=nil;
         realait:=floattype2ait[tfloatdef(resultdef).floattype];
-        hiloswapped:=(current_settings.fputype in [fpu_fpa,fpu_fpa10,fpu_fpa11]) and
-          not(cs_fp_emulation in current_settings.moduleswitches);
-{$ifdef FPC_DOUBLE_HILO_SWAPPED}
-        hiloswapped:=not hiloswapped;
-{$endif FPC_DOUBLE_HILO_SWAPPED}
+        hiloswapped:=is_double_hilo_swapped;
         { const already used ? }
         if not assigned(lab_real) then
           begin

+ 14 - 0
compiler/globals.pas

@@ -340,6 +340,9 @@ interface
     {# Routine to get the required alignment for size of data, which will
        be placed in data/const segment, according to the current alignment requirements }
     function const_align(siz: longint): shortint;
+{$ifdef ARM}
+    function is_double_hilo_swapped: boolean;{$ifdef USEINLINE}inline;{$endif}
+{$endif ARM}
 
 implementation
 
@@ -1005,6 +1008,17 @@ implementation
         const_align := used_align(siz,current_settings.alignment.constalignmin,current_settings.alignment.constalignmax);
       end;
 
+{$ifdef ARM}
+    function is_double_hilo_swapped: boolean;{$ifdef USEINLINE}inline;{$endif}
+      begin
+        result := (current_settings.fputype in [fpu_fpa,fpu_fpa10,fpu_fpa11]) and
+          not(cs_fp_emulation in current_settings.moduleswitches);
+{$ifdef FPC_DOUBLE_HILO_SWAPPED}
+        { inverse result if compiler was compiled with swapped hilo already }
+        result := not result;
+{$endif FPC_DOUBLE_HILO_SWAPPED}
+      end;
+{$endif ARM}
 
 {****************************************************************************
                                     Init

+ 1 - 5
compiler/ncgcon.pas

@@ -122,11 +122,7 @@ implementation
         lastlabel:=nil;
         realait:=floattype2ait[tfloatdef(resultdef).floattype];
 {$ifdef ARM}
-        hiloswapped:=(current_settings.fputype in [fpu_fpa,fpu_fpa10,fpu_fpa11]) and
-          not(cs_fp_emulation in current_settings.moduleswitches);
-{$ifdef FPC_DOUBLE_HILO_SWAPPED}
-        hiloswapped:=not hiloswapped;
-{$endif FPC_DOUBLE_HILO_SWAPPED}
+        hiloswapped:=is_double_hilo_swapped;
 {$endif ARM}
         { const already used ? }
         if not assigned(lab_real) then

+ 1 - 2
compiler/ptconst.pas

@@ -283,8 +283,7 @@ implementation
                list.concat(Tai_real_32bit.Create(ts32real(value)));
              s64real :
 {$ifdef ARM}
-               if (current_settings.fputype in [fpu_fpa,fpu_fpa10,fpu_fpa11]) and
-                 not(cs_fp_emulation in current_settings.moduleswitches) then
+               if is_double_hilo_swapped then
                  list.concat(Tai_real_64bit.Create_hiloswapped(ts64real(value)))
                else
 {$endif ARM}

+ 1 - 2
compiler/rautils.pas

@@ -1529,8 +1529,7 @@ end;
           s32real : p.concat(Tai_real_32bit.Create(value));
           s64real :
 {$ifdef ARM}
-           if (current_settings.fputype in [fpu_fpa,fpu_fpa10,fpu_fpa11]) and
-             not(cs_fp_emulation in current_settings.moduleswitches) then
+           if is_double_hilo_swapped then
              p.concat(Tai_real_64bit.Create_hiloswapped(value))
            else
 {$endif ARM}