* some compilation fixes for powerpc after all the internconst and

internproc changes, still crashes with internalerror(88) for ppc1
    on real2str.inc(193,39)
This commit is contained in:
Jonas Maebe 2004-11-20 15:49:21 +00:00
parent 1943e6a5ab
commit cfeaa8aa65
5 changed files with 67 additions and 38 deletions

View File

@ -23,7 +23,7 @@
{$ifdef SUPPORT_DOUBLE}
function c_trunc(d: double): double; cdecl; external 'c' name 'trunc';
function int(d: double): double; {$ifdef MATHINLINE}inline;{$endif} [internconst:in_const_int];
function int(d: double): double; {$ifdef MATHINLINE}inline;{$endif}{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_int];{$endif}
begin
result := c_trunc(d);
end;
@ -38,7 +38,7 @@
result := c_truncf(d);
end;
function int(d: real) : real;[internconst:in_const_int];
function int(d: real) : real;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_int];{$endif}
begin
{ this will be correct since real = single in the case of }
{ the motorola version of the compiler... }
@ -79,7 +79,7 @@
function c_sqrt(d: double): double; cdecl; external 'c' name 'sqrt';
function sqrt(d:Real):Real;[internconst:in_const_sqrt]; [public, alias: 'FPC_SQRT_REAL']; {$ifdef MATHINLINE}inline;{$endif}
function sqrt(d:Real):Real;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_sqrt];{$endif} [public, alias: 'FPC_SQRT_REAL']; {$ifdef MATHINLINE}inline;{$endif}
begin
sqrt := c_sqrt(d);
end;
@ -95,7 +95,7 @@
{$define FPC_SYSTEM_HAS_EXP}
function c_exp(d: double): double; cdecl; external 'c' name 'exp';
function Exp(d:Real):Real;[internconst:in_const_exp]; {$ifdef MATHINLINE}inline;{$endif}
function Exp(d:Real):Real;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_exp];{$endif} {$ifdef MATHINLINE}inline;{$endif}
begin
exp := c_exp(d);
end;
@ -111,14 +111,14 @@ Not supported on Mac OS X 10.1
function c_llround(d: double): int64; cdecl; external 'c' name 'llround';
{$ifdef hascompilerproc}
function round(d : Real) : int64;[internconst:in_const_round, external name 'FPC_ROUND'];
function round(d : Real) : int64;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_round];{$endif} external name 'FPC_ROUND';
function fpc_round(d : Real) : int64;[public, alias:'FPC_ROUND'];{$ifdef hascompilerproc}compilerproc;{$endif hascompilerproc}
begin
fpc_round := c_llround(d);
end;
{$else}
function round(d : Real) : int64;[internconst:in_const_round];
function round(d : Real) : int64;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_round];{$endif}
begin
round := c_llround(d);
end;
@ -132,7 +132,7 @@ Not supported on Mac OS X 10.1
function c_log(d: double): double; cdecl; external 'c' name 'log';
function Ln(d:Real):Real;[internconst:in_const_ln];{$ifdef MATHINLINE}inline;{$endif}
function Ln(d:Real):Real;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_ln];{$endif}{$ifdef MATHINLINE}inline;{$endif}
begin
ln := c_log(d);
end;
@ -143,7 +143,7 @@ Not supported on Mac OS X 10.1
{$define FPC_SYSTEM_HAS_SIN}
function c_sin(d: double): double; cdecl; external 'c' name 'sin';
function Sin(d:Real):Real;[internconst:in_const_sin]; {$ifdef MATHINLINE}inline;{$endif}
function Sin(d:Real):Real;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_sin];{$endif} {$ifdef MATHINLINE}inline;{$endif}
begin
sin := c_sin(d);
end;
@ -155,7 +155,7 @@ Not supported on Mac OS X 10.1
{$define FPC_SYSTEM_HAS_COS}
function c_cos(d: double): double; cdecl; external 'c' name 'cos';
function Cos(d:Real):Real;[internconst:in_const_cos]; {$ifdef MATHINLINE}inline;{$endif}
function Cos(d:Real):Real;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_cos];{$endif} {$ifdef MATHINLINE}inline;{$endif}
begin
cos := c_cos(d);
end;
@ -167,7 +167,7 @@ Not supported on Mac OS X 10.1
{$define FPC_SYSTEM_HAS_ARCTAN}
function c_atan(d: double): double; cdecl; external 'c' name 'atan';
function ArcTan(d:Real):Real;[internconst:in_const_arctan]; {$ifdef MATHINLINE}inline;{$endif}
function ArcTan(d:Real):Real;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_arctan];{$endif} {$ifdef MATHINLINE}inline;{$endif}
begin
arctan := c_atan(d);
end;
@ -177,7 +177,12 @@ Not supported on Mac OS X 10.1
{
$Log$
Revision 1.2 2004-10-12 07:08:33 jonas
Revision 1.3 2004-11-20 15:49:21 jonas
* some compilation fixes for powerpc after all the internconst and
internproc changes, still crashes with internalerror(88) for ppc1
on real2str.inc(193,39)
Revision 1.2 2004/10/12 07:08:33 jonas
- disabled llround, not present under Mac OS X 10.1
Revision 1.1 2004/10/09 21:00:46 jonas

View File

@ -274,7 +274,7 @@ type
End;
function trunc(d : real) : int64;[internconst:in_const_trunc];
function trunc(d : real) : int64;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_trunc];{$endif}
var
{$ifdef cpuarm}
l: longint;
@ -318,7 +318,7 @@ type
{ straight Pascal translation of the code for __trunc() in }
{ the file sysdeps/libm-ieee754/s_trunc.c of glibc (JM) }
function int(d: double): double;[internconst:in_const_int];
function int(d: double): double;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_int];{$endif}
var
i0, j0: longint;
i1: cardinal;
@ -373,7 +373,7 @@ type
{$else SUPPORT_DOUBLE}
function int(d : real) : real;[internconst:in_const_int];
function int(d : real) : real;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_int];{$endif}
begin
{ this will be correct since real = single in the case of }
{ the motorola version of the compiler... }
@ -527,14 +527,14 @@ type
{$ifndef FPC_SYSTEM_HAS_SQR}
function sqr(d : Real) : Real;[internconst:in_const_sqr];
function sqr(d : Real) : Real;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_sqr];{$endif}
begin
sqr := d*d;
end;
{$endif}
{$ifndef FPC_SYSTEM_HAS_PI}
function pi : Real;[internconst:in_const_pi];
function pi : Real;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_pi];{$endif}
begin
pi := 3.1415926535897932385;
end;
@ -542,7 +542,7 @@ type
{$ifndef FPC_SYSTEM_HAS_SQRT}
function sqrt(d:Real):Real;[internconst:in_const_sqrt]; [public, alias: 'FPC_SQRT_REAL'];
function sqrt(d:Real):Real;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_sqrt];{$endif} [public, alias: 'FPC_SQRT_REAL'];
{*****************************************************************}
{ Square root }
{*****************************************************************}
@ -607,7 +607,7 @@ type
{$ifndef FPC_SYSTEM_HAS_EXP}
function Exp(d:Real):Real;[internconst:in_const_exp];
function Exp(d:Real):Real;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_exp];{$endif}
{*****************************************************************}
{ Exponential Function }
{*****************************************************************}
@ -683,11 +683,11 @@ type
{$ifndef FPC_SYSTEM_HAS_ROUND}
{$ifdef hascompilerproc}
function round(d : Real) : int64;[internconst:in_const_round, external name 'FPC_ROUND'];
function round(d : Real) : int64;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_round];{$endif} external name 'FPC_ROUND';
function fpc_round(d : Real) : int64;[public, alias:'FPC_ROUND'];{$ifdef hascompilerproc}compilerproc;{$endif hascompilerproc}
{$else}
function round(d : Real) : int64;[internconst:in_const_round];
function round(d : Real) : int64;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_round];{$endif}
{$endif hascompilerproc}
var
fr: Real;
@ -764,7 +764,7 @@ type
{$ifndef FPC_SYSTEM_HAS_LN}
function Ln(d:Real):Real;[internconst:in_const_ln];
function Ln(d:Real):Real;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_ln];{$endif}
{*****************************************************************}
{ Natural Logarithm }
{*****************************************************************}
@ -888,7 +888,7 @@ type
{$ifndef FPC_SYSTEM_HAS_SIN}
function Sin(d:Real):Real;[internconst:in_const_sin];
function Sin(d:Real):Real;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_sin];{$endif}
{*****************************************************************}
{ Circular Sine }
{*****************************************************************}
@ -974,7 +974,7 @@ type
{$ifndef FPC_SYSTEM_HAS_COS}
function Cos(d:Real):Real;[internconst:in_const_cos];
function Cos(d:Real):Real;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_cos];{$endif}
{*****************************************************************}
{ Circular cosine }
{*****************************************************************}
@ -1057,7 +1057,7 @@ type
{$ifndef FPC_SYSTEM_HAS_ARCTAN}
function ArcTan(d:Real):Real;[internconst:in_const_arctan];
function ArcTan(d:Real):Real;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_arctan];{$endif}
{*****************************************************************}
{ Inverse circular tangent (arctangent) }
{*****************************************************************}
@ -1132,7 +1132,7 @@ type
{$ifndef FPC_SYSTEM_HAS_FRAC}
function frac(d : Real) : Real;[internconst:in_const_frac];
function frac(d : Real) : Real;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_frac];{$endif}
begin
frac := d - Int(d);
end;
@ -1248,7 +1248,12 @@ function fpc_int64_to_double(i : int64): double; compilerproc;
{
$Log$
Revision 1.27 2004-10-09 21:00:46 jonas
Revision 1.28 2004-11-20 15:49:21 jonas
* some compilation fixes for powerpc after all the internconst and
internproc changes, still crashes with internalerror(88) for ppc1
on real2str.inc(193,39)
Revision 1.27 2004/10/09 21:00:46 jonas
+ cgenmath with libc math functions. Faster than the routines in genmath
and also have full double support (exp() only has support for values in
the single range in genmath, for example). Used in FPC_USE_LIBC is

View File

@ -84,6 +84,8 @@ Procedure Rewrite(var f : TypedFile); [INTERNPROC: fpc_in_Rewrite_TypedFile];
{$ifdef FPC_USE_LIBC}
{ prefer libc implementations over our own, as they're most likely faster }
{$i cgeneric.inc}
{ is now declared as external reference to another routine in the interface }
{$define FPC_UNIT_HAS_STRLEN}
{$i cgenstr.inc}
{$endif FPC_USE_LIBC}
@ -998,7 +1000,12 @@ end;
{
$Log$
Revision 1.68 2004-11-17 22:19:04 peter
Revision 1.69 2004-11-20 15:49:21 jonas
* some compilation fixes for powerpc after all the internconst and
internproc changes, still crashes with internalerror(88) for ppc1
on real2str.inc(193,39)
Revision 1.68 2004/11/17 22:19:04 peter
internconst, internproc and some external declarations moved to interface
Revision 1.67 2004/10/30 20:49:10 marco

View File

@ -26,14 +26,16 @@ const
EXTENDED data type routines
****************************************************************************}
{$ifndef INTERNCONSTINTF}
{$define FPC_SYSTEM_HAS_PI}
function pi : double;[internproc:in_pi];
function pi : double;[internproc:fpc_in_pi];
{$define FPC_SYSTEM_HAS_ABS}
function abs(d : extended) : extended;[internproc:in_abs_extended];
function abs(d : extended) : extended;[internproc:fpc_in_abs_extended];
{$define FPC_SYSTEM_HAS_SQR}
function sqr(d : extended) : extended;[internproc:in_sqr_extended];
function sqr(d : extended) : extended;[internproc:fpc_in_sqr_extended];
{$endif ndef INTERNCONSTINTF}
const
factor: double = double(int64(1) shl 32);
@ -41,7 +43,7 @@ const
{$ifndef FPC_SYSTEM_HAS_TRUNC}
{$define FPC_SYSTEM_HAS_TRUNC}
function trunc(d : extended) : int64;assembler;[internconst:in_const_trunc];
function trunc(d : extended) : int64;assembler;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_trunc];{$endif}
{ input: d in fr1 }
{ output: result in r3 }
assembler;
@ -134,11 +136,11 @@ const
{$ifndef FPC_SYSTEM_HAS_ROUND}
{$define FPC_SYSTEM_HAS_ROUND}
{$ifdef hascompilerproc}
function round(d : extended) : int64;[internconst:in_const_round, external name 'FPC_ROUND'];
function round(d : extended) : int64;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_round, external name 'FPC_ROUND'];{$endif}
function fpc_round(d : extended) : int64;assembler;[public, alias:'FPC_ROUND'];{$ifdef hascompilerproc}compilerproc;{$endif hascompilerproc}
{$else}
function round(d : extended) : int64;assembler;[internconst:in_const_round];
function round(d : extended) : int64;assembler;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_round];{$endif}
{$endif hascompilerproc}
{ exactly the same as trunc, except that one fctiwz has become fctiw }
{ input: d in fr1 }
@ -318,7 +320,12 @@ end;
{
$Log$
Revision 1.35 2004-11-07 19:09:02 jonas
Revision 1.36 2004-11-20 15:49:21 jonas
* some compilation fixes for powerpc after all the internconst and
internproc changes, still crashes with internalerror(88) for ppc1
on real2str.inc(193,39)
Revision 1.35 2004/11/07 19:09:02 jonas
* use generic round, the ppc-specific one is buggy
Revision 1.34 2004/10/09 21:00:46 jonas

View File

@ -1065,7 +1065,7 @@ asm
end;
{$define FPC_SYSTEM_HAS_ABS_LONGINT}
function abs(l:longint):longint; assembler;[internconst:in_const_abs];{$ifdef SYSTEMINLINE}inline;{$endif} nostackframe;
function abs(l:longint):longint; assembler;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_abs];{$endif}{$ifdef SYSTEMINLINE}inline;{$endif} nostackframe;
asm
srawi r0,r3,31
add r3,r0,r3
@ -1078,14 +1078,14 @@ end;
****************************************************************************}
{$define FPC_SYSTEM_HAS_ODD_LONGINT}
function odd(l:longint):boolean;assembler;[internconst:in_const_odd];{$ifdef SYSTEMINLINE}inline;{$endif} nostackframe;
function odd(l:longint):boolean;assembler;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_odd];{$endif}{$ifdef SYSTEMINLINE}inline;{$endif} nostackframe;
asm
rlwinm r3,r3,0,31,31
end;
{$define FPC_SYSTEM_HAS_SQR_LONGINT}
function sqr(l:longint):longint;assembler;[internconst:in_const_sqr];{$ifdef SYSTEMINLINE}inline;{$endif} nostackframe;
function sqr(l:longint):longint;assembler;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_sqr];{$endif}{$ifdef SYSTEMINLINE}inline;{$endif} nostackframe;
asm
mullw r3,r3,r3
end;
@ -1138,7 +1138,12 @@ end;
{
$Log$
Revision 1.72 2004-11-08 08:54:51 jonas
Revision 1.73 2004-11-20 15:49:21 jonas
* some compilation fixes for powerpc after all the internconst and
internproc changes, still crashes with internalerror(88) for ppc1
on real2str.inc(193,39)
Revision 1.72 2004/11/08 08:54:51 jonas
* use "round to nearest" rounding mode again, just like C (affects
results of divisions as well)