mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-14 09:29:19 +02:00
+ better precision in determining the registers, read by mul/imul/div/idiv in
i386's TCpuAsmOptimizer.RegReadByInstruction: * mul doesn't read edx (unless included in operand) * 8-bit mul and imul don't read ah (unless included in operand) * 8-bit div and idiv don't read edx (unless included in operand) git-svn-id: trunk@35958 -
This commit is contained in:
parent
916c09af55
commit
0f010430cc
@ -160,17 +160,33 @@ unit aoptcpu;
|
|||||||
A_IMUL:
|
A_IMUL:
|
||||||
case p.ops of
|
case p.ops of
|
||||||
1:
|
1:
|
||||||
regReadByInstruction :=
|
regReadByInstruction := RegInOp(reg,p.oper[0]^) or
|
||||||
(reg = NR_EAX) or RegInOp(reg,p.oper[0]^);
|
(
|
||||||
|
((getregtype(reg)=R_INTREGISTER) and (getsupreg(reg)=RS_EAX)) and
|
||||||
|
((getsubreg(reg)<>R_SUBH) or (p.opsize<>S_B))
|
||||||
|
);
|
||||||
2,3:
|
2,3:
|
||||||
regReadByInstruction :=
|
regReadByInstruction :=
|
||||||
reginop(reg,p.oper[0]^) or
|
reginop(reg,p.oper[0]^) or
|
||||||
reginop(reg,p.oper[1]^);
|
reginop(reg,p.oper[1]^);
|
||||||
end;
|
end;
|
||||||
A_IDIV,A_DIV,A_MUL:
|
A_MUL:
|
||||||
begin
|
begin
|
||||||
regReadByInstruction :=
|
regReadByInstruction := RegInOp(reg,p.oper[0]^) or
|
||||||
RegInOp(reg,p.oper[0]^) or ((getregtype(reg)=R_INTREGISTER) and (getsupreg(reg) in [RS_EAX,RS_EDX]));
|
(
|
||||||
|
((getregtype(reg)=R_INTREGISTER) and (getsupreg(reg)=RS_EAX)) and
|
||||||
|
((getsubreg(reg)<>R_SUBH) or (p.opsize<>S_B))
|
||||||
|
);
|
||||||
|
end;
|
||||||
|
A_IDIV,A_DIV:
|
||||||
|
begin
|
||||||
|
regReadByInstruction := RegInOp(reg,p.oper[0]^) or
|
||||||
|
(
|
||||||
|
(getregtype(reg)=R_INTREGISTER) and
|
||||||
|
(
|
||||||
|
(getsupreg(reg)=RS_EAX) or ((getsupreg(reg)=RS_EDX) and (p.opsize<>S_B))
|
||||||
|
)
|
||||||
|
);
|
||||||
end;
|
end;
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user