diff --git a/compiler/options.pas b/compiler/options.pas index c02ef9f5d9..3f4458fc0d 100644 --- a/compiler/options.pas +++ b/compiler/options.pas @@ -2930,9 +2930,10 @@ begin def_system_macro('FPC_STATICRIPFIXED'); def_system_macro('FPC_VARIANTCOPY_FIXED'); def_system_macro('FPC_DYNARRAYCOPY_FIXED'); -{$if defined(x86) or defined(powerpc) or defined(powerpc64) or defined(cpuarm)} + +{ abs(long) is handled internally on all CPUs } def_system_macro('FPC_HAS_INTERNAL_ABS_LONG'); -{$endif} + def_system_macro('FPC_HAS_UNICODESTRING'); def_system_macro('FPC_RTTI_PACKSET1'); def_system_macro('FPC_HAS_CPSTRING'); diff --git a/rtl/inc/generic.inc b/rtl/inc/generic.inc index 406a3e666f..b146f57404 100644 --- a/rtl/inc/generic.inc +++ b/rtl/inc/generic.inc @@ -1486,6 +1486,8 @@ function fpc_mod_longint(n,z : longint) : longint; [public,alias: 'FPC_MOD_LONGI {****************************************************************************} {$ifndef FPC_SYSTEM_HAS_ABS_LONGINT} +{ This is only needed to bootstrap on SPARC targets + (MIPS and m68k too, but they have no releases, so bootstrapping is not an issue) } function abs(l:longint):longint;{$ifdef SYSTEMINLINE}inline;{$endif} begin if l<0 then diff --git a/rtl/m68k/m68k.inc b/rtl/m68k/m68k.inc index b7dc4c968e..f67ccf1280 100644 --- a/rtl/m68k/m68k.inc +++ b/rtl/m68k/m68k.inc @@ -336,20 +336,6 @@ asm end; -{$define FPC_SYSTEM_HAS_ABS_LONGINT} -function abs(l : longint) : longint; - begin - asm - move.l l,d0 - tst.l d0 - bpl @LMABS1 - neg.l d0 - @LMABS1: - move.l d0,@RESULT - end ['d0']; - end; - - function InterLockedDecrement (var Target: longint) : longint; begin {$warning FIX ME} diff --git a/rtl/mips/mips.inc b/rtl/mips/mips.inc index 79516915b9..92ab707309 100644 --- a/rtl/mips/mips.inc +++ b/rtl/mips/mips.inc @@ -411,14 +411,6 @@ procedure Move(const source;var dest;count:longint);[public, alias: 'FPC_MOVE']; Integer math ****************************************************************************} -{$define FPC_SYSTEM_HAS_ABS_LONGINT} -function abs(l:longint):longint; assembler;{$ifdef SYSTEMINLINE}inline;{$endif}nostackframe; -asm - sra $1,$4,31 // $at,$4,31 - xor $2,$4,$1 // $2,$4,$at - sub $2,$2,$1 // $2,$2,$at -end; - var fpc_system_lock : longint; export name 'fpc_system_lock'; diff --git a/rtl/sparc/sparc.inc b/rtl/sparc/sparc.inc index 7154129f87..7e8b62d369 100644 --- a/rtl/sparc/sparc.inc +++ b/rtl/sparc/sparc.inc @@ -321,14 +321,6 @@ procedure Move(const source;var dest;count:longint);[public, alias: 'FPC_MOVE']; Integer math ****************************************************************************} -{$define FPC_SYSTEM_HAS_ABS_LONGINT} -function abs(l:longint):longint; assembler;{$ifdef SYSTEMINLINE}inline;{$endif}nostackframe; -asm - sra %o0,31,%g1 - add %o0,%g1,%o0 - xor %o0,%g1,%o0 -end; - var fpc_system_lock : byte;export name 'fpc_system_lock';