Browse Source

* i386 uses generic x86 abs(long/int64) code now

florian 1 year ago
parent
commit
a8d496ade7
2 changed files with 3 additions and 33 deletions
  1. 0 32
      compiler/i386/n386inl.pas
  2. 3 1
      compiler/x86/nx86inl.pas

+ 0 - 32
compiler/i386/n386inl.pas

@@ -33,7 +33,6 @@ interface
        public
        public
          function first_sar: tnode; override;
          function first_sar: tnode; override;
          procedure second_rox_sar; override;
          procedure second_rox_sar; override;
-         procedure second_abs_long; override;
        end;
        end;
 
 
 implementation
 implementation
@@ -121,37 +120,6 @@ implementation
         inherited second_rox_sar;
         inherited second_rox_sar;
     end;
     end;
 
 
-
-  procedure ti386inlinenode.second_abs_long;
-    var
-      hl: TAsmLabel;
-    begin
-      if is_64bitint(left.resultdef) then
-        begin
-          secondpass(left);
-          hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,false);
-          location:=left.location;
-          location.register64.reglo:=cg.getintregister(current_asmdata.CurrAsmList,OS_32);
-          location.register64.reghi:=cg.getintregister(current_asmdata.CurrAsmList,OS_32);
-          cg64.a_load64_reg_reg(current_asmdata.CurrAsmList,left.location.register64,location.register64);
-          cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SAR,OS_32,31,left.location.register64.reghi);
-          cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_XOR,OS_32,left.location.register64.reghi,location.register64.reglo);
-          cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_XOR,OS_32,left.location.register64.reghi,location.register64.reghi);
-          emit_reg_reg(A_SUB,S_L,left.location.register64.reghi,location.register64.reglo);
-          emit_reg_reg(A_SBB,S_L,left.location.register64.reghi,location.register64.reghi);
-          if cs_check_overflow in current_settings.localswitches then
-            begin
-              current_asmdata.getjumplabel(hl);
-              cg.a_jmp_flags(current_asmdata.CurrAsmList,F_NO,hl);
-              cg.a_call_name(current_asmdata.CurrAsmList,'FPC_OVERFLOW',false);
-              cg.a_label(current_asmdata.CurrAsmList,hl);
-            end;
-        end
-      else
-        inherited second_abs_long;
-    end;
-
-
 begin
 begin
    cinlinenode:=ti386inlinenode;
    cinlinenode:=ti386inlinenode;
 end.
 end.

+ 3 - 1
compiler/x86/nx86inl.pas

@@ -1094,7 +1094,9 @@ implementation
         hl: TAsmLabel;
         hl: TAsmLabel;
       begin
       begin
 {$if defined(i8086) or defined(i386)}
 {$if defined(i8086) or defined(i386)}
-        if not(CPUX86_HAS_CMOV in cpu_capabilities[current_settings.cputype]) then
+        if is_64bitint(resultdef) then
+          inherited
+        else if not(CPUX86_HAS_CMOV in cpu_capabilities[current_settings.cputype]) then
           begin
           begin
             opsize:=def_cgsize(left.resultdef);
             opsize:=def_cgsize(left.resultdef);
             secondpass(left);
             secondpass(left);