Ver código fonte

* fsqrt is an optional instruction in the ppc architecture and isn't
implemented by any current ppc afaik, so use the generic sqrt routine
instead (adapted so it works with compilerproc)

Jonas Maebe 22 anos atrás
pai
commit
df5e0bbfc6
3 arquivos alterados com 24 adições e 29 exclusões
  1. 6 23
      compiler/powerpc/nppcinl.pas
  2. 12 2
      rtl/inc/genmath.inc
  3. 6 4
      rtl/powerpc/math.inc

+ 6 - 23
compiler/powerpc/nppcinl.pas

@@ -37,10 +37,8 @@ interface
           }
           function first_abs_real: tnode; override;
           function first_sqr_real: tnode; override;
-          function first_sqrt_real: tnode; override;
           procedure second_abs_real; override;
           procedure second_sqr_real; override;
-          procedure second_sqrt_real; override;
        private
           procedure load_fpu_location;
        end;
@@ -84,18 +82,6 @@ implementation
         first_sqr_real := nil;
       end;
 
-     function tppcinlinenode.first_sqrt_real : tnode;
-      begin
-        expectloc:=LOC_FPUREGISTER;
-        registers32:=left.registers32;
-        registersfpu:=max(left.registersfpu,1);
-{$ifdef SUPPORT_MMX}
-        registersmmx:=left.registersmmx;
-{$endif SUPPORT_MMX}
-        first_sqrt_real := nil;
-      end;
-
-
        { load the FPU into the an fpu register }
        procedure tppcinlinenode.load_fpu_location;
          begin
@@ -140,20 +126,17 @@ implementation
            left.location.register,left.location.register));
        end;
 
-     procedure tppcinlinenode.second_sqrt_real;
-       begin
-         location.loc:=LOC_FPUREGISTER;
-         load_fpu_location;
-         exprasmlist.concat(taicpu.op_reg_reg(A_FSQRT,location.register,
-           left.location.register));
-       end;
-
 begin
    cinlinenode:=tppcinlinenode;
 end.
 {
   $Log$
-  Revision 1.5  2003-04-23 12:35:35  florian
+  Revision 1.6  2003-05-24 13:39:32  jonas
+    * fsqrt is an optional instruction in the ppc architecture and isn't
+      implemented by any current ppc afaik, so use the generic sqrt routine
+      instead (adapted so it works with compilerproc)
+
+  Revision 1.5  2003/04/23 12:35:35  florian
     * fixed several issues with powerpc
     + applied a patch from Jonas for nested function calls (PowerPC only)
     * ...

+ 12 - 2
rtl/inc/genmath.inc

@@ -455,7 +455,7 @@ Function float32_to_int32_round_to_zero( a: Float32 ): longint;
 
 
 {$ifndef FPC_SYSTEM_HAS_SQRT}
-    function sqrt(d:Real):Real;[internconst:in_const_sqrt];
+    function sqrt(d:Real):Real;[internconst:in_const_sqrt]; [public, alias: 'FPC_SQRT_REAL'];
     {*****************************************************************}
     { Square root                                                     }
     {*****************************************************************}
@@ -511,6 +511,11 @@ Function float32_to_int32_round_to_zero( a: Float32 ): longint;
           sqrt := d;
        end;
     end;
+
+{$ifdef hascompilerproc}
+    function fpc_sqrt_real(d:Real):Real;compilerproc; external name 'FPC_SQRT_REAL';
+{$endif hascompilerproc}
+
 {$endif}
 
 
@@ -1083,7 +1088,12 @@ Function float32_to_int32_round_to_zero( a: Float32 ): longint;
 
 {
   $Log$
-  Revision 1.13  2003-05-23 22:58:31  jonas
+  Revision 1.14  2003-05-24 13:39:32  jonas
+    * fsqrt is an optional instruction in the ppc architecture and isn't
+      implemented by any current ppc afaik, so use the generic sqrt routine
+      instead (adapted so it works with compilerproc)
+
+  Revision 1.13  2003/05/23 22:58:31  jonas
     * added longint typecase to odd(smallint_var) call to avoid overload
       problem
 

+ 6 - 4
rtl/powerpc/math.inc

@@ -35,9 +35,6 @@ const
     {$define FPC_SYSTEM_HAS_SQR}
     function sqr(d : extended) : extended;[internproc:in_sqr_extended];
 
-    {$define FPC_SYSTEM_HAS_SQRT}
-    function sqrt(d : extended) : extended;[internproc:in_sqrt_extended];
-
     {
     function arctan(d : extended) : extended;[internconst:in_arctan_extended];
       begin
@@ -427,7 +424,12 @@ end ['R0','R3','F0','F1','F2','F3'];
 
 {
   $Log$
-  Revision 1.22  2003-05-16 16:04:33  jonas
+  Revision 1.23  2003-05-24 13:39:32  jonas
+    * fsqrt is an optional instruction in the ppc architecture and isn't
+      implemented by any current ppc afaik, so use the generic sqrt routine
+      instead (adapted so it works with compilerproc)
+
+  Revision 1.22  2003/05/16 16:04:33  jonas
     * fixed round() (almost the same as trunc)
 
   Revision 1.21  2003/05/11 18:09:45  jonas