Explorar o código

+ tx86addnode.second_opvector makes use of AVX instructions

git-svn-id: trunk@47345 -
florian %!s(int64=4) %!d(string=hai) anos
pai
achega
e46b426ca1
Modificáronse 1 ficheiros con 22 adicións e 5 borrados
  1. 22 5
      compiler/x86/nx86add.pas

+ 22 - 5
compiler/x86/nx86add.pas

@@ -1268,15 +1268,32 @@ unit nx86add;
             { we can use only right as left operand if the operation is commutative }
             if (right.location.loc=LOC_MMREGISTER) and (op in [OP_ADD,OP_MUL]) then
               begin
-                location.register:=right.location.register;
-                cg.a_opmm_loc_reg(current_asmdata.CurrAsmList,op,tfloat2tcgsize[tfloatdef(left.resultdef).floattype],left.location,location.register,nil);
+                if UseAVX then
+                  begin
+                    location.register:=cg.getmmregister(current_asmdata.CurrAsmList,OS_VECTOR);
+                    cg.a_opmm_loc_reg_reg(current_asmdata.CurrAsmList,op,tfloat2tcgsize[tfloatdef(left.resultdef).floattype],left.location,right.location.register,location.register,nil);
+                  end
+                else
+                  begin
+                    location.register:=right.location.register;
+                    cg.a_opmm_loc_reg(current_asmdata.CurrAsmList,op,tfloat2tcgsize[tfloatdef(left.resultdef).floattype],left.location,location.register,nil);
+                  end;
               end
             else
               begin
                 location_force_mmreg(current_asmdata.CurrAsmList,left.location,false);
-                location.register:=left.location.register;
-                cg.a_opmm_loc_reg(current_asmdata.CurrAsmList,op,
-                  tfloat2tcgsize[tfloatdef(tarraydef(left.resultdef).elementdef).floattype],right.location,location.register,nil);
+                if UseAVX then
+                  begin
+                    location.register:=cg.getmmregister(current_asmdata.CurrAsmList,OS_VECTOR);
+                    cg.a_opmm_loc_reg_reg(current_asmdata.CurrAsmList,op,
+                      tfloat2tcgsize[tfloatdef(tarraydef(left.resultdef).elementdef).floattype],right.location,left.location.register,location.register,nil);
+                  end
+                else
+                  begin
+                    location.register:=left.location.register;
+                    cg.a_opmm_loc_reg(current_asmdata.CurrAsmList,op,
+                      tfloat2tcgsize[tfloatdef(tarraydef(left.resultdef).elementdef).floattype],right.location,location.register,nil);
+                  end;
               end;
           end
         else