Browse Source

+ 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 years ago
parent
commit
b6c3329f20
1 changed files with 2 additions and 2 deletions
  1. 2 2
      compiler/x86/nx86mat.pas

+ 2 - 2
compiler/x86/nx86mat.pas

@@ -510,9 +510,9 @@ interface
                   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
-                ispowerof2(tordconstnode(right).value,power) and
+                isabspowerof2(tordconstnode(right).value,power) and
                 not(is_signed(left.resultdef)) then
           begin
             emit_const_reg(A_AND,opsize,(aint(1) shl power)-1,hreg1);