+ 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 -
This commit is contained in:
nickysn 2017-07-26 16:10:41 +00:00
parent 4b00414183
commit b6c3329f20

View File

@ -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);