mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 20:09:25 +02:00
* x86: 64-bit integer division reciprocal algorithm uses IMUL
with an immediate for the modulus version where possible
This commit is contained in:
parent
8f2734e1f1
commit
079905654d
@ -552,13 +552,16 @@ interface
|
||||
{ Now multiply the quotient by the original denominator and
|
||||
subtract the product from the original numerator to get
|
||||
the remainder. }
|
||||
if (cgsize in [OS_64,OS_S64]) then { Cannot use 64-bit constants in IMUL }
|
||||
{$ifdef x86_64}
|
||||
if (cgsize in [OS_64,OS_S64]) and (d > $7FFFFFFF) then { Cannot use 64-bit constants in IMUL }
|
||||
begin
|
||||
hreg3:=cg.getintregister(current_asmdata.CurrAsmList,cgsize);
|
||||
emit_const_reg(A_MOV,opsize,aint(d),hreg3);
|
||||
emit_reg_reg(A_IMUL,opsize,hreg3,regd);
|
||||
end
|
||||
else
|
||||
{$endif x86_64}
|
||||
{$endif x86_64}
|
||||
emit_const_reg(A_IMUL,opsize,aint(d),regd);
|
||||
|
||||
emit_reg_reg(A_SUB,opsize,regd,hreg2);
|
||||
|
Loading…
Reference in New Issue
Block a user