From df5e0bbfc6107510b3b39de1d34b7cd9fdbaff68 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sat, 24 May 2003 13:39:32 +0000 Subject: [PATCH] * 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) --- compiler/powerpc/nppcinl.pas | 29 ++++++----------------------- rtl/inc/genmath.inc | 14 ++++++++++++-- rtl/powerpc/math.inc | 10 ++++++---- 3 files changed, 24 insertions(+), 29 deletions(-) diff --git a/compiler/powerpc/nppcinl.pas b/compiler/powerpc/nppcinl.pas index c04b0d274b..4b863b6c15 100644 --- a/compiler/powerpc/nppcinl.pas +++ b/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) * ... diff --git a/rtl/inc/genmath.inc b/rtl/inc/genmath.inc index a1658fd8a3..d51efa22da 100644 --- a/rtl/inc/genmath.inc +++ b/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 diff --git a/rtl/powerpc/math.inc b/rtl/powerpc/math.inc index 0875644344..7cd0226e0b 100644 --- a/rtl/powerpc/math.inc +++ b/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