Browse Source

* Mantis #17273: don't generate x87 instructions on win64 target.

git-svn-id: trunk@25995 -
sergei 11 years ago
parent
commit
2b1e5f7014
2 changed files with 32 additions and 9 deletions
  1. 29 8
      compiler/x86/nx86inl.pas
  2. 3 1
      rtl/x86_64/math.inc

+ 29 - 8
compiler/x86/nx86inl.pas

@@ -91,15 +91,25 @@ implementation
 
 
      function tx86inlinenode.first_pi : tnode;
      function tx86inlinenode.first_pi : tnode;
       begin
       begin
-        expectloc:=LOC_FPUREGISTER;
-        first_pi := nil;
+        if (tfloatdef(pbestrealtype^).floattype=s80real) then
+          begin
+            expectloc:=LOC_FPUREGISTER;
+            first_pi := nil;
+          end
+        else
+          result:=inherited;
       end;
       end;
 
 
 
 
      function tx86inlinenode.first_arctan_real : tnode;
      function tx86inlinenode.first_arctan_real : tnode;
       begin
       begin
-        expectloc:=LOC_FPUREGISTER;
-        first_arctan_real := nil;
+        if (tfloatdef(pbestrealtype^).floattype=s80real) then
+          begin
+            expectloc:=LOC_FPUREGISTER;
+            first_arctan_real := nil;
+          end
+        else
+          result:=inherited;
       end;
       end;
 
 
      function tx86inlinenode.first_abs_real : tnode;
      function tx86inlinenode.first_abs_real : tnode;
@@ -113,20 +123,31 @@ implementation
 
 
      function tx86inlinenode.first_sqr_real : tnode;
      function tx86inlinenode.first_sqr_real : tnode;
       begin
       begin
-        expectloc:=LOC_FPUREGISTER;
+        if use_vectorfpu(resultdef) then
+          expectloc:=LOC_MMREGISTER
+        else
+          expectloc:=LOC_FPUREGISTER;
         first_sqr_real := nil;
         first_sqr_real := nil;
       end;
       end;
 
 
      function tx86inlinenode.first_sqrt_real : tnode;
      function tx86inlinenode.first_sqrt_real : tnode;
       begin
       begin
-        expectloc:=LOC_FPUREGISTER;
+        if use_vectorfpu(resultdef) then
+          expectloc:=LOC_MMREGISTER
+        else
+          expectloc:=LOC_FPUREGISTER;
         first_sqrt_real := nil;
         first_sqrt_real := nil;
       end;
       end;
 
 
      function tx86inlinenode.first_ln_real : tnode;
      function tx86inlinenode.first_ln_real : tnode;
       begin
       begin
-        expectloc:=LOC_FPUREGISTER;
-        first_ln_real := nil;
+        if (tfloatdef(pbestrealtype^).floattype=s80real) then
+          begin
+            expectloc:=LOC_FPUREGISTER;
+            first_ln_real := nil;
+          end
+        else
+          result:=inherited;
       end;
       end;
 
 
      function tx86inlinenode.first_cos_real : tnode;
      function tx86inlinenode.first_cos_real : tnode;

+ 3 - 1
rtl/x86_64/math.inc

@@ -102,6 +102,9 @@ const
       result:=0;
       result:=0;
     end;
     end;
     {$endif FPC_SYSTEM_HAS_SQRT}
     {$endif FPC_SYSTEM_HAS_SQRT}
+
+{$ifdef FPC_HAS_TYPE_EXTENDED}
+
     {$ifndef FPC_SYSTEM_HAS_ARCTAN}
     {$ifndef FPC_SYSTEM_HAS_ARCTAN}
     {$define FPC_SYSTEM_HAS_ARCTAN}
     {$define FPC_SYSTEM_HAS_ARCTAN}
     function fpc_arctan_real(d : ValReal) : ValReal;compilerproc;
     function fpc_arctan_real(d : ValReal) : ValReal;compilerproc;
@@ -139,7 +142,6 @@ const
     end;
     end;
     {$endif FPC_SYSTEM_HAS_COS}
     {$endif FPC_SYSTEM_HAS_COS}
 
 
-{$ifdef FPC_HAS_TYPE_EXTENDED}
     {$ifndef FPC_SYSTEM_HAS_EXP}
     {$ifndef FPC_SYSTEM_HAS_EXP}
     {$define FPC_SYSTEM_HAS_EXP}
     {$define FPC_SYSTEM_HAS_EXP}
     function fpc_exp_real(d : ValReal) : ValReal;assembler;compilerproc;
     function fpc_exp_real(d : ValReal) : ValReal;assembler;compilerproc;