mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-02 17:50:16 +02:00
+ perform unsigned modulus by power of 2 constant by using an AND instruction (instead of DIV) on x86
git-svn-id: trunk@36756 -
This commit is contained in:
parent
9853c4a2a3
commit
7c306f18e3
@ -510,6 +510,14 @@ interface
|
||||
end;
|
||||
end;
|
||||
end
|
||||
{ unsigned modulus by a power-of-2 constant? }
|
||||
else if (nodetype=modn) and (right.nodetype=ordconstn) and
|
||||
ispowerof2(tordconstnode(right).value,power) and
|
||||
not(is_signed(left.resultdef)) then
|
||||
begin
|
||||
emit_const_reg(A_AND,opsize,(aint(1) shl power)-1,hreg1);
|
||||
location.register:=hreg1;
|
||||
end
|
||||
else
|
||||
begin
|
||||
{Bring denominator to a register.}
|
||||
|
Loading…
Reference in New Issue
Block a user