Przeglądaj źródła

* fixed several arm floating point issues

florian 21 lat temu
rodzic
commit
37454274bc
5 zmienionych plików z 88 dodań i 16 usunięć
  1. 27 1
      compiler/aasmtai.pas
  2. 29 7
      compiler/aggas.pas
  3. 6 3
      compiler/arm/narmadd.pas
  4. 21 3
      compiler/ncgcon.pas
  5. 5 2
      compiler/options.pas

+ 27 - 1
compiler/aasmtai.pas

@@ -359,9 +359,15 @@ interface
           procedure ppuwrite(ppufile:tcompilerppufile);override;
        end;
 
+       tformatoptions = (fo_none,fo_hiloswapped);
+
        { Generates a double float (64 bit real) }
        tai_real_64bit = class(tai)
           value : ts64real;
+{$ifdef ARM}
+          formatoptions : tformatoptions;
+          constructor Create_hiloswapped(_value : ts64real);
+{$endif ARM}
           constructor Create(_value : ts64real);
           constructor ppuload(t:taitype;ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
@@ -1053,10 +1059,24 @@ implementation
       end;
 
 
+{$ifdef ARM}
+    constructor tai_real_64bit.Create_hiloswapped(_value : ts64real);
+
+      begin
+         inherited Create;
+         typ:=ait_real_64bit;
+         value:=_value;
+         formatoptions:=fo_hiloswapped;
+      end;
+{$endif ARM}
+
     constructor tai_real_64bit.ppuload(t:taitype;ppufile:tcompilerppufile);
       begin
         inherited ppuload(t,ppufile);
         value:=ppufile.getreal;
+{$ifdef ARM}
+        formatoptions:=tformatoptions(ppufile.getbyte);
+{$endif ARM}
       end;
 
 
@@ -1064,6 +1084,9 @@ implementation
       begin
         inherited ppuwrite(ppufile);
         ppufile.putreal(value);
+{$ifdef ARM}
+        ppufile.putbyte(byte(formatoptions));
+{$endif ARM}
       end;
 
 
@@ -1948,7 +1971,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.65  2004-01-23 15:12:49  florian
+  Revision 1.66  2004-01-24 18:12:40  florian
+    * fixed several arm floating point issues
+
+  Revision 1.65  2004/01/23 15:12:49  florian
     * fixed generic shl/shr operations
     + added register allocation hook calls for arm specific operand types:
       register set and shifter op

+ 29 - 7
compiler/aggas.pas

@@ -526,12 +526,31 @@ var
                if source_info.endian <> target_info.endian then
                  swap64bitarray(t64bitarray(d));
                AsmWrite(#9'.byte'#9);
-               for i:=0 to 7 do
-                begin
-                  if i<>0 then
-                   AsmWrite(',');
-                  AsmWrite(tostr(t64bitarray(d)[i]));
-                end;
+{$ifdef arm}
+               if tai_real_64bit(hp).formatoptions=fo_hiloswapped then
+                 begin
+                   for i:=4 to 7 do
+                     begin
+                       if i<>4 then
+                         AsmWrite(',');
+                       AsmWrite(tostr(t64bitarray(d)[i]));
+                     end;
+                   for i:=0 to 3 do
+                     begin
+                       AsmWrite(',');
+                       AsmWrite(tostr(t64bitarray(d)[i]));
+                     end;
+                 end
+               else
+{$endif arm}
+                 begin
+                   for i:=0 to 7 do
+                     begin
+                       if i<>0 then
+                         AsmWrite(',');
+                       AsmWrite(tostr(t64bitarray(d)[i]));
+                     end;
+                 end;
                AsmLn;
              end;
 
@@ -849,7 +868,10 @@ var
 end.
 {
   $Log$
-  Revision 1.44  2004-01-20 21:02:54  florian
+  Revision 1.45  2004-01-24 18:12:40  florian
+    * fixed several arm floating point issues
+
+  Revision 1.44  2004/01/20 21:02:54  florian
     * fixed symbol type writing for arm-linux
     * fixed assembler generation for abs
 

+ 6 - 3
compiler/arm/narmadd.pas

@@ -141,7 +141,7 @@ interface
                 subn :
                   op:=A_SUF;
                 slashn :
-                  op:=A_FDV;
+                  op:=A_DVF;
                 else
                   internalerror(200308313);
               end;
@@ -158,7 +158,7 @@ interface
                 location.register:=right.location.register;
 
               instr:=taicpu.op_reg_reg_reg(op,
-                 left.location.register,right.location.register,location.register);
+                 location.register,left.location.register,right.location.register);
               instr.oppostfix:=cgsize2fpuoppostfix[def_cgsize(resulttype.def)];
               exprasmlist.concat(instr);
 
@@ -314,7 +314,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.8  2004-01-23 00:01:48  florian
+  Revision 1.9  2004-01-24 18:12:40  florian
+    * fixed several arm floating point issues
+
+  Revision 1.8  2004/01/23 00:01:48  florian
     * another fix to flag handling
 
   Revision 1.7  2004/01/22 20:13:18  florian

+ 21 - 3
compiler/ncgcon.pas

@@ -88,11 +88,17 @@ implementation
          hp1 : tai;
          lastlabel : tasmlabel;
          realait : taitype;
+{$ifdef ARM}
+         hiloswapped : boolean;
+{$endif ARM}
 
       begin
         location_reset(location,LOC_CREFERENCE,def_cgsize(resulttype.def));
         lastlabel:=nil;
         realait:=floattype2ait[tfloatdef(resulttype.def).typ];
+{$ifdef ARM}
+        hiloswapped:=aktfputype in [fpu_fpa,fpu_fpa10,fpu_fpa11];
+{$endif ARM}
         { const already used ? }
         if not assigned(lab_real) then
           begin
@@ -109,7 +115,11 @@ implementation
                             if is_number_float(value_real) and
                               (
                                ((realait=ait_real_32bit) and (tai_real_32bit(hp1).value=value_real) and is_number_float(tai_real_32bit(hp1).value)) or
-                               ((realait=ait_real_64bit) and (tai_real_64bit(hp1).value=value_real) and is_number_float(tai_real_64bit(hp1).value)) or
+                               ((realait=ait_real_64bit) and
+{$ifdef ARM}
+                                 ((tai_real_64bit(hp1).formatoptions=fo_hiloswapped)=hiloswapped) and
+{$endif ARM}
+                                 (tai_real_64bit(hp1).value=value_real) and is_number_float(tai_real_64bit(hp1).value)) or
                                ((realait=ait_real_80bit) and (tai_real_80bit(hp1).value=value_real) and is_number_float(tai_real_80bit(hp1).value)) or
 {$ifdef cpufloat128}
                                ((realait=ait_real_128bit) and (tai_real_128bit(hp1).value=value_real) and is_number_float(tai_real_128bit(hp1).value)) or
@@ -139,7 +149,12 @@ implementation
                     ait_real_32bit :
                       Consts.concat(Tai_real_32bit.Create(ts32real(value_real)));
                     ait_real_64bit :
-                      Consts.concat(Tai_real_64bit.Create(ts64real(value_real)));
+{$ifdef ARM}
+                      if hiloswapped then
+                        Consts.concat(Tai_real_64bit.Create_hiloswapped(ts64real(value_real)))
+                      else
+{$endif ARM}
+                        Consts.concat(Tai_real_64bit.Create(ts64real(value_real)));
                     ait_real_80bit :
                       Consts.concat(Tai_real_80bit.Create(value_real));
 {$ifdef cpufloat128}
@@ -559,7 +574,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.35  2004-01-12 16:39:40  peter
+  Revision 1.36  2004-01-24 18:12:40  florian
+    * fixed several arm floating point issues
+
+  Revision 1.35  2004/01/12 16:39:40  peter
     * sparc updates, mostly float related
 
   Revision 1.34  2003/12/08 22:34:24  peter

+ 5 - 2
compiler/options.pas

@@ -1690,7 +1690,7 @@ begin
   if pocall_default = pocall_register then
     def_symbol('REGCALL');
   def_symbol('DECRREFNOTNIL');
-  
+
 { using a case is pretty useless here (FK) }
 { some stuff for TP compatibility }
 {$ifdef i386}
@@ -1995,7 +1995,10 @@ finalization
 end.
 {
   $Log$
-  Revision 1.121  2004-01-21 22:13:20  peter
+  Revision 1.122  2004-01-24 18:12:40  florian
+    * fixed several arm floating point issues
+
+  Revision 1.121  2004/01/21 22:13:20  peter
     * decrrefcount resets temps to nil
 
   Revision 1.120  2004/01/10 00:16:21  jonas