Jelajahi Sumber

+ make use of the 3-operand form of IMUL on i386 and x86_64

git-svn-id: trunk@26508 -
nickysn 11 tahun lalu
induk
melakukan
cc1faad3d2
1 mengubah file dengan 8 tambahan dan 0 penghapusan
  1. 8 0
      compiler/x86/cgx86.pas

+ 8 - 0
compiler/x86/cgx86.pas

@@ -1584,6 +1584,14 @@ unit cgx86;
             href.scalefactor:=a;
             list.concat(taicpu.op_ref_reg(A_LEA,TCgSize2OpSize[size],href,dst));
           end
+        else if (op in [OP_MUL,OP_IMUL]) and (size in [OS_32,OS_S32,OS_64,OS_S64]) and
+          (a>1) and not ispowerof2(int64(a),power) then
+          begin
+            { MUL with overflow checking should be handled specifically in the code generator }
+            if (op=OP_MUL) and (cs_check_overflow in current_settings.localswitches) then
+              internalerror(2014011801);
+            list.concat(taicpu.op_const_reg_reg(A_IMUL,TCgSize2OpSize[size],a,src,dst));
+          end
         else if (op=OP_ADD) and
           ((size in [OS_32,OS_S32]) or
            { lea supports only 32 bit signed displacments }