Bläddra i källkod

* x86: avoid to put variables into registers if they are handled by the x87-FPU

git-svn-id: trunk@43856 -
florian 5 år sedan
förälder
incheckning
3c16324f80
1 ändrade filer med 18 tillägg och 1 borttagningar
  1. 18 1
      compiler/x86/nx86add.pas

+ 18 - 1
compiler/x86/nx86add.pas

@@ -47,6 +47,7 @@ unit nx86add;
         procedure second_addfloatsse;
         procedure second_addfloatavx;
       public
+        function pass_1 : tnode;override;
         function use_fma : boolean;override;
         procedure second_addfloat;override;
 {$ifndef i8086}
@@ -77,7 +78,8 @@ unit nx86add;
       cgobj,hlcgobj,cgx86,cga,cgutils,
       tgobj,ncgutil,
       ncon,nset,ninl,
-      defutil;
+      defutil,
+      htypechk;
 
 { Range check must be disabled explicitly as the code serves
   on three different architecture sizes }
@@ -1146,6 +1148,21 @@ unit nx86add;
       end;
 
 
+    function tx86addnode.pass_1: tnode;
+      begin
+        { on x86, we do not support fpu registers, so in case of operations using the x87, it
+          is normally useful, not to put the operands into registers which would be mm register }
+        if ((left.resultdef.typ=floatdef) or (right.resultdef.typ=floatdef)) and
+          (not(use_vectorfpu(left.resultdef)) and not(use_vectorfpu(right.resultdef)) and
+           not(use_vectorfpu(resultdef))) then
+          begin
+            make_not_regable(left,[ra_addr_regable]);
+            make_not_regable(right,[ra_addr_regable]);
+          end;
+        Result:=inherited pass_1;
+      end;
+
+
     function tx86addnode.use_fma : boolean;
       begin
 {$ifndef i8086}