瀏覽代碼

* Enabled internal handling of Abs(longint) for all targets. It has been implemented in cross-platform way ages ago (see tcginlinenode.second_abs_long), but not enabled on MIPS,SPARC and m68k.
- RTL: removed MIPS,SPARC and m68k-specific implementations of Abs(longint), and marked the generic one as required for bootstrapping purposes only.

git-svn-id: trunk@27857 -

sergei 11 年之前
父節點
當前提交
217ab9879c
共有 5 個文件被更改,包括 5 次插入32 次删除
  1. 3 2
      compiler/options.pas
  2. 2 0
      rtl/inc/generic.inc
  3. 0 14
      rtl/m68k/m68k.inc
  4. 0 8
      rtl/mips/mips.inc
  5. 0 8
      rtl/sparc/sparc.inc

+ 3 - 2
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');

+ 2 - 0
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

+ 0 - 14
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}

+ 0 - 8
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';
 

+ 0 - 8
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';