Przeglądaj źródła

+ avx uses add to multiply by 2
* formatting

git-svn-id: trunk@24906 -

florian 12 lat temu
rodzic
commit
0a84f1f10c
2 zmienionych plików z 23 dodań i 2 usunięć
  1. 0 1
      compiler/ncgadd.pas
  2. 23 1
      compiler/x86/nx86add.pas

+ 0 - 1
compiler/ncgadd.pas

@@ -119,7 +119,6 @@ interface
           if left.location.loc=LOC_JUMP then
             internalerror(2012081302);
 
-
 {$ifdef x86}
         { are too few registers free? }
         pushedfpu:=false;

+ 23 - 1
compiler/x86/nx86add.pas

@@ -808,6 +808,7 @@ unit nx86add;
           end;
       end;
 
+
     procedure tx86addnode.second_addfloatavx;
       var
         op : topcg;
@@ -904,6 +905,28 @@ unit nx86add;
                 end;
               end
           end
+        { left*2 ? }
+        else if (nodetype=muln) and is_constrealnode(right) and is_number_float(trealconstnode(right).value_real) and (trealconstnode(right).value_real=2) then
+          begin
+            location.register:=cg.getmmregister(current_asmdata.CurrAsmList,left.location.size);
+            hlcg.location_force_mmregscalar(current_asmdata.CurrAsmList,left.location,left.resultdef,true);
+            cg.a_opmm_reg_reg_reg(current_asmdata.CurrAsmList,OP_ADD,location.size,
+              left.location.register,
+              left.location.register,
+              location.register,
+              mms_movescalar);
+          end
+        { right*2 ? }
+        else if (nodetype=muln) and is_constrealnode(left) and is_number_float(trealconstnode(left).value_real) and (trealconstnode(left).value_real=2) then
+          begin
+            location.register:=cg.getmmregister(current_asmdata.CurrAsmList,right.location.size);
+            hlcg.location_force_mmregscalar(current_asmdata.CurrAsmList,right.location,right.resultdef,true);
+            cg.a_opmm_reg_reg_reg(current_asmdata.CurrAsmList,OP_ADD,location.size,
+              right.location.register,
+              right.location.register,
+              location.register,
+              mms_movescalar);
+          end
         { we can use only right as left operand if the operation is commutative }
         else if (right.location.loc=LOC_MMREGISTER) and (op in [OP_ADD,OP_MUL]) then
           begin
@@ -1009,7 +1032,6 @@ unit nx86add;
       end;
 
 
-
     procedure tx86addnode.second_cmpfloatavx;
       var
         op : tasmop;