Forráskód Böngészése

* swap fpu stack correctly when moving data into xmm registers

git-svn-id: trunk@45637 -
florian 5 éve
szülő
commit
b2ed667a86
1 módosított fájl, 10 hozzáadás és 6 törlés
  1. 10 6
      compiler/x86/nx86add.pas

+ 10 - 6
compiler/x86/nx86add.pas

@@ -875,14 +875,14 @@ unit nx86add;
 
         pass_left_right;
         { fpu operands are always in reversed order on the stack }
-        if (left.location.loc=LOC_FPUREGISTER) and (right.location.loc=LOC_FPUREGISTER) then
+        if (left.location.loc in [LOC_FPUREGISTER,LOC_CFPUREGISTER]) and (right.location.loc in [LOC_FPUREGISTER,LOC_CFPUREGISTER]) then
           toggleflag(nf_swapped);
 
         if (nf_swapped in flags) then
           { can't use swapleftright if both are on the fpu stack, since then }
           { both are "R_ST" -> nothing would change -> manually switch       }
-          if (left.location.loc = LOC_FPUREGISTER) and
-             (right.location.loc = LOC_FPUREGISTER) then
+          if (left.location.loc in [LOC_FPUREGISTER,LOC_CFPUREGISTER]) and
+             (right.location.loc in [LOC_FPUREGISTER,LOC_CFPUREGISTER]) then
             emit_none(A_FXCH,S_NO)
           else
             swapleftright;
@@ -1018,14 +1018,14 @@ unit nx86add;
 
         pass_left_right;
         { fpu operands are always in reversed order on the stack }
-        if (left.location.loc=LOC_FPUREGISTER) and (right.location.loc=LOC_FPUREGISTER) then
+        if (left.location.loc in [LOC_FPUREGISTER,LOC_CFPUREGISTER]) and (right.location.loc in [LOC_FPUREGISTER,LOC_CFPUREGISTER]) then
           toggleflag(nf_swapped);
 
         if (nf_swapped in flags) then
           { can't use swapleftright if both are on the fpu stack, since then }
           { both are "R_ST" -> nothing would change -> manually switch       }
-          if (left.location.loc = LOC_FPUREGISTER) and
-             (right.location.loc = LOC_FPUREGISTER) then
+          if (left.location.loc in [LOC_FPUREGISTER,LOC_CFPUREGISTER]) and
+             (right.location.loc in [LOC_FPUREGISTER,LOC_CFPUREGISTER]) then
             emit_none(A_FXCH,S_NO)
           else
             swapleftright;
@@ -1191,6 +1191,10 @@ unit nx86add;
           internalerror(200402222);
         pass_left_right;
 
+        { fpu operands are always in reversed order on the stack }
+        if (left.location.loc in [LOC_FPUREGISTER,LOC_CFPUREGISTER]) and (right.location.loc in [LOC_FPUREGISTER,LOC_CFPUREGISTER]) then
+          toggleflag(nf_swapped);
+
         location_reset(location,LOC_FLAGS,OS_NO);
 
         { Direct move fpu->mm register is not possible, so force any fpu operands to