mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-03 11:37:14 +01:00
* patch by J. Gareth Moreton: take care of -Os for SubMov2*, part of #38579
git-svn-id: trunk@48878 -
This commit is contained in:
parent
81f0442e5d
commit
913bd009e9
@ -7131,13 +7131,20 @@ unit aoptx86;
|
|||||||
a CMP instruction if one follows.
|
a CMP instruction if one follows.
|
||||||
}
|
}
|
||||||
Result := False;
|
Result := False;
|
||||||
if not (cs_opt_size in current_settings.optimizerswitches) and
|
if (taicpu(p).opsize in [S_L{$ifdef x86_64}, S_Q{$endif x86_64}]) and
|
||||||
(taicpu(p).opsize in [S_L{$ifdef x86_64}, S_Q{$endif x86_64}]) and
|
|
||||||
MatchOpType(taicpu(p),top_const,top_reg) and
|
MatchOpType(taicpu(p),top_const,top_reg) and
|
||||||
GetNextInstruction(p, hp1) and
|
GetNextInstruction(p, hp1) and
|
||||||
MatchInstruction(hp1, A_MOV, [taicpu(p).opsize]) and
|
MatchInstruction(hp1, A_MOV, [taicpu(p).opsize]) and
|
||||||
(taicpu(hp1).oper[1]^.typ = top_reg) and
|
(taicpu(hp1).oper[1]^.typ = top_reg) and
|
||||||
MatchOperand(taicpu(hp1).oper[0]^, taicpu(p).oper[1]^.reg) then
|
MatchOperand(taicpu(hp1).oper[0]^, taicpu(p).oper[1]^.reg) and
|
||||||
|
(
|
||||||
|
{ Don't do SubMov2LeaSub under -Os, but do allow SubMov2Lea }
|
||||||
|
not (cs_opt_size in current_settings.optimizerswitches) or
|
||||||
|
(
|
||||||
|
not RegUsedAfterInstruction(taicpu(p).oper[1]^.reg, hp1, TmpUsedRegs) and
|
||||||
|
RegUsedAfterInstruction(NR_DEFAULTFLAGS, hp1, TmpUsedRegs)
|
||||||
|
)
|
||||||
|
) then
|
||||||
begin
|
begin
|
||||||
{ Change the MOV instruction to a LEA instruction, and update the
|
{ Change the MOV instruction to a LEA instruction, and update the
|
||||||
first operand }
|
first operand }
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user