mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-29 13:19:17 +02:00
* fix for dword div dword power of two
git-svn-id: trunk@2890 -
This commit is contained in:
parent
d997985fef
commit
558c894e73
@ -99,6 +99,8 @@ implementation
|
||||
if (nodetype = divn) and
|
||||
(right.nodetype = ordconstn) and
|
||||
ispowerof2(tordconstnode(right).value,power) then
|
||||
begin
|
||||
if is_signed(left.resulttype.def) Then
|
||||
begin
|
||||
tmpreg:=cg.GetIntRegister(exprasmlist,OS_INT);
|
||||
cg.a_op_const_reg_reg(exprasmlist,OP_SAR,OS_INT,31,numerator,tmpreg);
|
||||
@ -108,6 +110,9 @@ implementation
|
||||
cg.a_op_reg_reg(exprasmlist,OP_ADD,OS_INT,tmpreg,numerator);
|
||||
cg.a_op_const_reg_reg(exprasmlist,OP_SAR,OS_INT,aword(power),numerator,resultreg);
|
||||
end
|
||||
else
|
||||
cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_INT,aword(power),numerator,resultreg);
|
||||
end
|
||||
else
|
||||
begin
|
||||
{ load divider in a register if necessary }
|
||||
|
Loading…
Reference in New Issue
Block a user