Browse Source

* emit MUL (when overflow checking is off), instead of IMUL for OP_IMUL in
tcg8086.a_op_const_reg, when the target CPU is 8086/8088, because it's
supposed to be faster on these processors, according to Intel's instruction
timings.

git-svn-id: trunk@26493 -

nickysn 11 years ago
parent
commit
529008e031
1 changed files with 6 additions and 1 deletions
  1. 6 1
      compiler/i8086/cgcpu.pas

+ 6 - 1
compiler/i8086/cgcpu.pas

@@ -511,7 +511,12 @@ unit cgcpu;
                     a_load_const_reg(list,size,a,ax_subreg);
                     if size in [OS_16,OS_S16] then
                       getcpuregister(list,NR_DX);
-                    list.concat(taicpu.op_reg(A_IMUL,TCgSize2OpSize[size],reg));
+                    { prefer MUL over IMUL when overflow checking is off, }
+                    { because it's faster on the 8086 & 8088              }
+                    if not (cs_check_overflow in current_settings.localswitches) then
+                      list.concat(taicpu.op_reg(A_MUL,TCgSize2OpSize[size],reg))
+                    else
+                      list.concat(taicpu.op_reg(A_IMUL,TCgSize2OpSize[size],reg));
                     if size in [OS_16,OS_S16] then
                       ungetcpuregister(list,NR_DX);
                     a_load_reg_reg(list,size,size,ax_subreg,reg);