浏览代码

+ also check for negative powers of 2 in the mod by power-of-2 constant x86 optimization, since the sign of the divisor is ignored by the 'mod' operation

git-svn-id: trunk@36797 -
nickysn 8 年之前
父节点
当前提交
b6c3329f20
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      compiler/x86/nx86mat.pas

+ 2 - 2
compiler/x86/nx86mat.pas

@@ -510,9 +510,9 @@ interface
                   end;
                   end;
               end;
               end;
           end
           end
-        { unsigned modulus by a power-of-2 constant? }
+        { unsigned modulus by a (+/-)power-of-2 constant? }
         else if (nodetype=modn) and (right.nodetype=ordconstn) and
         else if (nodetype=modn) and (right.nodetype=ordconstn) and
-                ispowerof2(tordconstnode(right).value,power) and
+                isabspowerof2(tordconstnode(right).value,power) and
                 not(is_signed(left.resultdef)) then
                 not(is_signed(left.resultdef)) then
           begin
           begin
             emit_const_reg(A_AND,opsize,(aint(1) shl power)-1,hreg1);
             emit_const_reg(A_AND,opsize,(aint(1) shl power)-1,hreg1);