Jelajahi Sumber

* call x86 addordinal for non short boolean evaluated boolean nodes
as this results in better code

git-svn-id: trunk@45404 -

florian 5 tahun lalu
induk
melakukan
97efb03ae6
1 mengubah file dengan 16 tambahan dan 2 penghapusan
  1. 16 2
      compiler/x86/nx86add.pas

+ 16 - 2
compiler/x86/nx86add.pas

@@ -60,6 +60,7 @@ unit nx86add;
 
         procedure second_cmpordinal;override;
         procedure second_addordinal;override;
+        procedure second_addboolean;override;
 {$ifdef SUPPORT_MMX}
         procedure second_opmmx;override;
 {$endif SUPPORT_MMX}
@@ -1507,9 +1508,11 @@ unit nx86add;
 
        pass_left_right;
 
-       { do have to allocate a register? If yes, then three opcode instructions are better, however for sub three op code instructions
+       { do we have to allocate a register? If yes, then three opcode instructions are better, however for sub three op code instructions
          make no sense if right is a reference }
-       if ((left.location.loc<>LOC_REGISTER) and (right.location.loc<>LOC_REGISTER) and ((nodetype<>subn) or not(right.location.loc in [LOC_REFERENCE,LOC_CREFERENCE]))) or
+       if ((left.location.loc<>LOC_REGISTER) and (right.location.loc<>LOC_REGISTER) and
+           ((nodetype<>subn) or not(right.location.loc in [LOC_REFERENCE,LOC_CREFERENCE])) and
+           (not(nodetype in [orn,andn,xorn]))) or
          ((nodetype=addn) and (left.location.loc in [LOC_REGISTER,LOC_CREGISTER,LOC_CONSTANT]) and (right.location.loc in [LOC_REGISTER,LOC_CREGISTER,LOC_CONSTANT])) then
          begin
            { allocate registers }
@@ -1606,6 +1609,17 @@ unit nx86add;
      end;
 
 
+    procedure tx86addnode.second_addboolean;
+      begin
+        if (nodetype in [orn,andn]) and
+           (not(cs_full_boolean_eval in current_settings.localswitches) or
+          (nf_short_bool in flags)) then
+          inherited second_addboolean
+        else
+          second_addordinal;
+      end;
+
+
     procedure tx86addnode.second_cmpordinal;
       var
          opdef  : tdef;